From kde-core-devel Sun Oct 10 19:05:36 2004 From: Martin Koller Date: Sun, 10 Oct 2004 19:05:36 +0000 To: kde-core-devel Subject: [patch] enhanced file properties dialog Message-Id: <200410102105.42624.m.koller () surfeu ! at> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=109743897507031 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart1577818.5yYX145LTY" --nextPart1577818.5yYX145LTY Content-Type: multipart/mixed; boundary="Boundary-01=_CgYaBcDSL1cNiiV" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_CgYaBcDSL1cNiiV Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all, I've seen that the current file/directory properties dialog shows also the= =20 disk free/usage from the file system on which the given file is on. The problem I see here is, that usability wise this information should not = be=20 intermixed with the properties belonging to the file itself. Currently it is between the size of the file and the modification time. The attached patch fixes this by placing this information below the file-ti= me=20 stamps (delimited by a separator). In addition I show a graphical representation of the disk usage (progressba= r). OK to commit ? =2D-=20 Best regards/Sch=F6ne Gr=FC=DFe Martin () ascii ribbon campaign - against html mail=20 /\ - against microsoft attachments Some operating systems are called 'user friendly', Linux however is 'expert friendly'. --Boundary-01=_CgYaBcDSL1cNiiV Content-Type: text/x-diff; charset="us-ascii"; name="props.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="props.patch" Index: kpropertiesdialog.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/kio/kfile/kpropertiesdialog.cpp,v retrieving revision 1.321 diff -u -3 -p -r1.321 kpropertiesdialog.cpp =2D-- kpropertiesdialog.cpp 4 Oct 2004 22:17:19 -0000 1.321 +++ kpropertiesdialog.cpp 10 Oct 2004 18:56:58 -0000 @@ -66,6 +66,7 @@ extern "C" { #include #include #include +#include =20 #include #include @@ -597,6 +598,8 @@ public: { dirSizeJob =3D 0L; dirSizeUpdateTimer =3D 0L; + m_freeSpaceLabel =3D 0; + m_freeSpaceBar =3D 0; m_lined =3D 0; } ~KFilePropsPluginPrivate() @@ -613,6 +616,7 @@ public: bool bKDesktopMode; bool bDesktopFile; QLabel *m_freeSpaceLabel; + QProgressBar *m_freeSpaceBar; QString mimeType; QString oldFileName; KLineEdit* m_lined; @@ -916,33 +920,6 @@ KFilePropsPlugin::KFilePropsPlugin( KPro m_sizeStopButton->setEnabled( false ); } =20 =2D if ( isLocal ) =2D { =2D QString mountPoint =3D KIO::findPathMountPoint( properties->item()= =2D>url().path() ); =2D =2D if (mountPoint !=3D "/") =2D { =2D l =3D new QLabel(i18n("Mounted on:"), d->m_frame ); =2D grid->addWidget(l, curRow, 0); =2D =2D l =3D new KSqueezedTextLabel( mountPoint, d->m_frame ); =2D grid->addWidget( l, curRow++, 2 ); =2D } =2D =2D l =3D new QLabel(i18n("Free disk space:"), d->m_frame ); =2D grid->addWidget(l, curRow, 0); =2D =2D d->m_freeSpaceLabel =3D new QLabel( d->m_frame ); =2D grid->addWidget( d->m_freeSpaceLabel, curRow++, 2 ); =2D =2D KDiskFreeSp * job =3D new KDiskFreeSp; =2D connect( job, SIGNAL( foundMountPoint( const unsigned long&, const= unsigned long&, =2D const unsigned long&, const QString& ) ), =2D this, SLOT( slotFoundMountPoint( const unsigned long&, co= nst unsigned long&, =2D const unsigned long&, const QString& ) ) ); =2D job->readDF( mountPoint ); =2D } =2D if (!d->bMultiple && item->isLink()) { l =3D new QLabel(i18n("Points to:"), d->m_frame ); grid->addWidget(l, curRow, 0); @@ -953,8 +930,6 @@ KFilePropsPlugin::KFilePropsPlugin( KPro =20 if (!d->bMultiple) // Dates for multiple don't make much sense... { =2D sep =3D new KSeparator( KSeparator::HLine, d->m_frame); =2D grid->addMultiCellWidget(sep, curRow, curRow, 0, 2); ++curRow; =20 QDateTime dt; @@ -991,6 +966,42 @@ KFilePropsPlugin::KFilePropsPlugin( KPro grid->addWidget(l, curRow++, 2); } } + + if ( isLocal ) + { + sep =3D new KSeparator( KSeparator::HLine, d->m_frame); + grid->addMultiCellWidget(sep, curRow, curRow, 0, 2); + + curRow++; + + QString mountPoint =3D KIO::findPathMountPoint( properties->item()->ur= l().path() ); + + if (mountPoint !=3D "/") + { + l =3D new QLabel(i18n("Mounted on:"), d->m_frame ); + grid->addWidget(l, curRow, 0); + + l =3D new KSqueezedTextLabel( mountPoint, d->m_frame ); + grid->addWidget( l, curRow++, 2 ); + } + + l =3D new QLabel(i18n("Free disk space:"), d->m_frame ); + grid->addWidget(l, curRow, 0); + + d->m_freeSpaceLabel =3D new QLabel( d->m_frame ); + grid->addWidget( d->m_freeSpaceLabel, curRow++, 2 ); + + d->m_freeSpaceBar =3D new QProgressBar( d->m_frame ); + grid->addMultiCellWidget(d->m_freeSpaceBar, curRow, curRow, 0, 2); + + KDiskFreeSp * job =3D new KDiskFreeSp; + connect( job, SIGNAL( foundMountPoint( const unsigned long&, const uns= igned long&, + const unsigned long&, const QSt= ring& ) ), + this, SLOT( slotFoundMountPoint( const unsigned long&, const = unsigned long&, + const unsigned long&, const = QString& ) ) ); + job->readDF( mountPoint ); + } + vbl->addStretch(1); } =20 @@ -1069,11 +1080,15 @@ void KFilePropsPlugin::slotFoundMountPoi unsigned long /*kBUsed*/, unsigned long kBAvail ) { + int percUsed =3D 100 - (int)(100.0 * kBAvail / kBSize); + d->m_freeSpaceLabel->setText( i18n("Available space out of total partition size (percent used)", "%1 ou= t of %2 (%3% used)") .arg(KIO::convertSizeFromKB(kBAvail)) .arg(KIO::convertSizeFromKB(kBSize)) =2D .arg( 100 - (int)(100.0 * kBAvail / kBSize) )); + .arg(percUsed)); + + d->m_freeSpaceBar->setProgress(percUsed, 100); } =20 // attention: copy&paste below, due to compiler bug @@ -1083,11 +1098,15 @@ void KFilePropsPlugin::slotFoundMountPoi const unsigned long& kBAvail, const QString& ) { + int percUsed =3D 100 - (int)(100.0 * kBAvail / kBSize); + d->m_freeSpaceLabel->setText( i18n("Available space out of total partition size (percent used)", "%1 ou= t of %2 (%3% used)") .arg(KIO::convertSizeFromKB(kBAvail)) .arg(KIO::convertSizeFromKB(kBSize)) .arg( 100 - (int)(100.0 * kBAvail / kBSize) )); + + d->m_freeSpaceBar->setProgress(percUsed, 100); } =20 void KFilePropsPlugin::slotDirSizeUpdate() --Boundary-01=_CgYaBcDSL1cNiiV-- --nextPart1577818.5yYX145LTY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBaYgGUeHBRvgua64RAqf5AJ406c+TWUKk7bv4QGcxbUTKFGKVQgCfRD/4 2pcSFZOtCJp59Xpfbdiv1ZE= =ypsM -----END PGP SIGNATURE----- --nextPart1577818.5yYX145LTY--