diff options
author | Fritz Elfert <felfert@to.com> | 2001-02-07 00:10:42 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2001-02-07 00:10:42 +0000 |
commit | d7e9657a4a70e7bffadcb962fc0411c337052365 (patch) | |
tree | 93f20afe1d8c3f2c75d56537338667d3f20762ab /kde2 | |
parent | 962c0ae9f2b71dc6314c2ef22d294a8255bcd1e4 (diff) | |
download | plptools-d7e9657a4a70e7bffadcb962fc0411c337052365.tar.gz plptools-d7e9657a4a70e7bffadcb962fc0411c337052365.tar.bz2 plptools-d7e9657a4a70e7bffadcb962fc0411c337052365.zip |
- Fixed bug in rfsv32, introduced by recent change to C++ strings:
mkdir and rmdir did not work.
- Mor KDE2 related stuff.
Diffstat (limited to 'kde2')
-rw-r--r-- | kde2/kioslave/kio_plp.cpp | 242 | ||||
-rw-r--r-- | kde2/kioslave/kio_plp.h | 5 | ||||
-rw-r--r-- | kde2/kioslave/psion.protocol | 1 | ||||
-rw-r--r-- | kde2/mime/Makefile.am | 10 | ||||
-rw-r--r-- | kde2/mime/icons/lo32-app-psion_owner.png | bin | 0 -> 392 bytes | |||
-rw-r--r-- | kde2/mime/x-psion-drive.desktop | 1 | ||||
-rw-r--r-- | kde2/plugins/plpprops.cc | 38 | ||||
-rw-r--r-- | kde2/plugins/plpprops.h | 2 |
8 files changed, 225 insertions, 74 deletions
diff --git a/kde2/kioslave/kio_plp.cpp b/kde2/kioslave/kio_plp.cpp index 4b9fb49..ffa5c8a 100644 --- a/kde2/kioslave/kio_plp.cpp +++ b/kde2/kioslave/kio_plp.cpp @@ -52,6 +52,14 @@ extern "C" { int kdemain(int argc, char **argv); } +#define PLP_FTYPE_DRIVE 1 +#define PLP_FTYPE_OWNER 2 +#define PLP_FTYPE_MACHINE 3 +#define PLP_FTYPE_SETUP 4 +#define PLP_FTYPE_BACKUP 5 +#define PLP_FTYPE_RESTORE 6 +#define PLP_FTYPE_ROOT 7 + int kdemain( int argc, char **argv ) { KInstance instance( "kio_nfs" ); @@ -191,6 +199,22 @@ driveChar(const QString& path) { return '\0'; } +int PLPProtocol:: +checkSpecial(const QString& path) { + QString tmp = path.mid(1); + if (tmp == i18n("Owner")) + return PLP_FTYPE_OWNER; + if (tmp == i18n("Machine")) + return PLP_FTYPE_MACHINE; + if (tmp == i18n("Settings")) + return PLP_FTYPE_SETUP; + if (tmp == i18n("Backup")) + return PLP_FTYPE_BACKUP; + if (tmp == i18n("Restore")) + return PLP_FTYPE_RESTORE; + return 0; +} + void PLPProtocol:: convertName(QString &path) { kdDebug(PLP_DEBUGAREA) << "convert: in='" << path << "' out='"; @@ -209,15 +233,15 @@ openConnection() { closeConnection(); plpRfsvSocket = new ppsocket(); + QString estr = i18n("Could not connect to ncpd at %1:%2").arg(currentHost).arg(currentPort); if (!plpRfsvSocket->connect((char *)(currentHost.data()), currentPort)) { - QString tmp = i18n("Could not connect to ncpd at %1:%2").arg(currentHost).arg(currentPort); - error(ERR_COULD_NOT_CONNECT, tmp); + error(ERR_COULD_NOT_CONNECT, estr); return; } rfsvfactory factory(plpRfsvSocket); plpRfsv = factory.create(false); if (plpRfsv == 0L) { - error(ERR_COULD_NOT_CONNECT, i18n("Could not read version info.")); + error(ERR_COULD_NOT_CONNECT, estr); return; } @@ -270,6 +294,7 @@ openConnection() { bool PLPProtocol:: checkConnection() { + kdDebug(PLP_DEBUGAREA) << "PLP::checkConnection" << endl; if (plpRfsv == 0) openConnection(); return (plpRfsv == 0); @@ -305,19 +330,56 @@ listDir(const KURL& _url) { if (isRoot(path)) { kdDebug(PLP_DEBUGAREA) << "listing root" << endl; - totalSize(drives.count()); + totalSize(drives.count()/* + 5*/); //in this case we don't need to do a real listdir UDSEntry entry; + UDSAtom atom; for (QStringList::Iterator it = drives.begin(); it != drives.end(); it++) { - UDSAtom atom; entry.clear(); atom.m_uds = KIO::UDS_NAME; atom.m_str = (*it); kdDebug(PLP_DEBUGAREA) << "listing " << (*it) << endl; entry.append(atom); - createVirtualDirEntry(entry, drivechars[*it] == 'Z'); + createVirtualDirEntry(entry, drivechars[*it] == 'Z', PLP_FTYPE_DRIVE); listEntry(entry, false); } +#if 0 + entry.clear(); + atom.m_uds = KIO::UDS_NAME; + atom.m_str = i18n("Owner"); + entry.append(atom); + createVirtualDirEntry(entry, false, PLP_FTYPE_OWNER); + listEntry(entry, false); + + entry.clear(); + atom.m_uds = KIO::UDS_NAME; + atom.m_str = i18n("Machine"); + entry.append(atom); + createVirtualDirEntry(entry, false, PLP_FTYPE_MACHINE); + listEntry(entry, false); + + entry.clear(); + atom.m_uds = KIO::UDS_NAME; + atom.m_str = i18n("Settings"); + entry.append(atom); + createVirtualDirEntry(entry, false, PLP_FTYPE_SETUP); + listEntry(entry, false); + + entry.clear(); + atom.m_uds = KIO::UDS_NAME; + atom.m_str = i18n("Backup"); + entry.append(atom); + createVirtualDirEntry(entry, false, PLP_FTYPE_BACKUP); + listEntry(entry, false); + + entry.clear(); + atom.m_uds = KIO::UDS_NAME; + atom.m_str = i18n("Restore"); + entry.append(atom); + createVirtualDirEntry(entry, false, PLP_FTYPE_RESTORE); + listEntry(entry, false); +#endif + listEntry(entry, true); finished(); return; @@ -330,7 +392,7 @@ listDir(const KURL& _url) { PlpDir files; Enum<rfsv::errs> res = plpRfsv->dir(path, files); - if (checkForError(res)) + if (checkForError(res, url.path())) return; totalSize(files.size()); UDSEntry entry; @@ -359,13 +421,9 @@ listDir(const KURL& _url) { } void PLPProtocol:: -createVirtualDirEntry(UDSEntry & entry, bool rdonly) { +createVirtualDirEntry(UDSEntry & entry, bool rdonly, int type) { UDSAtom atom; - atom.m_uds = KIO::UDS_FILE_TYPE; - atom.m_long = S_IFDIR; - entry.append(atom); - atom.m_uds = KIO::UDS_ACCESS; atom.m_long = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; if (!rdonly) @@ -376,9 +434,66 @@ createVirtualDirEntry(UDSEntry & entry, bool rdonly) { atom.m_long = 0; entry.append(atom); - //atom.m_uds = KIO::UDS_MIME_TYPE; - //atom.m_str = QString("inode/x-psion-drive"); - //entry.append(atom); + switch (type) { + case PLP_FTYPE_ROOT: + //atom.m_uds = KIO::UDS_FILE_TYPE; + //atom.m_long = S_IFBLK; + //entry.append(atom); + // atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE; + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("inode/x-psion-drive"); + entry.append(atom); + break; + case PLP_FTYPE_DRIVE: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + entry.append(atom); + atom.m_uds = KIO::UDS_GUESSED_MIME_TYPE; + // atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("inode/x-psion-drive"); + entry.append(atom); + break; + case PLP_FTYPE_OWNER: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("application/x-psion-owner"); + entry.append(atom); + break; + case PLP_FTYPE_MACHINE: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("application/x-psion-machine"); + entry.append(atom); + break; + case PLP_FTYPE_SETUP: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("application/x-psion-setup"); + entry.append(atom); + break; + case PLP_FTYPE_BACKUP: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("application/x-psion-backup"); + entry.append(atom); + break; + case PLP_FTYPE_RESTORE: + atom.m_uds = KIO::UDS_FILE_TYPE; + atom.m_long = S_IFREG; + entry.append(atom); + atom.m_uds = KIO::UDS_MIME_TYPE; + atom.m_str = QString("application/x-psion-restore"); + entry.append(atom); + break; + } } bool PLPProtocol:: @@ -386,7 +501,7 @@ emitTotalSize(QString &name) { PlpDirent e; Enum<rfsv::errs> res = plpRfsv->fgeteattr(name, e); - if (checkForError(res)) + if (checkForError(res), &name) return true; totalSize(e.getSize()); return false; @@ -405,11 +520,24 @@ stat(const KURL & url) { stripTrailingSlash(path); if (isRoot(path) || isDrive(path)) { - atom.m_uds = KIO::UDS_NAME; atom.m_str = path; entry.append(atom); - createVirtualDirEntry(entry, isRoot(path) || isRomDrive(path)); + if (isRoot(path)) + createVirtualDirEntry(entry, true, PLP_FTYPE_ROOT); + else + createVirtualDirEntry(entry, isRomDrive(path), PLP_FTYPE_DRIVE); + statEntry(entry); + finished(); + kdDebug(PLP_DEBUGAREA) << "succeeded" << endl; + return; + } + int ftype = checkSpecial(path); + if (ftype != 0) { + atom.m_uds = KIO::UDS_NAME; + atom.m_str = path; + entry.append(atom); + createVirtualDirEntry(entry, false, ftype); statEntry(entry); finished(); kdDebug(PLP_DEBUGAREA) << "succeeded" << endl; @@ -421,14 +549,14 @@ stat(const KURL & url) { convertName(path); if (path.isEmpty()) { - error(ERR_DOES_NOT_EXIST, fileName); + error(ERR_DOES_NOT_EXIST, url.path()); return; } PlpDirent e; Enum<rfsv::errs> res = plpRfsv->fgeteattr(path, e); - if (checkForError(res)) + if (checkForError(res, url.path())) return; atom.m_uds = KIO::UDS_NAME; @@ -460,13 +588,13 @@ mimetype(const KURL & url) { convertName(path); if (path.isEmpty()) { - error(ERR_DOES_NOT_EXIST, path); + error(ERR_DOES_NOT_EXIST, url.path()); return; } PlpDirent e; Enum<rfsv::errs> res = plpRfsv->fgeteattr(path, e); - if (checkForError(res)) + if (checkForError(res, url.path())) return; mimeType(uid2mime(e)); finished(); @@ -484,7 +612,10 @@ completeUDSEntry(UDSEntry& entry, PlpDirent &e, bool rom) { atom.m_long = e.getSize(); entry.append(atom); - atom.m_uds = KIO::UDS_MODIFICATION_TIME; + if (attr & rfsv::PSI_A_DIR) + atom.m_uds = KIO::UDS_CREATION_TIME; + else + atom.m_uds = KIO::UDS_MODIFICATION_TIME; atom.m_long = e.getPsiTime().getTime(); entry.append(atom); @@ -576,25 +707,34 @@ mkdir(const KURL& url, int) { return; kdDebug(PLP_DEBUGAREA) << "mkdir(" << name << ")" << endl; if (isRomDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path())); return; } if (isRoot(name) || isDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path())); return; } convertName(name); Enum<rfsv::errs> res = plpRfsv->mkdir(name); - if (checkForError(res)) + if (checkForError(res), url.path()) return; finished(); } bool PLPProtocol:: -checkForError(Enum<rfsv::errs> res) { +checkForError(Enum<rfsv::errs> res, QString n1, QString n2) { if (res != rfsv::E_PSI_GEN_NONE) { kdDebug(PLP_DEBUGAREA) << "plp error: " << res << endl; - QString text(res.toString().data()); + QString reason(res.toString().data()); + QString text; + if (!!n1 && !!n2) + text = i18n("%1 or %2: %3").arg(n1).arg(n2).arg(reason); + else { + if (!!n1 || !!n2) + text = QString("%1: %2").arg(n1 ? n1 : n2).arg(reason); + else + text = reason; + } switch (res) { case rfsv::E_PSI_FILE_ACCESS: error(ERR_ACCESS_DENIED, text); @@ -626,18 +766,18 @@ del( const KURL& url, bool isfile) { return; kdDebug(PLP_DEBUGAREA) << "del(" << name << ")" << endl; if (isRomDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path())); return; } if (isRoot(name) || isDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path())); return; } convertName(name); Enum<rfsv::errs> res = (isfile) ? plpRfsv->remove(name) : plpRfsv->rmdir(name); - if (checkForError(res)) + if (checkForError(res, url.path())) return; finished(); } @@ -651,18 +791,18 @@ chmod( const KURL& url, int permissions ) { return; kdDebug(PLP_DEBUGAREA) << "chmod(" << name << ")" << endl; if (isRomDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path())); return; } if (isRoot(name) || isDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path())); return; } convertName(name); long attr[2]; attr[0] = attr[1] = 0; Enum <rfsv::errs> res = plpRfsv->fsetattr(name, attr[0], attr[1]); - if (checkForError(res)) + if (checkForError(res, url.path())) return; finished(); } @@ -676,7 +816,7 @@ get( const KURL& url ) { return; kdDebug(PLP_DEBUGAREA) << "get(" << name << ")" << endl; if (isRoot(name) || isDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path())); return; } convertName(name); @@ -690,7 +830,7 @@ get( const KURL& url ) { if (emitTotalSize(name)) return; res = plpRfsv->fopen(plpRfsv->opMode(rfsv::PSI_O_RDONLY), name, handle); - if (checkForError(res)) + if (checkForError(res, url.path())) return; QByteArray a(RFSV_SENDLEN); @@ -705,7 +845,7 @@ get( const KURL& url ) { } } while ((len > 0) && (res == rfsv::E_PSI_GEN_NONE)); plpRfsv->fclose(handle); - if (checkForError(res)) + if (checkForError(res, url.path())) return; data(QByteArray()); @@ -722,11 +862,11 @@ put( const KURL& url, int _mode, bool _overwrite, bool /*_resume*/ ) { return; kdDebug(PLP_DEBUGAREA) << "put(" << name << ")" << endl; if (isRomDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(url.path())); return; } if (isRoot(name) || isDrive(name)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(url.path())); return; } convertName(name); @@ -738,7 +878,7 @@ put( const KURL& url, int _mode, bool _overwrite, bool /*_resume*/ ) { res = plpRfsv->fcreatefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name, handle); if ((res == rfsv::E_PSI_FILE_EXIST) && _overwrite) res = plpRfsv->freplacefile(plpRfsv->opMode(rfsv::PSI_O_RDWR), name, handle); - if (checkForError(res)) + if (checkForError(res, url.path())) return; do { @@ -753,7 +893,7 @@ put( const KURL& url, int _mode, bool _overwrite, bool /*_resume*/ ) { u_int32_t written; u_int32_t count = (len > RFSV_SENDLEN) ? RFSV_SENDLEN : len; res = plpRfsv->fwrite(handle, data, count, written); - if (checkForError(res)) { + if (checkForError(res, url.path())) { plpRfsv->fclose(handle); return; } @@ -774,28 +914,28 @@ rename(const KURL &src, const KURL &dest, bool _overwrite) { return; kdDebug(PLP_DEBUGAREA) << "rename(" << from << "," << to << ")" << endl; if ((driveChar(from) != driveChar(to)) && (driveChar(to) != '\0')) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path())); kdDebug(PLP_DEBUGAREA) << "from FS != to FS" << endl; return; } if (isRomDrive(from)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(src.path())); kdDebug(PLP_DEBUGAREA) << "from ROFS" << endl; return; } if (isRoot(from)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(src.path())); kdDebug(PLP_DEBUGAREA) << "from VFS" << endl; return; } bool volRename = isDrive(from); if (isRomDrive(to)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path())); kdDebug(PLP_DEBUGAREA) << "to ROFS" << endl; return; } if (isRoot(to)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path())); kdDebug(PLP_DEBUGAREA) << "to VFS" << endl; return; } @@ -823,7 +963,7 @@ rename(const KURL &src, const KURL &dest, bool _overwrite) { } res = plpRfsv->rename(from, to); } - if (checkForError(res)) + if (checkForError(res, src.path(), dest.path())) return; finished(); } @@ -856,16 +996,16 @@ copy( const KURL &src, const KURL &dest, int _mode, bool _overwrite ) { return; kdDebug(PLP_DEBUGAREA) << "copy(" << from << "," << to << ")" << endl; if (isRoot(from) || isDrive(from)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1 or %2: virtual directory").arg(src.path()).arg(dest.path())); return; } convertName(from); if (isRomDrive(to)) { - error(ERR_ACCESS_DENIED, i18n("read only filesystem")); + error(ERR_ACCESS_DENIED, i18n("%1: read only filesystem").arg(dest.path())); return; } if (isRoot(to) || isDrive(to)) { - error(ERR_ACCESS_DENIED, i18n("Virtual directory")); + error(ERR_ACCESS_DENIED, i18n("%1: virtual directory").arg(dest.path())); return; } convertName(to); @@ -881,7 +1021,7 @@ copy( const KURL &src, const KURL &dest, int _mode, bool _overwrite ) { return; t_last = t_start = time(0); res = plpRfsv->copyOnPsion(from, to, (void *)this, progresswrapper); - if (checkForError(res)) + if (checkForError(res, src.path(), dest.path())) return; finished(); } diff --git a/kde2/kioslave/kio_plp.h b/kde2/kioslave/kio_plp.h index 6768e10..d5841bb 100644 --- a/kde2/kioslave/kio_plp.h +++ b/kde2/kioslave/kio_plp.h @@ -60,15 +60,16 @@ private: char driveChar(const QString& path); - void createVirtualDirEntry(KIO::UDSEntry & entry, bool rdonly); + void createVirtualDirEntry(KIO::UDSEntry & entry, bool rdonly, int type); void completeUDSEntry(KIO::UDSEntry& entry, PlpDirent &e, bool rom); - bool checkForError(Enum<rfsv::errs> res); + bool checkForError(Enum<rfsv::errs> res, QString name1 = QString(0), QString name2 = QString(0)); bool isRomDrive(const QString& path); bool isDrive(const QString& path); bool isRoot(const QString& path); void convertName(QString &path); bool emitTotalSize(QString &name); QString uid2mime(PlpDirent &e); + int checkSpecial(const QString& path); rfsv *plpRfsv; ppsocket *plpRfsvSocket; diff --git a/kde2/kioslave/psion.protocol b/kde2/kioslave/psion.protocol index 6e14b80..c77c486 100644 --- a/kde2/kioslave/psion.protocol +++ b/kde2/kioslave/psion.protocol @@ -3,6 +3,7 @@ exec=kio_plp protocol=psion input=none output=filesystem +defaultMimetype=inode/directory listing=Name,Type,Size,Date,Access reading=true writing=true diff --git a/kde2/mime/Makefile.am b/kde2/mime/Makefile.am index 4f52cb1..deb4518 100644 --- a/kde2/mime/Makefile.am +++ b/kde2/mime/Makefile.am @@ -8,6 +8,9 @@ EXTRA_DIST = $(wildcard *.desktop) maintainer-clean-local: rm -f Makefile.in +actionsdir = $(kde_datadir)/konqueror/servicemenus +actions_DATA = psion-drive-actions.desktop + devmimedir = $(kde_mimedir)/inode devmime_DATA = x-psion-drive.desktop @@ -24,4 +27,9 @@ appmime_DATA = \ x-psion-record2.desktop \ x-psion-sheet.desktop \ x-psion-sketch.desktop \ - x-psion-word.desktop + x-psion-word.desktop \ + x-psion-owner.desktop \ + x-psion-machine.desktop \ + x-psion-setup.desktop \ + x-psion-backup.desktop \ + x-psion-restore.desktop diff --git a/kde2/mime/icons/lo32-app-psion_owner.png b/kde2/mime/icons/lo32-app-psion_owner.png Binary files differnew file mode 100644 index 0000000..515b105 --- /dev/null +++ b/kde2/mime/icons/lo32-app-psion_owner.png diff --git a/kde2/mime/x-psion-drive.desktop b/kde2/mime/x-psion-drive.desktop index d3b350c..845f439 100644 --- a/kde2/mime/x-psion-drive.desktop +++ b/kde2/mime/x-psion-drive.desktop @@ -4,4 +4,3 @@ Comment[de]=Psion Laufwerk Icon=psion_drive Type=MimeType MimeType=inode/x-psion-drive -Patterns= diff --git a/kde2/plugins/plpprops.cc b/kde2/plugins/plpprops.cc index bd4a2f5..1992e33 100644 --- a/kde2/plugins/plpprops.cc +++ b/kde2/plugins/plpprops.cc @@ -237,61 +237,61 @@ PlpDriveAttrPage::PlpDriveAttrPage(KPropertiesDialog *_props) QBoxLayout *box = new QVBoxLayout( d->m_frame, KDialog::spacingHint() ); QLabel *l; QGridLayout *gl; + usedColor = QColor(219, 58, 197); + freeColor = QColor(39, 56, 167); KIO_ARGS << int(1) << properties->item()->name(); KIO::StatJob *job = new KIO::StatJob(KURL("psion:/"), KIO::CMD_SPECIAL, packedArgs, false); connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotSpecialFinished(KIO::Job *))); - - long total = 33267; - long free = 12345; - gb = new QGroupBox(i18n("Information"), d->m_frame); box->addWidget(gb); gl = new QGridLayout(gb, 7, 4, 15); gl->addRowSpacing(0, 10); - l = new QLabel(i18n("Type"), gb); + l = new QLabel(i18n("Type"), gb, "typeLabel"); gl->addWidget(l, 1, 0); typeLabel = new QLabel(gb); gl->addWidget(typeLabel, 2, 0); - l = new QLabel(i18n("Total capacity"), gb); + l = new QLabel(i18n("Total capacity"), gb, "capacityLabel"); gl->addWidget (l, 1, 1); - totalLabel = new QLabel(gb); + totalLabel = new QLabel(i18n(" "), gb, "capacityValue"); gl->addWidget(totalLabel, 2, 1); - l = new QLabel(i18n("Free space"), gb); + l = new QLabel(i18n("Free space"), gb, "spaceLabel"); gl->addWidget (l, 1, 2); - freeLabel = new QLabel(gb); + freeLabel = new QLabel(i18n(" "), gb, "spaceValue"); gl->addWidget(freeLabel, 2, 2); - l = new QLabel(i18n("Unique ID"), gb); + l = new QLabel(i18n("Unique ID"), gb, "uidLabel"); gl->addWidget (l, 1, 3); - uidLabel = new QLabel(gb); + uidLabel = new QLabel(i18n(" "), gb, "uidValue"); gl->addWidget(uidLabel, 2, 3); pie = new Pie3DWidget(gb, "pie"); gl->addMultiCellWidget(pie, 3, 4, 1, 2); - l = new QLabel(i18n("Used space"), gb); + l = new QLabel(i18n("Used space:"), gb, "usedLgend"); + l->setAlignment(AlignRight | AlignVCenter); gl->addWidget (l, 5, 2); - l = new QLabel(i18n(" "), gb); - l->setBackgroundColor(QColor(219, 58, 197)); + l = new QLabel(i18n(" "), gb, "usedLegendColor"); + l->setBackgroundColor(usedColor); gl->addWidget (l, 5, 3); - l = new QLabel(i18n("Free space"), gb); + l = new QLabel(i18n("Free space:"), gb, "spaceLegend"); + l->setAlignment(AlignRight | AlignVCenter); gl->addWidget (l, 6, 2); - l = new QLabel(i18n(" "), gb); - l->setBackgroundColor(QColor(39, 56, 167)); + l = new QLabel(i18n(" "), gb, "spaceLegendColor"); + l->setBackgroundColor(freeColor); gl->addWidget (l, 6, 3); @@ -351,8 +351,8 @@ void PlpDriveAttrPage::slotSpecialFinished(KIO::Job *job) { if (total_found && free_found) { totalLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(total)).arg(KGlobal::locale()->formatNumber(total, 0))); freeLabel->setText(QString::fromLatin1("%1 (%2)").arg(KIO::convertSize(unused)).arg(KGlobal::locale()->formatNumber(unused, 0))); - pie->addPiece(total - unused, QColor(219, 58, 197)); - pie->addPiece(unused, QColor(39, 56, 167)); + pie->addPiece(total - unused, usedColor); + pie->addPiece(unused, freeColor); } } } diff --git a/kde2/plugins/plpprops.h b/kde2/plugins/plpprops.h index 86f3514..eeb3d4d 100644 --- a/kde2/plugins/plpprops.h +++ b/kde2/plugins/plpprops.h @@ -95,6 +95,8 @@ class PlpDriveAttrPage : public KPropsDlgPlugin { QLabel *typeLabel; QLabel *totalLabel; QLabel *freeLabel; + QColor usedColor; + QColor freeColor; Pie3DWidget *pie; }; |