From 2bda8f7717adf28da4af0d34fb82f63d2868c31d Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdf/Makefile.am | 37 +++ kdf/disklist.cpp | 506 +++++++++++++++++++++++++++++ kdf/disklist.h | 138 ++++++++ kdf/disks.cpp | 335 ++++++++++++++++++++ kdf/disks.h | 148 +++++++++ kdf/kcmdf.cpp | 66 ++++ kdf/kcmdf.desktop | 138 ++++++++ kdf/kcmdf.h | 49 +++ kdf/kconftest.cpp | 80 +++++ kdf/kdf.cpp | 96 ++++++ kdf/kdf.desktop | 88 +++++ kdf/kdf.h | 45 +++ kdf/kdfconfig.cpp | 263 +++++++++++++++ kdf/kdfconfig.h | 97 ++++++ kdf/kdfui.rc | 11 + kdf/kdfwidget.cpp | 652 ++++++++++++++++++++++++++++++++++++++ kdf/kdfwidget.h | 153 +++++++++ kdf/kwikdisk.cpp | 346 ++++++++++++++++++++ kdf/kwikdisk.desktop | 78 +++++ kdf/kwikdisk.h | 78 +++++ kdf/listview.cpp | 113 +++++++ kdf/listview.h | 53 ++++ kdf/mntconfig.cpp | 364 +++++++++++++++++++++ kdf/mntconfig.h | 102 ++++++ kdf/optiondialog.cpp | 85 +++++ kdf/optiondialog.h | 50 +++ kdf/pics/Makefile.am | 4 + kdf/pics/cr16-app-kcmdf.png | Bin 0 -> 924 bytes kdf/pics/cr22-app-kcmdf.png | Bin 0 -> 1152 bytes kdf/pics/cr32-app-kcmdf.png | Bin 0 -> 1771 bytes kdf/pics/delete.png | Bin 0 -> 963 bytes kdf/pics/hi128-app-kdf.png | Bin 0 -> 10332 bytes kdf/pics/hi128-app-kwikdisk.png | Bin 0 -> 11838 bytes kdf/pics/hi16-app-kdf.png | Bin 0 -> 924 bytes kdf/pics/hi16-app-kwikdisk.png | Bin 0 -> 818 bytes kdf/pics/hi22-app-kdf.png | Bin 0 -> 1152 bytes kdf/pics/hi22-app-kwikdisk.png | Bin 0 -> 1229 bytes kdf/pics/hi32-app-kdf.png | Bin 0 -> 1771 bytes kdf/pics/hi32-app-kwikdisk.png | Bin 0 -> 2079 bytes kdf/pics/hi48-app-kdf.png | Bin 0 -> 2851 bytes kdf/pics/hi48-app-kwikdisk.png | Bin 0 -> 3510 bytes kdf/pics/hi64-app-kdf.png | Bin 0 -> 3801 bytes kdf/pics/hi64-app-kwikdisk.png | Bin 0 -> 5185 bytes kdf/pics/mini-root.png | Bin 0 -> 785 bytes kdf/pics/tick.png | Bin 0 -> 661 bytes kdf/stdoption.cpp | 148 +++++++++ kdf/stdoption.h | 72 +++++ kdf/unix_outputs/df-g.hpux | 392 +++++++++++++++++++++++ kdf/unix_outputs/df-k.digital | 42 +++ kdf/unix_outputs/df-k.hpux | 196 ++++++++++++ kdf/unix_outputs/df.man.hpux | 198 ++++++++++++ kdf/unix_outputs/etcfstab.digital | 43 +++ kdf/unix_outputs/etcfstab.hpux | 75 +++++ kdf/unix_outputs/unix-defines.txt | 125 ++++++++ 54 files changed, 5466 insertions(+) create mode 100644 kdf/Makefile.am create mode 100644 kdf/disklist.cpp create mode 100644 kdf/disklist.h create mode 100644 kdf/disks.cpp create mode 100644 kdf/disks.h create mode 100644 kdf/kcmdf.cpp create mode 100644 kdf/kcmdf.desktop create mode 100644 kdf/kcmdf.h create mode 100644 kdf/kconftest.cpp create mode 100644 kdf/kdf.cpp create mode 100644 kdf/kdf.desktop create mode 100644 kdf/kdf.h create mode 100644 kdf/kdfconfig.cpp create mode 100644 kdf/kdfconfig.h create mode 100644 kdf/kdfui.rc create mode 100644 kdf/kdfwidget.cpp create mode 100644 kdf/kdfwidget.h create mode 100644 kdf/kwikdisk.cpp create mode 100644 kdf/kwikdisk.desktop create mode 100644 kdf/kwikdisk.h create mode 100644 kdf/listview.cpp create mode 100644 kdf/listview.h create mode 100644 kdf/mntconfig.cpp create mode 100644 kdf/mntconfig.h create mode 100644 kdf/optiondialog.cpp create mode 100644 kdf/optiondialog.h create mode 100644 kdf/pics/Makefile.am create mode 100644 kdf/pics/cr16-app-kcmdf.png create mode 100644 kdf/pics/cr22-app-kcmdf.png create mode 100644 kdf/pics/cr32-app-kcmdf.png create mode 100644 kdf/pics/delete.png create mode 100644 kdf/pics/hi128-app-kdf.png create mode 100644 kdf/pics/hi128-app-kwikdisk.png create mode 100644 kdf/pics/hi16-app-kdf.png create mode 100644 kdf/pics/hi16-app-kwikdisk.png create mode 100644 kdf/pics/hi22-app-kdf.png create mode 100644 kdf/pics/hi22-app-kwikdisk.png create mode 100644 kdf/pics/hi32-app-kdf.png create mode 100644 kdf/pics/hi32-app-kwikdisk.png create mode 100644 kdf/pics/hi48-app-kdf.png create mode 100644 kdf/pics/hi48-app-kwikdisk.png create mode 100644 kdf/pics/hi64-app-kdf.png create mode 100644 kdf/pics/hi64-app-kwikdisk.png create mode 100644 kdf/pics/mini-root.png create mode 100644 kdf/pics/tick.png create mode 100644 kdf/stdoption.cpp create mode 100644 kdf/stdoption.h create mode 100644 kdf/unix_outputs/df-g.hpux create mode 100644 kdf/unix_outputs/df-k.digital create mode 100644 kdf/unix_outputs/df-k.hpux create mode 100644 kdf/unix_outputs/df.man.hpux create mode 100644 kdf/unix_outputs/etcfstab.digital create mode 100644 kdf/unix_outputs/etcfstab.hpux create mode 100644 kdf/unix_outputs/unix-defines.txt (limited to 'kdf') diff --git a/kdf/Makefile.am b/kdf/Makefile.am new file mode 100644 index 0000000..b9a81ad --- /dev/null +++ b/kdf/Makefile.am @@ -0,0 +1,37 @@ +SUBDIRS = pics + +INCLUDES= $(all_includes) + +bin_PROGRAMS = kdf kwikdisk + +noinst_LTLIBRARIES = libkdf_common.la +libkdf_common_la_SOURCES = kdfwidget.cpp kdfconfig.cpp mntconfig.cpp disklist.cpp \ + disks.cpp listview.cpp optiondialog.cpp stdoption.cpp + +kdf_SOURCES = kdf.cpp +kdf_LDFLAGS = $(all_libraries) $(KDE_RPATH) +kdf_LDADD = libkdf_common.la $(LIB_KFILE) + +kwikdisk_SOURCES = kwikdisk.cpp +kwikdisk_LDFLAGS = $(all_libraries) $(KDE_RPATH) +kwikdisk_LDADD = libkdf_common.la $(LIB_KFILE) + +kde_module_LTLIBRARIES = kcm_kdf.la + +kcm_kdf_la_SOURCES = kcmdf.cpp +kcm_kdf_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_kdf_la_LIBADD = libkdf_common.la $(LIB_KFILE) + +noinst_HEADERS = kdfwidget.h kcmdf.h kdfconfig.h mntconfig.h \ +disks.h kdf.h disklist.h kwikdisk.h listview.h optiondialog.h stdoption.h + +METASOURCES = AUTO + +xdg_apps_DATA = kdf.desktop kwikdisk.desktop kcmdf.desktop + +rc_DATA = kdfui.rc + +rcdir = $(kde_datadir)/kdf + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kdf.pot diff --git a/kdf/disklist.cpp b/kdf/disklist.cpp new file mode 100644 index 0000000..b2718ac --- /dev/null +++ b/kdf/disklist.cpp @@ -0,0 +1,506 @@ +/* + * disklist.cpp + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +#include +#include +#include +#include + +#include "disklist.h" + +#define BLANK ' ' +#define DELIMITER '#' +#define FULL_PERCENT 95.0 + +/*************************************************************************** + * constructor +**/ +DiskList::DiskList(QObject *parent, const char *name) + : QObject(parent,name) +{ + kdDebug() << k_funcinfo << endl; + + updatesDisabled = false; + + if (NO_FS_TYPE) { + kdDebug() << "df gives no FS_TYPE" << endl; + } + + disks = new Disks; + disks->setAutoDelete(TRUE); + + // BackgroundProcesses **************************************** + dfProc = new KProcess(); Q_CHECK_PTR(dfProc); + connect( dfProc, SIGNAL(receivedStdout(KProcess *, char *, int) ), + this, SLOT (receivedDFStdErrOut(KProcess *, char *, int)) ); + connect(dfProc,SIGNAL(processExited(KProcess *) ), + this, SLOT(dfDone() ) ); + + readingDFStdErrOut=FALSE; + config = kapp->config(); + loadSettings(); +} + + +/*************************************************************************** + * destructor +**/ +DiskList::~DiskList() +{ + kdDebug() << k_funcinfo << endl; +} + +/** +Updated need to be disabled sometimes to avoid pulling the DiskEntry out from the popupmenu handler +*/ +void DiskList::setUpdatesDisabled(bool disable) +{ + updatesDisabled = disable; +} + +/*************************************************************************** + * saves the KConfig for special mount/umount scripts +**/ +void DiskList::applySettings() +{ + kdDebug() << k_funcinfo << endl; + + QString oldgroup=config->group(); + config->setGroup("DiskList"); + QString key; + DiskEntry *disk; + for (disk=disks->first();disk!=0;disk=disks->next()) { + key.sprintf("Mount%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + config->writePathEntry(key,disk->mountCommand()); + + key.sprintf("Umount%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + config->writePathEntry(key,disk->umountCommand()); + + key.sprintf("Icon%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + config->writePathEntry(key,disk->realIconName()); + } + config->sync(); + config->setGroup(oldgroup); +} + + +/*************************************************************************** + * reads the KConfig for special mount/umount scripts +**/ +void DiskList::loadSettings() +{ + kdDebug() << k_funcinfo << endl; + + config->setGroup("DiskList"); + QString key; + DiskEntry *disk; + for (disk=disks->first();disk!=0;disk=disks->next()) { + key.sprintf("Mount%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + disk->setMountCommand(config->readPathEntry(key)); + + key.sprintf("Umount%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + disk->setUmountCommand(config->readPathEntry(key)); + + key.sprintf("Icon%s%s%s%s",SEPARATOR,disk->deviceName().latin1() + ,SEPARATOR,disk->mountPoint().latin1()); + QString icon=config->readPathEntry(key); + if (!icon.isEmpty()) disk->setIconName(icon); + } +} + + +static QString expandEscapes(const QString& s) { +QString rc; + for (unsigned int i = 0; i < s.length(); i++) { + if (s[i] == '\\') { + i++; + switch(s[i]) { + case '\\': // backslash '\' + rc += '\\'; + break; + case '0': // octal 0nn + rc += static_cast(s.mid(i,3).toInt(0, 8)); + i += 2; + break; + default: + // give up and not process anything else because I'm too lazy + // to implement other escapes + rc += '\\'; + rc += s[i]; + break; + } + } else { + rc += s[i]; + } + } +return rc; +} + +/*************************************************************************** + * tries to figure out the possibly mounted fs +**/ +int DiskList::readFSTAB() +{ + kdDebug() << k_funcinfo << endl; + + if (readingDFStdErrOut || dfProc->isRunning()) return -1; + +QFile f(FSTAB); + if ( f.open(IO_ReadOnly) ) { + QTextStream t (&f); + QString s; + DiskEntry *disk; + + //disks->clear(); // ############ + + while (! t.eof()) { + s=t.readLine(); + s=s.simplifyWhiteSpace(); + if ( (!s.isEmpty() ) && (s.find(DELIMITER)!=0) ) { + // not empty or commented out by '#' + // kdDebug() << "GOT: [" << s << "]" << endl; + disk = new DiskEntry();// Q_CHECK_PTR(disk); + disk->setMounted(FALSE); + disk->setDeviceName(expandEscapes(s.left(s.find(BLANK)))); + s=s.remove(0,s.find(BLANK)+1 ); + // kdDebug() << " deviceName: [" << disk->deviceName() << "]" << endl; +#ifdef _OS_SOLARIS_ + //device to fsck + s=s.remove(0,s.find(BLANK)+1 ); +#endif + disk->setMountPoint(expandEscapes(s.left(s.find(BLANK)))); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " MountPoint: [" << disk->mountPoint() << "]" << endl; + //kdDebug() << " Icon: [" << disk->iconName() << "]" << endl; + disk->setFsType(s.left(s.find(BLANK)) ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " FS-Type: [" << disk->fsType() << "]" << endl; + disk->setMountOptions(s.left(s.find(BLANK)) ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " Mount-Options: [" << disk->mountOptions() << "]" << endl; + if ( (disk->deviceName() != "none") + && (disk->fsType() != "swap") + && (disk->fsType() != "sysfs") + && (disk->mountPoint() != "/dev/swap") + && (disk->mountPoint() != "/dev/pts") + && (disk->mountPoint() != "/dev/shm") + && (disk->mountPoint().find("/proc") == -1 ) ) + replaceDeviceEntry(disk); + else + delete disk; + + } //if not empty + } //while + f.close(); + } //if f.open + + loadSettings(); //to get the mountCommands + + // kdDebug() << "DiskList::readFSTAB DONE" << endl; + return 1; +} + + +/*************************************************************************** + * is called, when the df-command writes on StdOut or StdErr +**/ +void DiskList::receivedDFStdErrOut(KProcess *, char *data, int len ) +{ + kdDebug() << k_funcinfo << endl; + + + /* ATTENTION: StdERR no longer connected to this... + * Do we really need StdErr?? on HP-UX there was eg. a line + * df: /home_tu1/ijzerman/floppy: Stale NFS file handle + * but this shouldn't cause a real problem + */ + + + QString tmp = QString::fromLatin1(data, len); + dfStringErrOut.append(tmp); +} + +/*************************************************************************** + * reads the df-commands results +**/ +int DiskList::readDF() +{ + kdDebug() << k_funcinfo << endl; + + if (readingDFStdErrOut || dfProc->isRunning()) return -1; + setenv("LANG", "en_US", 1); + setenv("LC_ALL", "en_US", 1); + setenv("LC_MESSAGES", "en_US", 1); + setenv("LC_TYPE", "en_US", 1); + setenv("LANGUAGE", "en_US", 1); + dfStringErrOut=""; // yet no data received + dfProc->clearArguments(); + (*dfProc) << "env" << "LC_ALL=POSIX" << DF_COMMAND << DF_ARGS; + if (!dfProc->start( KProcess::NotifyOnExit, KProcess::AllOutput )) + qFatal(i18n("could not execute [%s]").local8Bit().data(), DF_COMMAND); + return 1; +} + + +/*************************************************************************** + * is called, when the df-command has finished +**/ +void DiskList::dfDone() +{ + kdDebug() << k_funcinfo << endl; + + if (updatesDisabled) + return; //Don't touch the data for now.. + + readingDFStdErrOut=TRUE; + for ( DiskEntry *disk=disks->first(); disk != 0; disk=disks->next() ) + disk->setMounted(FALSE); // set all devs unmounted + + QTextStream t (dfStringErrOut, IO_ReadOnly); + QString s=t.readLine(); + if ( ( s.isEmpty() ) || ( s.left(10) != "Filesystem" ) ) + qFatal("Error running df command... got [%s]",s.latin1()); + while ( !t.atEnd() ) { + QString u,v; + DiskEntry *disk; + s=t.readLine(); + s=s.simplifyWhiteSpace(); + if ( !s.isEmpty() ) { + disk = new DiskEntry(); Q_CHECK_PTR(disk); + + if (s.find(BLANK)<0) // devicename was too long, rest in next line + if ( !t.eof() ) { // just appends the next line + v=t.readLine(); + s=s.append(v.latin1() ); + s=s.simplifyWhiteSpace(); + //kdDebug() << "SPECIAL GOT: [" << s << "]" << endl; + }//if silly linefeed + + //kdDebug() << "EFFECTIVELY GOT " << s.length() << " chars: [" << s << "]" << endl; + + disk->setDeviceName(s.left(s.find(BLANK)) ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " DeviceName: [" << disk->deviceName() << "]" << endl; + + if (NO_FS_TYPE) { + //kdDebug() << "THERE IS NO FS_TYPE_FIELD!" << endl; + disk->setFsType("?"); + } else { + disk->setFsType(s.left(s.find(BLANK)) ); + s=s.remove(0,s.find(BLANK)+1 ); + }; + //kdDebug() << " FS-Type: [" << disk->fsType() << "]" << endl; + //kdDebug() << " Icon: [" << disk->iconName() << "]" << endl; + + u=s.left(s.find(BLANK)); + disk->setKBSize(u.toInt() ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " Size: [" << disk->kBSize() << "]" << endl; + + u=s.left(s.find(BLANK)); + disk->setKBUsed(u.toInt() ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " Used: [" << disk->kBUsed() << "]" << endl; + + u=s.left(s.find(BLANK)); + disk->setKBAvail(u.toInt() ); + s=s.remove(0,s.find(BLANK)+1 ); + //kdDebug() << " Avail: [" << disk->kBAvail() << "]" << endl; + + + s=s.remove(0,s.find(BLANK)+1 ); // delete the capacity 94% + disk->setMountPoint(s); + //kdDebug() << " MountPoint: [" << disk->mountPoint() << "]" << endl; + + if ( (disk->kBSize() > 0) + && (disk->deviceName() != "none") + && (disk->fsType() != "swap") + && (disk->fsType() != "sysfs") + && (disk->mountPoint() != "/dev/swap") + && (disk->mountPoint() != "/dev/pts") + && (disk->mountPoint() != "/dev/shm") + && (disk->mountPoint().find("/proc") == -1 ) ) { + disk->setMounted(TRUE); // its now mounted (df lists only mounted) + replaceDeviceEntry(disk); + } else + delete disk; + + }//if not header + }//while further lines available + + readingDFStdErrOut=FALSE; + loadSettings(); //to get the mountCommands + emit readDFDone(); +} + + +void DiskList::deleteAllMountedAt(const QString &mountpoint) +{ + kdDebug() << k_funcinfo << endl; + + + for ( DiskEntry *item = disks->first(); item; ) + { + if (item->mountPoint() == mountpoint ) { + kdDebug() << "delete " << item->deviceName() << endl; + disks->remove(item); + item = disks->current(); + } else + item = disks->next(); + } +} + +/*************************************************************************** + * updates or creates a new DiskEntry in the KDFList and TabListBox +**/ +void DiskList::replaceDeviceEntry(DiskEntry *disk) +{ + //kdDebug() << k_funcinfo << disk->deviceRealName() << " " << disk->realMountPoint() << endl; + + // + // The 'disks' may already already contain the 'disk'. If it do + // we will replace some data. Otherwise 'disk' will be added to the list + // + + // + // 1999-27-11 Espen Sand: + // I can't get find() to work. The Disks::compareItems(..) is + // never called. + // + //int pos=disks->find(disk); + + QString deviceRealName = disk->deviceRealName(); + QString realMountPoint = disk->realMountPoint(); + + int pos = -1; + for( u_int i=0; icount(); i++ ) + { + DiskEntry *item = disks->at(i); + int res = deviceRealName.compare( item->deviceRealName() ); + if( res == 0 ) + { + res = realMountPoint.compare( item->realMountPoint() ); + } + if( res == 0 ) + { + pos = i; + break; + } + } + + if ((pos == -1) && (disk->mounted()) ) + // no matching entry found for mounted disk + if ((disk->fsType() == "?") || (disk->fsType() == "cachefs")) { + //search for fitting cachefs-entry in static /etc/vfstab-data + DiskEntry* olddisk = disks->first(); + while (olddisk != 0) { + int p; + // cachefs deviceNames have no / behind the host-column + // eg. /cache/cache/.cfs_mnt_points/srv:_home_jesus + // ^ ^ + QString odiskName = olddisk->deviceName(); + int ci=odiskName.find(':'); // goto host-column + while ((ci =odiskName.find('/',ci)) > 0) { + odiskName.replace(ci,1,"_"); + }//while + // check if there is something that is exactly the tail + // eg. [srv:/tmp3] is exact tail of [/cache/.cfs_mnt_points/srv:_tmp3] + if ( ( (p=disk->deviceName().findRev(odiskName + ,disk->deviceName().length()) ) + != -1) + && (p + odiskName.length() + == disk->deviceName().length()) ) + { + pos = disks->at(); //store the actual position + disk->setDeviceName(olddisk->deviceName()); + olddisk=0; + } else + olddisk=disks->next(); + }// while + }// if fsType == "?" or "cachefs" + + +#ifdef NO_FS_TYPE + if (pos != -1) { + DiskEntry * olddisk = disks->at(pos); + if (olddisk) + disk->setFsType(olddisk->fsType()); + } +#endif + + if (pos != -1) { // replace + DiskEntry * olddisk = disks->at(pos); + if ( (-1!=olddisk->mountOptions().find("user")) && + (-1==disk->mountOptions().find("user")) ) { + // add "user" option to new diskEntry + QString s=disk->mountOptions(); + if (s.length()>0) s.append(","); + s.append("user"); + disk->setMountOptions(s); + } + disk->setMountCommand(olddisk->mountCommand()); + disk->setUmountCommand(olddisk->umountCommand()); + + // Same device name, but maybe one is a symlink and the other is its target + // Keep the shorter one then, /dev/hda1 looks better than /dev/ide/host0/bus0/target0/lun0/part1 + if ( disk->deviceName().length() > olddisk->deviceName().length() ) + disk->setDeviceName(olddisk->deviceName()); + + //FStab after an older DF ... needed for critFull + //so the DF-KBUsed survive a FStab lookup... + //but also an unmounted disk may then have a kbused set... + if ( (olddisk->mounted()) && (!disk->mounted()) ) { + disk->setKBSize(olddisk->kBSize()); + disk->setKBUsed(olddisk->kBUsed()); + disk->setKBAvail(olddisk->kBAvail()); + } + if ( (olddisk->percentFull() != -1) && + (olddisk->percentFull() < FULL_PERCENT) && + (disk->percentFull() >= FULL_PERCENT) ) { + kdDebug() << "Device " << disk->deviceName() + << " is critFull! " << olddisk->percentFull() + << "--" << disk->percentFull() << endl; + emit criticallyFull(disk); + } + disks->remove(pos); // really deletes old one + disks->insert(pos,disk); + } else { + disks->append(disk); + }//if + +} + +#include "disklist.moc" + + + + + + diff --git a/kdf/disklist.h b/kdf/disklist.h new file mode 100644 index 0000000..7a99841 --- /dev/null +++ b/kdf/disklist.h @@ -0,0 +1,138 @@ +/* + * disklist.h + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __DISKLIST_H__ +#define __DISKLIST_H__ + +#include +#include +#include +//#include + +// defines the os-type +#include + +#include "disks.h" + +#define DF_COMMAND "df" +// be pessimistic: df -T only works under linux !?? +#if defined(_OS_LINUX_) +#define DF_ARGS "-kT" +#define NO_FS_TYPE false +#else +#define DF_ARGS "-k" +#define NO_FS_TYPE true +#endif + +#ifdef _OS_SOLARIS_ +#define CACHEFSTAB "/etc/cachefstab" +#define FSTAB "/etc/vfstab" +#else +#define FSTAB "/etc/fstab" +#endif + +#define SEPARATOR "|" + +/***************************************************************************/ +typedef QPtrList DisksBase; +typedef QPtrListIterator DisksIterator; + +/***************************************************************************/ +class Disks : public DisksBase +{ + public: + Disks(bool deepCopies=TRUE) { dc = deepCopies;} + ~Disks() { clear(); } +private: + int compareItems( DiskEntry s1, DiskEntry s2 ) + { + int ret = s1.deviceName().compare(s2.deviceName()); + if( ret == 0 ) + { + ret = s1.mountPoint().compare(s2.mountPoint()); + } + + kdDebug() << "compareDISKS " << s1.deviceName() << " vs " << s2.deviceName() << " (" << ret << ")" << endl; + return( ret ); + } + + /* + int compareItems( DiskEntry* s1, DiskEntry* s2 ) { + int ret; + ret = strcmp (static_cast(s1)->deviceName(), + static_cast(s2)->deviceName() ); + if (0 == ret) + ret = strcmp (static_cast(s1)->mountPoint(), + static_cast(s2)->mountPoint()); + return ret; + }; + */ + + bool dc; +}; + +/***************************************************************************/ +class DiskList : public QObject +{ Q_OBJECT +public: + DiskList( QObject *parent=0, const char *name=0 ); + ~DiskList(); + int readFSTAB(); + int readDF(); + int find(const DiskEntry* disk) {return disks->find(disk);} + DiskEntry* at(uint index) {return disks->at(index);} + DiskEntry* first() {return disks->first();} + DiskEntry* next() {return disks->next();} + uint count() { return disks->count(); } + + void deleteAllMountedAt(const QString &mountpoint); + void setUpdatesDisabled(bool disable); + +signals: + void readDFDone(); + void criticallyFull(DiskEntry *disk); + +public slots: + void loadSettings(); + void applySettings(); + +private slots: + void receivedDFStdErrOut(KProcess *, char *data, int len); + void dfDone(); + +private: + void replaceDeviceEntry(DiskEntry *disk); + + Disks *disks; + KProcess *dfProc; + QString dfStringErrOut; + bool readingDFStdErrOut; + KConfig *config; + bool updatesDisabled; + +}; +/***************************************************************************/ + + +#endif diff --git a/kdf/disks.cpp b/kdf/disks.cpp new file mode 100644 index 0000000..c1a4a0e --- /dev/null +++ b/kdf/disks.cpp @@ -0,0 +1,335 @@ +/* + * disks.cpp + * + * Copyright (c) 1998 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include + +#include +#include + +#include "disks.h" +#include "disks.moc" + +/****************************************************/ +/********************* DiskEntry ********************/ +/****************************************************/ + +/** + * Constructor +**/ +void DiskEntry::init() +{ + device=""; + type=""; + mountedOn=""; + options=""; + size=0; + used=0; + avail=0; + isMounted=FALSE; + mntcmd=""; + umntcmd=""; + iconSetByUser=FALSE; + icoName=""; + + + // BackgroundProcesses **************************************** + + sysProc = new KShellProcess(); Q_CHECK_PTR(sysProc); + connect( sysProc, SIGNAL(receivedStdout(KProcess *, char *, int) ), + this, SLOT (receivedSysStdErrOut(KProcess *, char *, int)) ); + connect( sysProc, SIGNAL(receivedStderr(KProcess *, char *, int) ), + this, SLOT (receivedSysStdErrOut(KProcess *, char *, int)) ); + readingSysStdErrOut=FALSE; + + +} + +DiskEntry::DiskEntry(QObject *parent, const char *name) + : QObject (parent, name) +{ + init(); +} + +DiskEntry::DiskEntry(const QString & deviceName, QObject *parent, const char *name) + : QObject (parent, name) +{ + init(); + + setDeviceName(deviceName); +} +DiskEntry::~DiskEntry() +{ + disconnect(this); + delete sysProc; +} + +int DiskEntry::toggleMount() +{ + if (!mounted()) + return mount(); + else + return umount(); +} + +int DiskEntry::mount() +{ + QString cmdS=mntcmd; + if (cmdS.isEmpty()) // generate default mount cmd + if (getuid()!=0 ) // user mountable + { + cmdS="mount %d"; + } + else // root mounts with all params/options + { + // FreeBSD's mount(8) is picky: -o _must_ go before + // the device and mountpoint. + cmdS=QString::fromLatin1("mount -t%t -o%o %d %m"); + } + + cmdS.replace(QString::fromLatin1("%d"),deviceName()); + cmdS.replace(QString::fromLatin1("%m"),mountPoint()); + cmdS.replace(QString::fromLatin1("%t"),fsType()); + cmdS.replace(QString::fromLatin1("%o"),mountOptions()); + + kdDebug() << "mount-cmd: [" << cmdS << "]" << endl; + int e=sysCall(cmdS); + if (!e) setMounted(TRUE); + kdDebug() << "mount-cmd: e=" << e << endl; + return e; +} + +int DiskEntry::umount() +{ + kdDebug() << "umounting" << endl; + QString cmdS=umntcmd; + if (cmdS.isEmpty()) // generate default umount cmd + cmdS="umount %d"; + + cmdS.replace(QString::fromLatin1("%d"),deviceName()); + cmdS.replace(QString::fromLatin1("%m"),mountPoint()); + + kdDebug() << "umount-cmd: [" << cmdS << "]" << endl; + int e=sysCall(cmdS); + if (!e) setMounted(FALSE); + kdDebug() << "umount-cmd: e=" << e << endl; + + return e; +} + +int DiskEntry::remount() +{ + if (mntcmd.isEmpty() && umntcmd.isEmpty() // default mount/umount commands + && (getuid()==0)) // you are root + { + QString oldOpt=options; + if (options.isEmpty()) + options="remount"; + else + options+=",remount"; + int e=mount(); + options=oldOpt; + return e; + } else { + if (int e=umount()) + return mount(); + else return e; + } +} + +void DiskEntry::setMountCommand(const QString & mnt) +{ + mntcmd=mnt; +} + +void DiskEntry::setUmountCommand(const QString & umnt) +{ + umntcmd=umnt; +} + +void DiskEntry::setIconName(const QString & iconName) +{ + iconSetByUser=TRUE; + icoName=iconName; + if (icoName.right(6) == "_mount") + icoName.truncate(icoName.length()-6); + else if (icoName.right(8) == "_unmount") + icoName.truncate(icoName.length()-8); + + emit iconNameChanged(); +} + +QString DiskEntry::iconName() +{ + QString iconName=icoName; + if (iconSetByUser) { + mounted() ? iconName+="_mount" : iconName+="_unmount"; + return iconName; + } else + return guessIconName(); +} + +QString DiskEntry::guessIconName() +{ + QString iconName; + // try to be intelligent + if (-1!=mountPoint().find("cdrom",0,FALSE)) iconName+="cdrom"; + else if (-1!=deviceName().find("cdrom",0,FALSE)) iconName+="cdrom"; + else if (-1!=mountPoint().find("writer",0,FALSE)) iconName+="cdwriter"; + else if (-1!=deviceName().find("writer",0,FALSE)) iconName+="cdwriter"; + else if (-1!=mountPoint().find("mo",0,FALSE)) iconName+="mo"; + else if (-1!=deviceName().find("mo",0,FALSE)) iconName+="mo"; + else if (-1!=deviceName().find("fd",0,FALSE)) { + if (-1!=deviceName().find("360",0,FALSE)) iconName+="5floppy"; + if (-1!=deviceName().find("1200",0,FALSE)) iconName+="5floppy"; + else iconName+="3floppy"; + } + else if (-1!=mountPoint().find("floppy",0,FALSE)) iconName+="3floppy"; + else if (-1!=mountPoint().find("zip",0,FALSE)) iconName+="zip"; + else if (-1!=fsType().find("nfs",0,FALSE)) iconName+="nfs"; + else iconName+="hdd"; + mounted() ? iconName+="_mount" : iconName+="_unmount"; +// if ( -1==mountOptions().find("user",0,FALSE) ) +// iconName.prepend("root_"); // special root icon, normal user cant mount + + //debug("device %s is %s",deviceName().latin1(),iconName.latin1()); + + //emit iconNameChanged(); + return iconName; +} + + +/*************************************************************************** + * starts a command on the underlying system via /bin/sh +**/ +int DiskEntry::sysCall(const QString & command) +{ + if (readingSysStdErrOut || sysProc->isRunning() ) return -1; + + sysStringErrOut=i18n("Called: %1\n\n").arg(command); // put the called command on ErrOut + sysProc->clearArguments(); + (*sysProc) << command; + if (!sysProc->start( KProcess::Block, KProcess::AllOutput )) + kdFatal() << i18n("could not execute %1").arg(command.local8Bit().data()) << endl; + + if (sysProc->exitStatus()!=0) emit sysCallError(this, sysProc->exitStatus()); + + return (sysProc->exitStatus()); +} + + +/*************************************************************************** + * is called, when the Sys-command writes on StdOut or StdErr +**/ +void DiskEntry::receivedSysStdErrOut(KProcess *, char *data, int len) +{ + QString tmp = QString::fromLocal8Bit(data, len); + sysStringErrOut.append(tmp); +} + +float DiskEntry::percentFull() const +{ + if (size != 0) { + return 100 - ( ((float)avail / (float)size) * 100 ); + } else { + return -1; + } +} + +void DiskEntry::setDeviceName(const QString & deviceName) +{ + device=deviceName; + emit deviceNameChanged(); +} + +QString DiskEntry::deviceRealName() const +{ + QFileInfo inf( device ); + QDir dir( inf.dirPath( true ) ); + QString relPath = inf.fileName(); + if ( inf.isSymLink() ) { + QString link = inf.readLink(); + if ( link.startsWith( "/" ) ) + return link; + relPath = link; + } + return dir.canonicalPath() + "/" + relPath; +} + +void DiskEntry::setMountPoint(const QString & mountPoint) +{ + mountedOn=mountPoint; + emit mountPointChanged(); +} + +QString DiskEntry::realMountPoint() const +{ + QDir dir( mountedOn ); + return dir.canonicalPath(); +} + +void DiskEntry::setMountOptions(const QString & mountOptions) +{ + options=mountOptions; + emit mountOptionsChanged(); +} + +void DiskEntry::setFsType(const QString & fsType) +{ + type=fsType; + emit fsTypeChanged(); +} + +void DiskEntry::setMounted(bool nowMounted) +{ + isMounted=nowMounted; + emit mountedChanged(); +} + +void DiskEntry::setKBSize(int kb_size) +{ + size=kb_size; + emit kBSizeChanged(); +} + +void DiskEntry::setKBUsed(int kb_used) +{ + used=kb_used; + if ( size < (used+avail) ) { //adjust kBAvail + kdWarning() << "device " << device << ": kBAvail(" << avail << ")+*kBUsed(" << used << ") exceeds kBSize(" << size << ")" << endl; + setKBAvail(size-used); + } + emit kBUsedChanged(); +} + +void DiskEntry::setKBAvail(int kb_avail) +{ + avail=kb_avail; + if ( size < (used+avail) ) { //adjust kBUsed + kdWarning() << "device " << device << ": *kBAvail(" << avail << ")+kBUsed(" << used << ") exceeds kBSize(" << size << ")" << endl; + setKBUsed(size-avail); + } + emit kBAvailChanged(); +} + + diff --git a/kdf/disks.h b/kdf/disks.h new file mode 100644 index 0000000..9899927 --- /dev/null +++ b/kdf/disks.h @@ -0,0 +1,148 @@ +/* + * disks.h + * + * Copyright (c) 1998 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __DISKS_H__ +#define __DISKS_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class DiskEntry : public QObject +{ + Q_OBJECT +public: + DiskEntry(QObject *parent=0, const char *name=0); + DiskEntry(const QString & deviceName, QObject *parent=0, const char *name=0); + ~DiskEntry(); + QString lastSysError() {return sysStringErrOut; } + QString deviceName() const { return device; } + // The real device (in case deviceName() is a symlink) + QString deviceRealName() const; + QString mountPoint() const { return mountedOn; } + QString mountOptions() const { return options; } + // The real device (in case deviceName() is a symlink) + QString realMountPoint() const; + /** + * sets the used mountCommand for the actual DiskEntry. + * @param mntcmd is a string containing the executable file and + * special codes which will be filled in when used:
+ * %m : mountpoint
+ * %d : deviceName
+ * %t : filesystem type
+ * %o : mount options
+ * all this information is gained from the objects' data + * if no mountCommand is set it defaults to "mount %d" + **/ + QString mountCommand() const { return mntcmd; } + /** + * sets the used umountCommand for the actual DiskEntry. + * @param mntcmd is a string containing the executable file and + * special codes which will be filled in when used:
+ * %m : mountpoint
+ * %d : deviceName
+ * all this information is gained from the objects' data + * if no umountCommand is set it defaults to "umount %d" + **/ + QString umountCommand() const { return umntcmd; } + QString fsType() const { return type; } + bool mounted() const { return isMounted; } + int kBSize() const { return size; } + QString iconName(); + QString realIconName() { return icoName; } + QString prettyKBSize() const { return KIO::convertSizeFromKB(size); } + int kBUsed() const { return used; } + QString prettyKBUsed() const { return KIO::convertSizeFromKB(used); } + int kBAvail() const { return avail; } + QString prettyKBAvail() const { return KIO::convertSizeFromKB(avail); } + float percentFull() const; + +signals: + void sysCallError(DiskEntry *disk, int err_no); + void deviceNameChanged(); + void mountPointChanged(); + void mountOptionsChanged(); + void fsTypeChanged(); + void mountedChanged(); + void kBSizeChanged(); + void kBUsedChanged(); + void kBAvailChanged(); + void iconNameChanged(); + +public slots: + + int toggleMount(); + int mount(); + int umount(); + int remount(); + void setMountCommand(const QString & mnt); + void setUmountCommand(const QString & umnt); + void setDeviceName(const QString & deviceName); + void setMountPoint(const QString & mountPoint); + void setIconName(const QString & iconName); + void setMountOptions(const QString & mountOptions); + void setFsType(const QString & fsType); + void setMounted(bool nowMounted); + void setKBSize(int kb_size); + void setKBUsed(int kb_used); + void setKBAvail(int kb_avail); + QString guessIconName(); + +private slots: + void receivedSysStdErrOut(KProcess *, char *data, int len); + +private: + void init(); + int sysCall(const QString & command); + QString prettyPrint(int kBValue) const; + + KShellProcess *sysProc; + QString sysStringErrOut; + bool readingSysStdErrOut; + + QString device, + type, + mountedOn, + options, + icoName, + mntcmd, + umntcmd; + + int size, + used, + avail; // ATTENTION: used+avail != size (clustersize!) + + bool isMounted, + iconSetByUser; +}; + +#endif diff --git a/kdf/kcmdf.cpp b/kdf/kcmdf.cpp new file mode 100644 index 0000000..3c30a01 --- /dev/null +++ b/kdf/kcmdf.cpp @@ -0,0 +1,66 @@ +/* + kcmdf.cpp - KcmDiskFree + + Copyright (C) 1998 by Michael Kropfberger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + */ + +// +// 1999-12-05 Espen Sand +// Modified to use KCModule instead of the old and obsolete +// KControlApplication +// + + +#include + +#include + +#include "kcmdf.h" + +KDiskFreeWidget::KDiskFreeWidget( QWidget *parent, const char *name ) + : KCModule( parent, name ) +{ + setButtons(Help); + + QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); + + mKdf = new KDFWidget( this, "kdf", false ); + topLayout->addWidget( mKdf ); +} + +KDiskFreeWidget::~KDiskFreeWidget() +{ + mKdf->applySettings(); +} + +QString KDiskFreeWidget::quickHelp() const +{ + return i18n("

Hardware Information


All the information modules return information" + " about a certain aspect of your computer hardware or your operating system." + " Not all modules are available on all hardware architectures and/or operating systems."); +} + +extern "C" +{ + KDE_EXPORT KCModule* create_kdf( QWidget *parent, const char * /*name*/ ) + { + return new KDiskFreeWidget( parent , "kdf" ); + } +} + +#include "kcmdf.moc" diff --git a/kdf/kcmdf.desktop b/kdf/kcmdf.desktop new file mode 100644 index 0000000..3513576 --- /dev/null +++ b/kdf/kcmdf.desktop @@ -0,0 +1,138 @@ +[Desktop Entry] +X-KDE-ModuleType=Library +X-KDE-Library=kdf +X-KDE-FactoryName=kdf +X-KDE-LocalUser=false +Exec=kcmshell kcmdf +Icon=kcmdf +Type=Application +Name=Storage Devices +Name[af]=Stoorplek Toestelle +Name[ar]=أجهزة تخزين +Name[bg]=Твърди дискове +Name[bs]=Uređaji za smještaj +Name[ca]=Dispositius d'emmagatzemament +Name[cs]=Úložná zařízení +Name[cy]=Dyfeisiau Storio +Name[da]=Opbevaringsenheder +Name[de]=Speichergeräte +Name[el]=Συσκευές αποθήκευσης +Name[eo]=Memor-aparatoj +Name[es]=Dispositivos de almacenamiento +Name[et]=Salvestusseadmed +Name[eu]=Biltegiratze Gailuak +Name[fa]=دستگاههای ذخیره +Name[fi]=Tallennuslaitteet +Name[fr]=Périphériques de stockage +Name[ga]=Gléasanna Stórais +Name[gl]=Dispositivos de Almaceamento +Name[he]=התקני איחסון +Name[hi]=भंडारण औज़ार +Name[hr]=Skladišni uređaji +Name[hu]=Tárolóeszközök +Name[is]=Minnisbúnaður +Name[it]=Dispositivi di memorizzazione +Name[ja]=ストレージデバイス +Name[ka]=ინფორმაციის შემნახველი მოწყობილობები +Name[kk]=Жинақтаушы құрылғылар +Name[km]=ឧបករណ៍​ផ្ទុក +Name[lt]=Saugojimo įrenginiai +Name[mk]=Уреди за складирање +Name[mt]=Apparat għas-sarr ta' informazzjoni +Name[nb]=Lagringsenheter +Name[nds]=Spiekerreedschappen +Name[ne]=यन्त्र भण्डारण गर्नुहोस् +Name[nl]=Opslagapparaten +Name[nn]=Lagringseiningar +Name[pa]=ਸਟੋਰੇਜ਼ ਜੰਤਰ +Name[pl]=Urządzenia do przechowywania danych +Name[pt]=Dispositivos de Armazenamento +Name[pt_BR]=Dispositivos de Armazenamento +Name[ro]=Dispozitive de stocare +Name[ru]=Устройства хранения данных +Name[sk]=Disky +Name[sl]=Naprave za shranjevanje +Name[sr]=Складишни уређаји +Name[sr@Latn]=Skladišni uređaji +Name[sv]=Lagringsenheter +Name[ta]= சேமிப்பு சாதனங்கள் +Name[tg]=Дастгоҳҳои Захиракунӣ +Name[th]=อุปกรณ์เก็บข้อมูล +Name[tr]=Depolama Aygıtları +Name[uk]=Пристрої накопичення +Name[uz]=Saqlash uskunalari +Name[uz@cyrillic]=Сақлаш ускуналари +Name[wa]=Éndjins di wårdaedje +Name[xh]=Amacebo Okugcina +Name[zh_CN]=存储设备 +Name[zh_TW]=儲存裝置 +Name[zu]=Amathuluzi Ethala +DocPath=kinfocenter/blockdevices/index.html +Comment=Shows the disk usage of the mounted devices +Comment[af]=Vertoon die disket gebruik van die gekoppelde toestelle +Comment[ar]=يعرض المساحة المستخدمة من الأقراص المضمومة +Comment[az]=Bağlı avadanlıqların disk istifadəsini göstərir +Comment[bg]=Информация за използваното пространство на монтираните устройства +Comment[br]=Diskouez an egor implijet gant an trobarzhelloù marc'het +Comment[bs]=Prikazuje iskorištenost diskova na montiranim uređajima +Comment[ca]=Mostra l'ús de disc dels dispositius muntats +Comment[cs]=Zobrazuje využití připojených diskových zařízení +Comment[cy]=Dangos defnydd disg y dyfeisiau mowntiedig +Comment[da]=Viser monterede enheders diskforbrug +Comment[de]=Zeigt die Speicherbelegung eingebundener Geräte +Comment[el]=Εμφανίζει τη χρήση αποθηκευτικού χώρου των προσαρτημένων συσκευών +Comment[eo]=Montras la kapacitojn de la kroĉitaj aparatoj +Comment[es]=Muestra el uso del disco en los dispositivos montados +Comment[et]=Ühendatud seadmete kettakasutuse vaatamine +Comment[eu]=Muntatutako diskoen erabilera erakusten du +Comment[fa]=استفادۀ دیسک دستگاههای سوار‌شده را نمایش می‌دهد +Comment[fi]=Näyttää levynkäytön liitetyillä laitteilla +Comment[fr]=Affiche l'espace utilisé sur les périphériques montés +Comment[ga]=Taispeánann úsáid diosca na ngléasanna feistithe +Comment[gl]=Amosa o uso do disco dos dispositivos montados +Comment[he]=מידע על השימוש בנפח האיחסון של ההתקנים המחוברים +Comment[hi]=माउन्टेड औज़ारों के डिस्क उपयोग दिखाता है +Comment[hr]=Prikazuje iskorištenost diskova +Comment[hu]=Megmutatja a csatlakoztatott (mountolt) eszközök kihasználtságát +Comment[id]=Perlihatkan penggunanan disk yang sedang dimount +Comment[is]=Sýnir nýtingu diskanna sem eru tengdir skráarkerfinu +Comment[it]=Mostra l'uso del disco dei dispositivi montati +Comment[ja]=マウントされているデバイスのディスク使用状況を表示 +Comment[ka]=მონტირებული დისკების გამოყენებას +Comment[kk]=Тіркеген құрылғыларда бар орынды көрсетеді +Comment[km]=បង្ហាញ​ការប្រើប្រាស់​ថាស​របស់​ឧបករណ៍​ដែល​បាន​ម៉ោន +Comment[ko]=마운트된 장치의 디스크 사용을 보여줍니다. +Comment[lt]=Rodo sumontuotų įrenginių disko vietos panaudojimą +Comment[lv]=Rāda piemontēto iekārtu diska izlietošanu +Comment[mk]=Ја покажува искористеноста на монтираните уреди +Comment[ms]=Memaparkan penggunaan cakera pada peranti yang dilekapkan +Comment[mt]=Juri kemm qed jintuża mid-diski mmuntati +Comment[nb]=Viser brukt diskplass på de monterte enhetene +Comment[nds]=Wiest den Fastplattbruuk vun inhangt Reedschappen +Comment[ne]=माउन्ट गरिएको यन्त्रका डिस्क उपयोग देखाउँदछ +Comment[nl]=Toont het schijfgebruik van de aangekoppelde bestandssystemen +Comment[nn]=Viser diskbruken for monterte einingar +Comment[pa]=ਮਾਊਟ ਕੀਤੇ ਜੰਤਰ ਵੇਖਾਉਦਾ ਹੈ +Comment[pl]=Pokazuje wykorzystanie przestrzeni dyskowej na zamontowanych urządzeniach +Comment[pt]=Mostra o espaço ocupado nos dispositivos montados +Comment[pt_BR]=Mostra a utilização do disco nos dispositivos montados +Comment[ro]=Afişează utilizarea spaţiului pentru dispozitivele montate +Comment[ru]=Показывает свободное место на смонтированных устройствах +Comment[sk]=Ukazuje využité miesto na pripojených diskových zariadeniach +Comment[sl]=Prikaže porabo diska v priklopljenih napravah +Comment[sr]=Приказује искоришћеност капацитета монтираних дискова +Comment[sr@Latn]=Prikazuje iskorišćenost kapaciteta montiranih diskova +Comment[sv]=Visar diskanvändning för monterade enheter +Comment[ta]= ஏற்றப்பட்ட சாதனங்களின் வட்டு பயன்பாட்டை காட்டுகிறது +Comment[tg]=Фазоҳои хомро дар дастгоҳи насбшуда нишон диҳед +Comment[th]=แสดงการใช้พื้นทีี่ของดิสก์ที่เมานท์ใช้งานอยู่ +Comment[tr]=Bağlı aygıtların disk kullanımını gösterir +Comment[uk]=Показує ступінь використання змонтованих пристроїв +Comment[ven]=I sumbedza mashumisele a maano o gonyiswaho +Comment[vi]=Hiển thềEtrạng thái sử dụng đĩa của các thiết bềEđã được mount +Comment[wa]=Mostere l' eployaedje des deurès plakes ki sont montêyes +Comment[zh_CN]=显示挂接设备的磁盘使用率 +Comment[zh_TW]=顯示連接的設備的磁碟使用率 +Comment[zu]=Ikhombisa ukusebenziswa kwediski yamathuluzi okunyuka + +Categories=Qt;KDE;X-KDE-information; diff --git a/kdf/kcmdf.h b/kdf/kcmdf.h new file mode 100644 index 0000000..c3e2b58 --- /dev/null +++ b/kdf/kcmdf.h @@ -0,0 +1,49 @@ +/* + kcmdf.h - KDiskFree + + Copyright (C) 1999 by Michael Kropfberger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + */ + + +#ifndef __KCMDF_H__ +#define __KCMDF_H__ + +#include "kdfwidget.h" +#include "kdfconfig.h" +#include "mntconfig.h" + +#include +#include + +class KDiskFreeWidget : public KCModule +{ + Q_OBJECT + + public: + KDiskFreeWidget( QWidget *parent=0, const char *name=0 ); + ~KDiskFreeWidget(); + + QString quickHelp() const; + + private: + KDFWidget *mKdf; + KDFConfigWidget *mMcw; + MntConfigWidget *mKcw; +}; + +#endif diff --git a/kdf/kconftest.cpp b/kdf/kconftest.cpp new file mode 100644 index 0000000..75d13fd --- /dev/null +++ b/kdf/kconftest.cpp @@ -0,0 +1,80 @@ +/* +** +** Copyright (C) 1999 by Michael Kropfberger +** +*/ + +/* +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to kde-devel@kde.org +*/ + + +/* compile with +* gcc -I$QTDIR/include -I$KDEDIR/include -L/opt/kde/lib -L/usr/X11R6/lib -lkfm -lkdeui -lkdecore -lqt -lX11 -lXext -fno-rtti kconftest.cpp +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("A test application"); + +static const char version[] = "v0.0.1"; + +main(int argc, char ** argv) +{ + KCmdLineArgs::init(argc, argv, "test", description, version); + + KApplication app; + KConfig * cfg = kapp->config(); + + QDict dict; + + dict.insert("Blah", "Arse"); + dict.insert("Blah", "Smack"); + dict.insert("Blah", "Monkey"); + + QDictIterator it(dict); + + QString key = "TestConfigItem"; + + for (; it.current(); ++it) { + + cerr << "Before saving: " << endl; + cerr << "key : \"" << key << "\"" << endl; + cerr << "val : \"" << it.current() << "\"" << endl; + + debug("got back [%s]",cfg->writeEntry(key, it.current())); +// debug("got back [%s]",s.data()); + + cerr << "After saving: " << endl; + cerr << "key : \"" << key << "\"" << endl; + cerr << "val : \"" << it.current() << "\"" << endl; + + cerr << endl; + } +} diff --git a/kdf/kdf.cpp b/kdf/kdf.cpp new file mode 100644 index 0000000..f48cf48 --- /dev/null +++ b/kdf/kdf.cpp @@ -0,0 +1,96 @@ +/* + * kdf.cpp - KDiskFree + * + * written 1998-2001 by Michael Kropfberger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "kdf.h" +#include + +static const char description[] = + I18N_NOOP("KDE free disk space utility"); + +static const char version[] = "v0.5"; + + +/***************************************************************/ +KDFTopLevel::KDFTopLevel(QWidget *, const char *name) + : KMainWindow(0, name) +{ + kdf = new KDFWidget(this,"kdf",FALSE); + Q_CHECK_PTR(kdf); + (void) new KAction( i18n( "&Update" ), 0, kdf, SLOT( updateDF() ), actionCollection(), "updatedf" ); + + KStdAction::quit(this, SLOT(close()), actionCollection()); + KStdAction::preferences(kdf, SLOT(settingsBtnClicked()), actionCollection()); + KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), +actionCollection()); + setCentralWidget(kdf); + // kdf->setMinimumSize(kdf->sizeHint()); + kdf->resize(kdf->sizeHint()); + setupGUI(KMainWindow::Keys | StatusBar | Save | Create); +} + + +bool KDFTopLevel::queryExit( void ) +{ + kdf->applySettings(); + return( true ); +} + + +/***************************************************************/ +int main(int argc, char **argv) +{ + KAboutData aboutData( "kdf", I18N_NOOP("KDiskFree"), + version, description, KAboutData::License_GPL, + "(c) 1998-2001, Michael Kropfberger"); + aboutData.addAuthor("Michael Kropfberger",0, "michael.kropfberger@gmx.net"); + KCmdLineArgs::init( argc, argv, &aboutData ); + + KApplication app; + + if( app.isRestored() ) //SessionManagement + { + for( int n=1; KDFTopLevel::canBeRestored(n); n++ ) + { + KDFTopLevel *ktl = new KDFTopLevel(); + Q_CHECK_PTR(ktl); + app.setMainWidget(ktl); + ktl->restore(n); + } + } + else + { + KDFTopLevel *ktl = new KDFTopLevel(); + Q_CHECK_PTR(ktl); + ktl->show(); + } + + return app.exec(); +} + +#include "kdf.moc" + diff --git a/kdf/kdf.desktop b/kdf/kdf.desktop new file mode 100644 index 0000000..89eb513 --- /dev/null +++ b/kdf/kdf.desktop @@ -0,0 +1,88 @@ +[Desktop Entry] +Name=KDiskFree +Name[af]=Kdiskfree +Name[eo]=Diskuzo +Name[hi]=के-डिस्क-फ्री +Name[lv]=KDiskāBrīvs +Name[ne]=केडीई डिस्क खाली +Name[pa]=ਕੇਡਿਸਕ ਥਾਂ +Name[pl]=Wolna przestrzeń na dyskach +Name[pt_BR]=Disco Livre +Name[sl]=Prosti disk +Name[sv]=Kdiskfree +Name[ta]= கேடிஸ்க் இல்வசம் +Name[tg]=KДиски Озод +Name[th]=การใช้พื้นที่ดิสก์ +Name[tr]=K Disk Boşluğu +Name[ven]=KDisiki ya mahala +Name[zh_TW]=磁碟剩餘空間 +Exec=kdf -caption "%c" +Icon=kdf +Type=Application +GenericName=View Disk Usage +GenericName[af]=Besigtig Disket Gebruik +GenericName[ar]=عرض المستخدم من القرص +GenericName[bg]=Свободно място на диска +GenericName[bs]=Pregled iskorištenosti diska +GenericName[ca]=Veure l'ús de disc +GenericName[cs]=Zobrazení využití disku +GenericName[cy]=Gweld Defnydd y Disg +GenericName[da]=Se diskforbrug +GenericName[de]=Festplattenbelegung etc. anzeigen +GenericName[el]=Προβολή χρήσης του δίσκου +GenericName[eo]=Montras la okupitan kaj liberan spacon sur la diskoj +GenericName[es]=Muestra el uso del disco +GenericName[et]=Kettakasutus +GenericName[eu]=Erakutsi Diskoaren Erabilera +GenericName[fa]=مشاهدۀ کاربرد دیسک +GenericName[fi]=Näytä levynkäyttö +GenericName[fr]=Affiche l'utilisation de l'espace disque +GenericName[ga]=Taispeáin úsáid diosca +GenericName[he]=הצגת שיעור השימוש בדיסקים +GenericName[hi]=डिस्क उपयोग देखें +GenericName[hr]=Prikazuje iskorištenost diska +GenericName[hu]=Lemezterület-kijelző +GenericName[is]=Skoða nýtni á diskum +GenericName[it]=Mostra lo spazio disco libero +GenericName[ja]=ディスク使用状況を表示 +GenericName[ka]=იხილეთ დისკის გამოყენება +GenericName[kk]=Дискідегі орынды көрсету +GenericName[km]=មើល​ការប្រើប្រាស់​ថាស +GenericName[lt]=Žiūrėti disko panaudojimą +GenericName[lv]=Skatīt Diska Izmantošanu +GenericName[mk]=Видете ја искористеноста на дискот +GenericName[ms]=Lihat Penggunaan Cakera +GenericName[mt]=Uri l-użu tad-diski +GenericName[nb]=Vis diskplass +GenericName[nds]=Fastplattbruuk wiesen +GenericName[ne]=डिस्क उपयोग हेर्नुहोस् +GenericName[nl]=Schijfgebruik bekijken +GenericName[nn]=Vis diskbruk +GenericName[pa]=ਡਿਸਕ ਦੀ ਵਰਤੀ ਥਾਂ ਵੇਖੋ +GenericName[pl]=Informacja o wolnym miejscu na dyskach +GenericName[pt]=Utilização do Disco +GenericName[pt_BR]=Ver Uso do Disco +GenericName[ro]=Afişează utilizarea discului +GenericName[ru]=Использование дисков +GenericName[sk]=Využitie disku +GenericName[sl]=Pokaže porabo diska +GenericName[sr]=Приказ искоришћености дискова +GenericName[sr@Latn]=Prikaz iskorišćenosti diskova +GenericName[sv]=Visa diskanvändning +GenericName[ta]=வட்டு பயன்பாட்டை பார்க்கவும் +GenericName[tg]=Назари Истифодабарии Диск +GenericName[th]=แสดงการใช้พื้นที่ดิสก์ +GenericName[tr]=Disk Kullanımını Görüntüle +GenericName[uk]=Перегляд використання диску +GenericName[ven]=Sedzani mashumisele a Disk +GenericName[vi]=Xem đĩa trống +GenericName[wa]=Vey l' eployaedje del deure plake +GenericName[xh]=Jonga Ukusebenziseka KweDiskic +GenericName[zh_CN]=查看磁盘使用状况 +GenericName[zh_TW]=檢視磁碟使用情形 +GenericName[zu]= Buka Ukusetshenziswa Kwediski +Terminal=false +DocPath=kdf/index.html +X-KDE-StartupNotify=true +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;System;X-KDE-More; diff --git a/kdf/kdf.h b/kdf/kdf.h new file mode 100644 index 0000000..9cae3c7 --- /dev/null +++ b/kdf/kdf.h @@ -0,0 +1,45 @@ +/* + kdf.h - KDiskFree + + Copyright (C) 1998 by Michael Kropfberger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + */ + +#ifndef __KDF_H__ +#define __KDF_H__ + +#include +#include + +#include "kdfwidget.h" + +/***************************************************************/ +class KDFTopLevel : public KMainWindow +{ + Q_OBJECT + + public: + KDFTopLevel(QWidget *parent=0, const char *name=0); + ~KDFTopLevel() { }; + + protected slots: + virtual bool queryExit( void ); + protected: + KDFWidget* kdf; +}; + +#endif diff --git a/kdf/kdfconfig.cpp b/kdf/kdfconfig.cpp new file mode 100644 index 0000000..499e2e3 --- /dev/null +++ b/kdf/kdfconfig.cpp @@ -0,0 +1,263 @@ +/* + * kdfconfig.cpp + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +// +// 1999-11-29 Espen Sand +// Converted to QLayout and QListView + cleanups +// + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "listview.h" +#include "kdfconfig.h" + +#ifndef GUI_DEFINED +static bool GUI; +#define GUI_DEFINED +#endif + + +KDFConfigWidget::KDFConfigWidget(QWidget *parent, const char *name, bool init) + : QWidget( parent, name) +{ + + mTabName.resize(8); + mTabName[0] = new CTabName( "Icon", i18n("Icon") ); + mTabName[1] = new CTabName( "Device", i18n("Device") ); + mTabName[2] = new CTabName( "Type", i18n("Type") ); + mTabName[3] = new CTabName( "Size", i18n("Size") ); + mTabName[4] = new CTabName( "MountPoint", i18n("Mount Point") ); + mTabName[5] = new CTabName( "Free", i18n("Free") ); + // xgettext:no-c-format + mTabName[6] = new CTabName( "Full%", i18n("Full %") ); + mTabName[7] = new CTabName( "UsageBar", i18n("Usage") ); + + GUI = !init; + if(GUI) + { + QString text; + QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint()); + + mList = new CListView( this, "list", 1 ); + mList->setAllColumnsShowFocus(true); + mList->setFrameStyle( QFrame::WinPanel + QFrame::Sunken ); + mList->header()->setMovingEnabled(false); + for( uint i=0; i < mTabName.size(); i++ ) + { + mList->addColumn( mTabName[i]->mName ); + } + connect( mList, SIGNAL(clicked(QListViewItem *, const QPoint &, int)), + this, SLOT(toggleListText(QListViewItem *,const QPoint &,int))); + connect( mList, SIGNAL(clicked(QListViewItem *, const QPoint &, int)), + this, SLOT(slotChanged())); + topLayout->addWidget( mList ); + + QListViewItem *mListItem = new QListViewItem( mList ); + for( uint i=mList->header()->count(); i>0; i-- ) + { + mListItem->setText(i-1, i18n("visible") ); + mListItem->setPixmap( i-1, UserIcon ( "tick" ) ); + } + mList->setSelected( mListItem, true ); + + QGridLayout *gl = new QGridLayout( 2, 2 ); + topLayout->addLayout( gl ); + gl->setColStretch( 1, 10 ); + + mScroll = new QScrollBar( this ); + Q_CHECK_PTR(mScroll); + mScroll->setOrientation( QScrollBar::Horizontal ); + mScroll->setSteps(1,20); + mScroll->setRange(0, 180 ); + gl->addWidget( mScroll, 1, 1 ); + connect(mScroll,SIGNAL(valueChanged(int)),this,SLOT(slotChanged())); + + mLCD = new QLCDNumber( this ); + Q_CHECK_PTR(mLCD); + mLCD->setNumDigits( 3 ); + mLCD->setSegmentStyle(QLCDNumber::Filled); + connect(mScroll,SIGNAL(valueChanged(int)),mLCD,SLOT(display(int))); + gl->addMultiCellWidget( mLCD, 0, 1, 0, 0 ); + + text = i18n("Update frequency [seconds]. The value 0 disables update" ); + QLabel *label = new QLabel( text, this ); + Q_CHECK_PTR(label); + gl->addWidget( label, 0, 1 ); + + + label = new QLabel( i18n("File manager (e.g. konsole -e mc %m):") ,this); + Q_CHECK_PTR(label); + topLayout->addWidget( label ); + + mFileManagerEdit = new QLineEdit( this ); + Q_CHECK_PTR(mFileManagerEdit); + topLayout->addWidget( mFileManagerEdit ); + connect(mFileManagerEdit,SIGNAL(textChanged (const QString &)),this,SLOT(slotChanged())); + + text = i18n("Open file manager automatically on mount"); + mOpenMountCheck = new QCheckBox(text, this ); + Q_CHECK_PTR(mOpenMountCheck); + topLayout->addWidget( mOpenMountCheck ); + connect(mOpenMountCheck,SIGNAL(toggled(bool)),this,SLOT(slotChanged())); + + text = i18n("Pop up a window when a disk gets critically full"); + mPopupFullCheck = new QCheckBox( text, this ); + Q_CHECK_PTR(mPopupFullCheck); + topLayout->addWidget( mPopupFullCheck ); + connect(mPopupFullCheck,SIGNAL(toggled(bool)),this,SLOT(slotChanged())); + } + + loadSettings(); + if( init ) + { + applySettings(); + } +} + + +KDFConfigWidget::~KDFConfigWidget() +{ +} + + +void KDFConfigWidget::closeEvent(QCloseEvent *) +{ + applySettings(); + kapp->quit(); +} + + +void KDFConfigWidget::applySettings( void ) +{ + KConfig &config = *kapp->config(); + config.setGroup("KDFConfig"); + + if( GUI ) + { + //config.writeEntry( "Width", width() ); + //config.writeEntry( "Height", height() ); + + mStd.setFileManager( mFileManagerEdit->text() ); + mStd.setUpdateFrequency( mScroll->value() ); + mStd.setPopupIfFull( mPopupFullCheck->isChecked() ); + mStd.setOpenFileManager( mOpenMountCheck->isChecked() ); + mStd.writeConfiguration(); + + QListViewItem *item = mList->firstChild(); + if( item != 0 ) + { + for( int i=mList->header()->count(); i>0; i-- ) + { + bool state = item->text(i-1) == i18n("visible") ? true : false; + config.writeEntry( mTabName[i-1]->mRes, state ); + } + } + } + else + { + mStd.writeDefaultFileManager(); + } + config.sync(); +} + + +void KDFConfigWidget::loadSettings( void ) +{ + KConfig &config = *kapp->config(); + config.setGroup("KDFConfig"); + + if( GUI ) + { + mStd.updateConfiguration(); + mScroll->setValue( mStd.updateFrequency() ); + mLCD->display( mStd.updateFrequency() ); + mPopupFullCheck->setChecked( mStd.popupIfFull() ); + mOpenMountCheck->setChecked( mStd.openFileManager() ); + mFileManagerEdit->setText( mStd.fileManager() ); + + QListViewItem *item = mList->firstChild(); + if( item != 0 ) + { + for( int i=mList->header()->count(); i>0; i-- ) + { + int j = config.readNumEntry( mTabName[i-1]->mRes, 1 ); + item->setText( i-1, j==0 ? i18n("hidden") : i18n("visible") ); + item->setPixmap( i-1, j==0 ? UserIcon ( "delete" ) + : UserIcon ( "tick" ) ); + } + } + } + +} + +void KDFConfigWidget::defaultsBtnClicked( void ) +{ + mStd.setDefault(); + mScroll->setValue( mStd.updateFrequency() ); + mLCD->display( mStd.updateFrequency() ); + mPopupFullCheck->setChecked( mStd.popupIfFull() ); + mOpenMountCheck->setChecked( mStd.openFileManager() ); + mFileManagerEdit->setText( mStd.fileManager() ); + + QListViewItem *item = mList->firstChild(); + if( item != 0 ) + { + for( int i=mList->header()->count(); i>0; i-- ) + { + item->setText( i-1, i18n("visible") ); + item->setPixmap( i-1, UserIcon ( "tick" ) ); + + } + } +} + + +void KDFConfigWidget::toggleListText( QListViewItem *item, const QPoint &, + int column ) +{ + if (!item) return; + QString text = item->text( column ); + item->setText(column, text==i18n("visible")?i18n("hidden"):i18n("visible")); + item->setPixmap( column, text==i18n("visible") ? UserIcon ( "delete" ) + : UserIcon ( "tick" ) ); +} + +void KDFConfigWidget::slotChanged() +{ + emit configChanged(); +} + +#include "kdfconfig.moc" diff --git a/kdf/kdfconfig.h b/kdf/kdfconfig.h new file mode 100644 index 0000000..34aa7d4 --- /dev/null +++ b/kdf/kdfconfig.h @@ -0,0 +1,97 @@ +/* + * kdfconfig.h + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __KDFCONFIG_H__ +#define __KDFCONFIG_H__ + +#include +#include + +#include "stdoption.h" + +class QCheckBox; +class QLabel; +class QLCDNumber; +class QLineEdit; +class QListViewItem; +class QScrollBar; + +class CListView; + +class KDFConfigWidget : public QWidget +{ + Q_OBJECT + + class CTabName + { + public: + CTabName( const QString &res, const QString &name ) + { + mRes = res; + mName = name; + } + CTabName( void ) { } + ~CTabName( void ) { } + + QString mRes; + QString mName; + }; + + public: + KDFConfigWidget( QWidget *parent=0, const char *name=0, bool init=false); + ~KDFConfigWidget(); + + public slots: + void loadSettings( void ); + void applySettings( void ); + void defaultsBtnClicked( void ); + + protected slots: + void slotChanged(); + + private slots: + void toggleListText( QListViewItem *item, const QPoint &, int column ); + + protected: + void closeEvent( QCloseEvent * ); + + private: + QMemArray mTabName; + CListView *mList; + QScrollBar *mScroll; + QLCDNumber *mLCD; + QLineEdit *mFileManagerEdit; + QCheckBox *mOpenMountCheck; + QCheckBox *mPopupFullCheck; + CStdOption mStd; + + signals: + void configChanged(); +}; + + +#endif + + + diff --git a/kdf/kdfui.rc b/kdf/kdfui.rc new file mode 100644 index 0000000..65589e2 --- /dev/null +++ b/kdf/kdfui.rc @@ -0,0 +1,11 @@ + + + + + &File + + + + + + diff --git a/kdf/kdfwidget.cpp b/kdf/kdfwidget.cpp new file mode 100644 index 0000000..ea7aee9 --- /dev/null +++ b/kdf/kdfwidget.cpp @@ -0,0 +1,652 @@ +/* + * kdfwidget.cpp + * + * Copyright (c) 1998-2001 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +// +// 1999-11-29 Espen Sand +// Converted to QLayout and QListView + cleanups +// 1999-12-05 Espen Sand +// Usage bars should work again. +// + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "listview.h" +#include "kdfwidget.h" +#include "optiondialog.h" + + +#define BAR_COLUMN 7 +#define FULL_PERCENT 95.0 + +#ifndef GUI_DEFINED +static bool GUI; +#define GUI_DEFINED +#endif + +/**************************************************************/ + +CListViewItem::CListViewItem( CListView * parent, QListViewItem * after ) + :QListViewItem( parent, after ) +{} + +int CListViewItem::compare ( QListViewItem *i, int column, bool ) const +{ + QString tmp; + + CListViewItem *c = static_cast(i); + + switch (column) { + case KDFWidget::sizeCol: + return (size==c->size) ? 0 : (sizesize) ? -1 : 1; + + case KDFWidget::freeCol: + return (avail==c->avail) ? 0 : (availavail) ? -1 : 1; + + case KDFWidget::fullCol: + case KDFWidget::usageCol: + return (full==c->full) ? 0 : (fullfull) ? -1 : 1; + + default: + return key(column,true).compare(i->key(column,true)); + } +} + +void CListViewItem::setKeys (int kb_size, int kb_avail, float percent_full) +{ + size = kb_size; + avail = kb_avail; + full = (percent_full >= 0.) ? percent_full : 0.; + return; +} + +/**************************************************************/ + +KDFWidget::KDFWidget( QWidget *parent, const char *name, bool init ) + : QWidget(parent, name), mOptionDialog(0), mPopup(0), mTimer(0) +{ + connect(&mDiskList , SIGNAL(readDFDone() ), + this, SLOT (updateDFDone()) ); + connect(&mDiskList , SIGNAL(criticallyFull(DiskEntry*)), + this, SLOT (criticallyFull(DiskEntry*)) ); + + mTabProp.resize(8); + mTabProp[0] = new CTabEntry( "Icon", i18n("Icon"), true, 32); + mTabProp[1] = new CTabEntry( "Device", i18n("Device"), true, 80); + mTabProp[2] = new CTabEntry( "Type", i18n("Type"), true, 50); + mTabProp[3] = new CTabEntry( "Size", i18n("Size"), true, 72); + mTabProp[4] = new CTabEntry( "MountPoint", i18n("Mount Point"), true, 90 ); + mTabProp[5] = new CTabEntry( "Free", i18n("Free"), true, 55); + // xgettext:no-c-format + mTabProp[6] = new CTabEntry( "Full%", i18n("Full %"), true, 70); + mTabProp[7] = new CTabEntry( "UsageBar", i18n("Usage"), true, 100); + + GUI = !init; + if( GUI ) + { + QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 0 ); + mList = new CListView( this, "list" ); + topLayout->addWidget( mList ); + + mList->setAllColumnsShowFocus( true ); + mList->setFrameStyle( QFrame::WinPanel + QFrame::Sunken ); + mList->setShowSortIndicator(true); + connect( mList, + SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int )), + this, SLOT( rightButtonPressed( QListViewItem *, const QPoint &, int ))); + connect( mList, + SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int )), + this, SLOT( rightButtonClicked( QListViewItem *, const QPoint &, int ))); + connect( mList->header(), SIGNAL(sizeChange(int, int, int)), + this, SLOT(columnSizeChanged(int, int, int)) ); + makeColumns(); + + mIsTopLevel = QString(parent->className()) == "KDFTopLevel" ? true : false; + } + + loadSettings(); + if( init == true ) + { + applySettings(); + } +} + + +KDFWidget::~KDFWidget() +{ +} + + + +void KDFWidget::makeColumns( void ) +{ + uint i; + + // + // 1999-11-29 Espen Sand + // This smells like a bad hack but I need to remove the headers + // first. If I don't, the list look like shit afterwards. The iterator + // is just used to prevent an endless loop. With my Qt (1999-11-10 ?) + // I only need as many iterations as there are header items but who knows + // what a new Qt can do! + // + for( i=1000; mList->header()->count() > 0 && i>0; i-- ) + { + mList->header()->removeLabel( 0 ); + mList->header()->update(); + } + for( i=0; iremoveColumn(i++) ); + mList->clear(); + + for( i=0; iaddColumn( e.mName, e.mWidth ); + else + mList->addColumn( e.mName, 0 ); // zero width makes it invisible + } + +} + + + + +/******************************************************************/ +void KDFWidget::closeEvent(QCloseEvent *) +{ + applySettings(); + kapp->quit(); +} + + +void KDFWidget::settingsChanged( void ) +{ + applySettings(); + loadSettings(); +} + + +/*************************************************************************** + * writes the KConfig +**/ +void KDFWidget::applySettings( void ) +{ + KConfig &config = *kapp->config(); + + config.setGroup("KDiskFree"); + if( GUI ) + { + for( uint i=0; icolumnWidth(i); + } + config.writeEntry( e.mRes, e.mWidth ); + } + } + config.sync(); + updateDF(); +} + + +/*************************************************************************** + * reads the KConfig +**/ +void KDFWidget::loadSettings( void ) +{ + mStd.updateConfiguration(); + + if(GUI) + { + KConfig &config = *kapp->config(); + config.setGroup("KDiskFree"); + for( uint i=0; imWidth > 16) + mTabProp[usageCol]->mWidth -= 16; + + config.setGroup("KDFConfig"); + for( uint i=0; ishow(); + } +} + + +/*************************************************************************** + * resets the timer for automatic df-refreshes +**/ +void KDFWidget::setUpdateFrequency( int frequency ) +{ + // + // Kill current timer and restart it if the frequency is + // larger than zero. + // + killTimers(); + if( frequency > 0 ) + { + startTimer( frequency * 1000 ); + } +} + +/*************************************************************************** + * Update (reread) all disk-dependencies +**/ +void KDFWidget::timerEvent(QTimerEvent *) +{ + updateDF(); +} + + +/*************************************************************************** + * checks fstab & df +**/ +void KDFWidget::updateDF( void ) +{ + // + // We can only do this if the popupmenu is not present + // + if( mPopup == 0 ) + { + readingDF = TRUE; + mDiskList.readFSTAB(); + mDiskList.readDF(); + } +} + +/*************************************************************************** + * gets the signal when the diskList is complete and up to date +**/ +void KDFWidget::updateDFDone( void ){ + if (mPopup) //The popup menu is ont he screen... Don't touch the list view... + return; + + mList->clear(); + + int i=0; + CListViewItem *item = 0; + for( DiskEntry *disk=mDiskList.first(); disk!=0; disk=mDiskList.next() ) + { + i++; + QString size, percent; + if( disk->kBSize() > 0 ) + { + percent = KGlobal::locale()->formatNumber(disk->percentFull(), 1) + '%'; + size = disk->prettyKBSize(); + } + else + { + percent = i18n("N/A"); + size = i18n("N/A"); + } + + int k=0; + item = new CListViewItem( mList, item ); + bool root = disk->mountOptions().find("user",0,false)==-1 ? true : false; + item->setPixmap( k++, mList->icon( disk->iconName(), root ) ); + item->setText( k++, disk->deviceName() ); + item->setText( k++, disk->fsType() ); + item->setText( k++, size ); + item->setText( k++, disk->mountPoint() ); + item->setText( k++, disk->prettyKBAvail() ); + item->setText( k++, percent ); + item->setKeys( disk->kBSize(), disk->kBAvail(), disk->percentFull()); + } + readingDF = false; + updateDiskBarPixmaps(); + + mList->sort(); +} + +/*************************************************************************** + * Update display +**/ +void KDFWidget::resizeEvent( QResizeEvent * ) +{ + updateDiskBarPixmaps(); +} + + + +/************************************************************************** + * connected with diskList +**/ +void KDFWidget::criticallyFull( DiskEntry *disk ) +{ + if( mStd.popupIfFull() == true ) + { + QString msg = i18n("Device [%1] on [%2] is getting critically full!"). + arg(disk->deviceName()).arg(disk->mountPoint()); + KMessageBox::sorry( this, msg, i18n("Warning")); + } +} + + +/************************************************************************** + * find correct disk related to list item +**/ +DiskEntry *KDFWidget::selectedDisk( QListViewItem *item ) +{ + if( item == 0 ) + { + item = mList->selectedItem(); + } + if( item == 0 ) + { + return(0); + } + + DiskEntry disk(item->text(deviceCol)); + disk.setMountPoint(item->text(mntCol)); + + // I can't get find() to work. The Disks::compareItems(..) is + // never called. + // + //int pos=mDiskList->find(disk); + + int pos = -1; + for( u_int i=0; ideviceName() ); + if( res == 0 ) + { + res = disk.mountPoint().compare( item->mountPoint() ); + } + if( res == 0 ) + { + pos = i; + break; + } + } + + + return mDiskList.at(pos); + // return(0); +} + +void KDFWidget::rightButtonPressed( QListViewItem *item, const QPoint &p, int ) +{ + if( KContextMenuManager::showOnButtonPress() == true ) + { + popupMenu( item, p ); + } +} + + +void KDFWidget::rightButtonClicked( QListViewItem *item, const QPoint &p, int ) +{ + if( KContextMenuManager::showOnButtonPress() == false ) + { + popupMenu( item, p ); + } +} + + +/************************************************************************** + * pops up and asks for mount/umount right-clicked device +**/ +void KDFWidget::popupMenu( QListViewItem *item, const QPoint &p ) +{ + if (mPopup) //The user may even be able to popup another menu while this open is active... + return; + + // + // The list update will be disabled as long as this menu is + // visible. Reason: The 'disk' may no longer be valid. + // + + mDiskList.setUpdatesDisabled(true); + DiskEntry *disk = selectedDisk( item ); + if( disk == 0 ) + { + return; + } + + mPopup = new KPopupMenu( 0 ); + mPopup->insertTitle( disk->mountPoint() ); + mPopup->insertItem( i18n("Mount Device"), 0 ); + mPopup->insertItem( i18n("Unmount Device"), 1 ); + mPopup->insertSeparator(); + mPopup->insertItem( i18n("Open in File Manager"), 2 ); + mPopup->setItemEnabled( 0, disk->mounted() ? false : true ); + mPopup->setItemEnabled( 1, disk->mounted() ); + mPopup->setItemEnabled( 2, disk->mounted() ); + int position = mPopup->exec( p ); + + + + bool openFileManager = false; + if( position == -1 ) + { + mDiskList.setUpdatesDisabled(false); + delete mPopup; mPopup = 0; + return; + } + else if( position == 0 || position == 1 ) + { + item->setText( sizeCol, i18n("MOUNTING") ); + item->setText( freeCol, i18n("MOUNTING") ); + item->setPixmap( 0, mList->icon( "mini-clock", false ) ); + + int val = disk->toggleMount(); + if( val != 0 /*== false*/ ) + { + KMessageBox::error( this, disk->lastSysError() ); + } + else if ( ( mStd.openFileManager() == true) + && (position == 0) ) //only on mount + { + openFileManager = true; + } + + delete item; + mDiskList.deleteAllMountedAt(disk->mountPoint()); + } + else if( position == 2 ) + { + openFileManager = true; + } + + if( openFileManager == true ) + { + kdDebug() << "opening filemanager" << endl; + if( mStd.fileManager().isEmpty() == false ) + { + QString cmd = mStd.fileManager(); + int pos = cmd.find("%m"); + if( pos > 0 ) + { + cmd = cmd.replace( pos, 2, KProcess::quote(disk->mountPoint()) ) + " &"; + } + else + { + cmd += " " + KProcess::quote(disk->mountPoint()) +" &"; + } + system( QFile::encodeName(cmd) ); + } + } + + //Update only here as showing of error message triggers event loop. + mDiskList.setUpdatesDisabled(false); + delete mPopup; mPopup = 0; + + if( position != 2 ) // No need to update when just opening the fm. + { + updateDF(); + } + +} + + + + +/************************************************************************** + * recalculates and repaints the pixBars +**/ +void KDFWidget::updateDiskBarPixmaps( void ) +{ + if (mTabProp[usageCol]->mVisible != true) + return; + + + int size=0, w=0; + + for(uint i=0; icolumnWidth(i); + w=mList->width() - size - 4; + if (w<0) + w=0; + mList->setColumnWidth(usageCol, w ); + + int h = mList->fontMetrics().lineSpacing()-2; + if( h <= 0 ) + { + return; + } + + int i=0; + for(QListViewItem *it=mList->firstChild(); it!=0;it=it->nextSibling(),i++ ) + { + // I can't get find() to work. The Disks::compareItems(..) is + // never called. + // + //int pos=mDiskList->find(disk); + + DiskEntry dummy(it->text(deviceCol)); + dummy.setMountPoint(it->text(mntCol)); + int pos = -1; + for( u_int i=0; ideviceName() ); + if( res == 0 ) + { + res = dummy.mountPoint().compare( item->mountPoint() ); + } + if( res == 0 ) + { + pos = i; + break; + } + } + + + DiskEntry *disk = mDiskList.at(pos); + if( disk == 0 ) { continue; } + + if( disk->mounted() == true && disk->percentFull() != -1 ) + { + int w = mList->columnWidth(usageCol)-2; + if( w <= 0 ) { continue; } + + QPixmap *pix = new QPixmap( w, h ); + if( pix == 0 ) { continue; } + + pix->fill(white); + QPainter p(pix); + p.setPen(black); + p.drawRect(0,0,w,h); + QColor c; + if ( (disk->iconName().find("cdrom") != -1) + || (disk->iconName().find("writer") != -1) ) + c = gray; + else + c = disk->percentFull() > FULL_PERCENT ? red : darkGreen; + p.setBrush(c ); + p.setPen(white); + p.drawRect(1,1,(int)(((float)pix->width()-2)*(disk->percentFull()/100)), + pix->height()-2); + it->setPixmap ( usageCol, *pix ); + p.end(); + delete pix; + } + } +} + + +void KDFWidget::columnSizeChanged( int, int, int ) +{ + + if( mTimer == 0 ) + { + mTimer = new QTimer( this ); + connect( mTimer, SIGNAL(timeout()), this, SLOT(updateDiskBarPixmaps()) ); + } + else if( mTimer->isActive() == true ) + { + mTimer->stop(); + } + + mTimer->start( 10, true ); +} + + +void KDFWidget::invokeHelp() +{ + kapp->invokeHelp("", "kcontrol/kdf"); +} + +#include "kdfwidget.moc" + diff --git a/kdf/kdfwidget.h b/kdf/kdfwidget.h new file mode 100644 index 0000000..13e14ed --- /dev/null +++ b/kdf/kdfwidget.h @@ -0,0 +1,153 @@ +/* + * kdfwidget.h + * + * Copyright (c) 1998 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __KDFWIDGET_H__ +#define __KDFWIDGET_H__ + +#include +#include +#include +#include + +#include "disks.h" +#include "disklist.h" +#include "mntconfig.h" +#include "kdfconfig.h" +#include "stdoption.h" + +class CListView; +class COptionDialog; +class QTimer; +class KPopupMenu; + +/**************************************************************/ + +class CTabEntry +{ + public: + CTabEntry( const QString &res, const QString &name, bool visible, + uint width ) + { + mRes = res; + mName = name; + mVisible = visible; + mWidth = width; + } + CTabEntry( void ) { } + ~CTabEntry( void ) { } + + + QString mRes; + QString mName; + bool mVisible; + uint mWidth; +}; + +/**************************************************************/ +// +// 2001-03-10 Walter F.J. Mueller +// The purpose of this class is: +// 1) overload the key() method to provide sorting keys so that the +// columns with a numeric value are sorted by numerical value. +// + +class CListViewItem : public QListViewItem +{ + public: + CListViewItem ( CListView * parent, QListViewItem * after ); + + virtual int compare ( QListViewItem* i, int col, bool) const; + + void setKeys ( int kb_size, int kb_avail, float percent_full ) ; + + private: + int size; + int avail; + float full; +}; + +/**************************************************************/ + +class KDFWidget : public QWidget +{ + Q_OBJECT + + public: + enum ColId + { + iconCol = 0, + deviceCol = 1, + typeCol = 2, + sizeCol = 3, + mntCol = 4, + freeCol = 5, + fullCol = 6, + usageCol = 7 + }; + + public: + KDFWidget( QWidget *parent=0, const char *name=0, bool init=false); + ~KDFWidget( void ); + + public slots: + void settingsChanged( void ); + void loadSettings( void ); + void applySettings( void ); + void updateDF( void ); + void updateDFDone( void ); + void settingsBtnClicked( void ); + + private slots: + void criticallyFull( DiskEntry *disk ); + void rightButtonPressed( QListViewItem *item, const QPoint &p, int ); + void rightButtonClicked( QListViewItem *item, const QPoint &p, int ); + void popupMenu( QListViewItem *item, const QPoint &p ); + void setUpdateFrequency( int frequency ); + void columnSizeChanged( int column, int, int newSize ); + void updateDiskBarPixmaps( void ); + void invokeHelp( void ); + + protected: + void timerEvent( QTimerEvent * ); + void closeEvent( QCloseEvent * ); + void resizeEvent( QResizeEvent * ); + + private: + void makeColumns( void ); + DiskEntry *selectedDisk( QListViewItem *item=0 ); + + private: + bool readingDF; + QMemArray mTabProp; + CListView *mList; + COptionDialog *mOptionDialog; + KPopupMenu *mPopup; + QTimer *mTimer; + DiskList mDiskList; + bool mIsTopLevel; + CStdOption mStd; +}; + + +#endif diff --git a/kdf/kwikdisk.cpp b/kdf/kwikdisk.cpp new file mode 100644 index 0000000..d287b16 --- /dev/null +++ b/kdf/kwikdisk.cpp @@ -0,0 +1,346 @@ +/* + kwikdisk.cpp - KDiskFree + + Copyright (C) 1999 by Michael Kropfberger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + */ + +// +// 1999-12-03 Espen Sand +// Cleanups, improvements and fixes for KDE-2 +// +// 2004-07-15 Stanislav Karchebny +// Rewrite for KDE 3 +// + +#include "kwikdisk.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static const char description[] = + I18N_NOOP("KDE Free disk space utility"); + +static const char version[] = "0.2"; + +static KCmdLineOptions options[] = +{ + KCmdLineLastOption +}; + +/*****************************************************************************/ + +KwikDisk::KwikDisk() + : KSystemTray() + , m_readingDF(FALSE) + , m_dirty(TRUE) + , m_menuVisible(FALSE) + , m_inside(FALSE) + , m_optionDialog(0) +{ + kdDebug() << k_funcinfo << endl; + + setPixmap(KSystemTray::loadIcon("kdf")); + show(); + + connect( &m_diskList, SIGNAL(readDFDone()), this, SLOT(updateDFDone()) ); + connect( &m_diskList, SIGNAL(criticallyFull(DiskEntry*)), + this, SLOT(criticallyFull(DiskEntry*)) ); + + connect( contextMenu(), SIGNAL(aboutToHide()), this, SLOT(aboutToHide()) ); + + loadSettings(); + updateDF(); +} + +void KwikDisk::aboutToHide() +{ + kdDebug() << k_funcinfo << endl; + if( !m_inside ) + m_menuVisible = FALSE; +} + +void KwikDisk::enterEvent(QEvent *) +{ + kdDebug() << k_funcinfo << endl; + m_inside = TRUE; +} + +void KwikDisk::leaveEvent(QEvent *) +{ + kdDebug() << k_funcinfo << endl; + m_inside = FALSE; +} + +void KwikDisk::mousePressEvent(QMouseEvent *me) +{ + kdDebug() << k_funcinfo << endl; + + if( m_dirty ) + updateDF(); + + if( m_menuVisible ) + { + contextMenu()->hide(); + m_menuVisible = FALSE; + me->ignore(); + return; + } + + contextMenuAboutToShow(contextMenu()); + contextMenu()->popup( me->globalPos() ); + m_menuVisible = TRUE; +} + +void KwikDisk::loadSettings() +{ + kdDebug() << k_funcinfo << endl; + + m_options.updateConfiguration(); + setUpdateFrequency( m_options.updateFrequency() ); +} + +void KwikDisk::setUpdateFrequency(int frequency) +{ + kdDebug() << k_funcinfo << endl; + + // + // Kill current timer and restart it if the frequency is + // larger than zero. + // + killTimers(); + if( frequency > 0 ) + { + startTimer(frequency * 1000); + } +} + +/** + * Mark the list as dirty thus forcing a reload the next time the + * popup menu is about to become visible. Note: A current visible popup + * will not be updated now. + */ +void KwikDisk::timerEvent(QTimerEvent *) +{ + kdDebug() << k_funcinfo << endl; + m_dirty = TRUE; +} + +void KwikDisk::updateDF() +{ + kdDebug() << k_funcinfo << endl; + + m_readingDF = true; + m_diskList.readFSTAB(); + m_diskList.readDF(); +} + +void KwikDisk::updateDFDone() +{ + kdDebug() << k_funcinfo << endl; + + m_readingDF = FALSE; + m_dirty = FALSE; + + contextMenu()->clear(); + contextMenu()->insertTitle(KSystemTray::loadIcon("kdf"), i18n("KwikDisk")); + + int itemNo = 0; + for( DiskEntry *disk = m_diskList.first(); disk != 0; disk = m_diskList.next() ) + { + // FIXME: tool tips are unused atm + QString toolTipText = i18n("%1 (%2) %3 on %4") + .arg( disk->mounted() ? i18n("Unmount") : i18n("Mount")) + .arg(disk->fsType()).arg(disk->deviceName()).arg(disk->mountPoint()); + + QString entryName = disk->mountPoint(); + if( disk->mounted() ) + { + entryName += QString("\t\t\t[%1]").arg(disk->prettyKBAvail()); + } + int id = contextMenu()->insertItem("", this, SLOT(toggleMount(int)) ); + contextMenu()->setItemParameter(id, itemNo); + itemNo++; + + QPixmap *pix = new QPixmap(KSystemTray::loadIcon(disk->iconName())); + + if( getuid() !=0 && disk->mountOptions().find("user",0, false) == -1 ) + { + // + // Special root icon, normal user cant mount. + // + // 2000-01-23 Espen Sand + // Careful here: If the mask has not been defined we can + // not use QPixmap::mask() because it returns 0 => segfault + // + if( pix->mask() != 0 ) + { + QBitmap *bm = new QBitmap(*(pix->mask())); + if( bm != 0 ) + { + QPainter qp( bm ); + qp.setPen(QPen(white,1)); + qp.drawRect(0,0,bm->width(),bm->height()); + qp.end(); + pix->setMask(*bm); + } + QPainter qp( pix ); + qp.setPen(QPen(red,1)); + qp.drawRect(0,0,pix->width(),pix->height()); + qp.end(); + } + contextMenu()->disconnectItem(id,disk,SLOT(toggleMount())); + toolTipText = i18n("You must login as root to mount this disk"); + } + + contextMenu()->changeItem(*pix,entryName,id); + } + + contextMenu()->insertSeparator(); + + contextMenu()->insertItem( + KSystemTray::loadIcon("kdf"), + i18n("&Start KDiskFree"), this, SLOT(startKDF()),0); + + contextMenu()->insertItem( + KSystemTray::loadIcon("configure"), + i18n("&Configure KwikDisk..."), this, SLOT(changeSettings()),0); + + contextMenu()->insertItem( + KSystemTray::loadIcon("help"), + KStdGuiItem::help().text(), this, SLOT(invokeHelp()),0); + + contextMenu()->insertSeparator(); + + contextMenu()->insertItem( + KSystemTray::loadIcon("exit"), + KStdGuiItem::quit().text(), this, SIGNAL(quitSelected()) ); +} + +void KwikDisk::toggleMount(int item) +{ + kdDebug() << k_funcinfo << endl; + + DiskEntry *disk = m_diskList.at(item); + if( disk == 0 ) + { + return; + } + + int val = disk->toggleMount(); + if( val != 0 ) + { + KMessageBox::error(this, disk->lastSysError()); + } + else if( (m_options.openFileManager() == true) && (disk->mounted() == true ) ) + { + kdDebug() << "opening filemanager" << endl; + if( m_options.fileManager().isEmpty() == false ) + { + QString cmd = m_options.fileManager(); + int pos = cmd.find("%m"); + if( pos > 0 ) + { + cmd = cmd.replace( pos, 2, KProcess::quote(disk->mountPoint()) ) + " &"; + } + else + { + cmd += " " + KProcess::quote(disk->mountPoint()) +" &"; + } + system( QFile::encodeName(cmd) ); + } + } + m_dirty = TRUE; +} + +void KwikDisk::criticallyFull(DiskEntry *disk) +{ + kdDebug() << k_funcinfo << endl; + + if( m_options.popupIfFull() == true ) + { + QString msg = i18n("Device [%1] on [%2] is getting critically full!") + .arg(disk->deviceName()).arg(disk->mountPoint()); + KMessageBox::sorry( this, msg, i18n("Warning")); + } +} + +void KwikDisk::changeSettings() +{ + if( m_optionDialog == 0 ) + { + m_optionDialog = new COptionDialog(this, "options", FALSE); + if( !m_optionDialog ) return; + connect(m_optionDialog, SIGNAL(valueChanged()), + this, SLOT(loadSettings())); + } + m_optionDialog->show(); +} + +void KwikDisk::startKDF() +{ + kdDebug() << k_funcinfo << endl; + + KRun::runCommand("kdf"); +} + +void KwikDisk::invokeHelp() +{ + kapp->invokeHelp("", "kdf"); +} + +/*****************************************************************************/ + +int main(int argc, char **argv) +{ + KLocale::setMainCatalogue( "kdf" ); + + KAboutData about("kwikdisk", I18N_NOOP("KwikDisk"), version, description, + KAboutData::License_GPL, "(C) 2004 Stanislav Karchebny", + 0, 0, "Stanislav.Karchebny@kdemail.net"); + about.addAuthor( "Michael Kropfberger", I18N_NOOP("Original author"), + "michael.kropfberger@gmx.net" ); + about.addAuthor( "Espen Sand", I18N_NOOP("KDE 2 changes"), "" ); + about.addAuthor( "Stanislav Karchebny", I18N_NOOP("KDE 3 changes"), + "Stanislav.Karchebny@kdemail.net" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + KwikDisk *mainWin = 0; + + mainWin = new KwikDisk; + QObject::connect(mainWin, SIGNAL(quitSelected()), &app, SLOT(quit())); + + // mainWin has WDestructiveClose flag by default, so it will delete itself. + return app.exec(); +} + +/*****************************************************************************/ + +#include "kwikdisk.moc" diff --git a/kdf/kwikdisk.desktop b/kdf/kwikdisk.desktop new file mode 100644 index 0000000..7e3ab52 --- /dev/null +++ b/kdf/kwikdisk.desktop @@ -0,0 +1,78 @@ +[Desktop Entry] +Name=KwikDisk +Name[af]=Kwikdisk +Name[eo]=Diskokroĉilo +Name[et]=Ketaste ühendamine +Name[fa]=Kwikدیسک +Name[hi]=क्विक-डिस्क +Name[ja]=マウントツール +Name[ne]=क्विक डिस्क +Name[sv]=Snabbdisk +Name[ta]= கிவிக்வட்டு +Name[th]=เรียกใช้ดิสก์ด่วน +Exec=kwikdisk -caption "%c" +Icon=kwikdisk +Type=Application +DocPath=kdf/index.html +GenericName=Removable Media Utility +GenericName[af]=Verwyderbare Media Program +GenericName[ar]=أداة الوسائط القابلة للإزالة +GenericName[bg]=Преносими носители +GenericName[br]=Ostilh media lem-laka +GenericName[bs]=Alat za izmjenjive medije +GenericName[ca]=Utilitat per discos extraïbles +GenericName[cs]=Nástroj pro výměnné disky +GenericName[cy]=Cyfleuster Cyfryngau Symudadwy +GenericName[da]=Flytbart medieredskab +GenericName[de]=Dienstprogramm für Wechselmedien +GenericName[el]=Εργαλείο αφαιρούμενων μέσων +GenericName[eo]=Ŝanĝebla disko ilo +GenericName[es]=Herramienta de medios extraíbles +GenericName[et]=Eemaldatavate andmekandjate utiliit +GenericName[eu]=Euskarri Eramangarrien Erabilgarritasuna +GenericName[fa]=برنامۀ سودمند رسانه‌ای قابل حذف +GenericName[fi]=Poistettavan median työkalu +GenericName[fr]=Utilitaire de média éjectable +GenericName[ga]=Uirlis Meáin Inscortha +GenericName[he]=כלי מדיה נשלפת +GenericName[hi]=हटाया जा सकने वाला मीडिया यूटिलिटी +GenericName[hr]=Alat za uklonjive medije +GenericName[hu]=Lemezcsatlakoztató +GenericName[is]=Diskatól +GenericName[it]=Accessorio per i supporti rimovibili +GenericName[ja]=リムーバブルメディアユーティリティ +GenericName[ka]=მოხსნადი მედიის უტილიტა +GenericName[kk]=Ауыстырмалы тасушының утилитасы +GenericName[km]=ឧបករណ៍​មេឌៀ​ដែល​អាច​យក​ចេញ +GenericName[lt]=Keičiamų diskų ar kitų įrenginių programa +GenericName[mk]=Алатка за менливи носачи +GenericName[ms]=Utiliti Media Mudah Alih +GenericName[nb]=Verktøy for flyttbare media +GenericName[nds]=Deenstprogramm för tuuschbore Medien +GenericName[ne]=हटाउन योग्य मिडिया युटिलिटी +GenericName[nl]=Verwisselbare media beheren +GenericName[nn]=Verktøy for flyttbare medium +GenericName[pa]=ਹਟਾਉਣਯੋਗ ਮੀਡਿਆ ਸਹੂਲਤ +GenericName[pl]=Narzędzie do wyjmowalnych dysków +GenericName[pt]=Utilitário para Media Removível +GenericName[pt_BR]=Utilitário de Mídia Removível +GenericName[ro]=Utilitar ejectare mediu +GenericName[ru]=Управление дисками +GenericName[sk]=Nástroj pre vymeniteľné médiá +GenericName[sl]=Pripomoček za izmenjevalne medije +GenericName[sr]=Алат за уклоњиве медије +GenericName[sr@Latn]=Alat za uklonjive medije +GenericName[sv]=Verktyg för flyttbar media +GenericName[ta]= நீக்ககூடிய ஊடக பயன்பாடு +GenericName[tg]=Барномаи Пуштибон барои Расонаҳои Ҷойивазшаванда +GenericName[th]=เครื่องมือจัดการสื่อที่ถอดได้ +GenericName[tr]=Çıkartılabilir Aygıt +GenericName[uk]=Утиліта змінних носіїв +GenericName[wa]=Usteye po les bodjåves sopoirts +GenericName[xh]=Umdlali wezoSasazo +GenericName[zh_CN]=可移动介质工具 +GenericName[zh_TW]=可移動媒體公用程式 +GenericName[zu]=Umsebenzi Wonozindaba Ogudluzekayo +Terminal=false +Categories=Qt;KDE;System;X-KDE-More; +OnlyShowIn=KDE; diff --git a/kdf/kwikdisk.h b/kdf/kwikdisk.h new file mode 100644 index 0000000..09066cc --- /dev/null +++ b/kdf/kwikdisk.h @@ -0,0 +1,78 @@ +/* + kwikdisk.cpp - KDiskFree + + Copyright (C) 1999 by Michael Kropfberger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + */ + +// With changes by Espen Sand and Stanislav Karchebny. + +#ifndef _KWIKDISK_H_ +#define _KWIKDISK_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "disklist.h" +#include "stdoption.h" +#include "optiondialog.h" + +#include +#include + +/** +* @short Application Main Window (however in Tray) +* @version 0.2 +*/ +class KwikDisk : public KSystemTray +{ + Q_OBJECT + public: + KwikDisk(); + + private slots: + void updateDFDone(); + void criticallyFull(DiskEntry*); + void toggleMount(int); + void loadSettings(); + void changeSettings(); + void startKDF(); + void invokeHelp(); + void aboutToHide(); + + private: + void mousePressEvent(QMouseEvent *); + void timerEvent(QTimerEvent *); + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + + void setUpdateFrequency(int frequency); + + void updateDF(); + + private: + DiskList m_diskList; + CStdOption m_options; + bool m_readingDF; + bool m_dirty; + bool m_menuVisible; + bool m_inside; + COptionDialog *m_optionDialog; +}; + +#endif // _KWIKDISK_H_ diff --git a/kdf/listview.cpp b/kdf/listview.cpp new file mode 100644 index 0000000..b522a22 --- /dev/null +++ b/kdf/listview.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 1999 Espen Sand, espen@kde.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// 1999-11-28 Espen Sand +// The purpose of this class is: +// 1) Easily set minimum number of visible items and to adjust the sizeHint() +// 2) Provide a pixmap collection +// + +#include +#include +#include + +#include + +#include "listview.h" + +template class QDict; + +CListView::CListView( QWidget *parent, const char *name, int visibleItem ) + :KListView( parent, name ), mVisibleItem(QMAX( 1, visibleItem )) +{ + setVisibleItem(visibleItem); + mPixDict.setAutoDelete(true); +} + +void CListView::setVisibleItem( int visibleItem, bool updateSize ) +{ + mVisibleItem = QMAX( 1, visibleItem ); + if( updateSize == true ) + { + QSize s = sizeHint(); + setMinimumSize( s.width() + verticalScrollBar()->sizeHint().width() + + lineWidth() * 2, s.height() ); + } +} + +QSize CListView::sizeHint( void ) const +{ + QSize s = QListView::sizeHint(); + + int h = fontMetrics().height() + 2*itemMargin(); + if( h % 2 > 0 ) { h++; } + + s.setHeight( h*mVisibleItem + lineWidth()*2 + header()->sizeHint().height()); + return( s ); +} + + + +const QPixmap &CListView::icon( const QString &iconName, bool drawBorder ) +{ + QPixmap *pix = mPixDict[ iconName ]; + if( pix == 0 ) + { + pix = new QPixmap( SmallIcon( iconName ) ); + + if( drawBorder == true ) + { + // + // 2000-01-23 Espen Sand + // Careful here: If the mask has not been defined we can + // not use QPixmap::mask() because it returns 0 => segfault + // + if( pix->mask() != 0 ) + { + QBitmap *bm = new QBitmap(*(pix->mask())); + if( bm != 0 ) + { + QPainter qp(bm); + qp.setPen(QPen(white,1)); + qp.drawRect(0,0,bm->width(),bm->height()); + qp.end(); + pix->setMask(*bm); + } + + QPainter qp(pix); + qp.setPen(QPen(red,1)); + qp.drawRect(0,0,pix->width(),pix->height()); + qp.end(); + delete bm; + + } + } + mPixDict.replace( iconName, pix ); + } + + return( *pix ); +} + + +#include "listview.moc" + + + + diff --git a/kdf/listview.h b/kdf/listview.h new file mode 100644 index 0000000..0bb4bc5 --- /dev/null +++ b/kdf/listview.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 1999 Espen Sand, espen@kde.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef _LISTVIEW_H_ +#define _LISTVIEW_H_ + +#include +#include + +#include + +class CListView : public KListView +{ + Q_OBJECT + + public: + CListView( QWidget *parent=0, const char *name=0, int visibleItem=10 ); + + void setVisibleItem( int visibleItem, bool updateSize=true ); + virtual QSize sizeHint( void ) const; + const QPixmap &icon( const QString &iconName, bool drawBorder ); + + private: + int mVisibleItem; + QDict mPixDict; +}; + + + + +#endif + + + + + + diff --git a/kdf/mntconfig.cpp b/kdf/mntconfig.cpp new file mode 100644 index 0000000..c1c1bbe --- /dev/null +++ b/kdf/mntconfig.cpp @@ -0,0 +1,364 @@ +/* + * mntconfig.cpp + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +// +// 1999-11-29 Espen Sand +// Converted to QLayout and QListView + cleanups +// + +#include +#include +#include +#include + +#undef Unsorted + +#include +#include +#include +#include + +#include "listview.h" +#include "mntconfig.h" + +#ifndef KDE_USE_FINAL +static bool GUI; +#endif + + +MntConfigWidget::MntConfigWidget(QWidget *parent, const char *name, bool init) + : QWidget(parent, name) +{ + mInitializing = false; + + GUI = !init; + if (GUI) + { + //tabList fillup waits until disklist.readDF() is done... + mDiskList.readFSTAB(); + mDiskList.readDF(); + mInitializing = true; + connect( &mDiskList,SIGNAL(readDFDone()),this,SLOT(readDFDone())); + + QString text; + QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint()); + + mList = new CListView( this, "list", 8 ); + mList->setAllColumnsShowFocus( true ); + mList->addColumn( i18n("Icon") ); + mList->addColumn( i18n("Device") ); + mList->addColumn( i18n("Mount Point") ); + mList->addColumn( i18n("Mount Command") ); + mList->addColumn( i18n("Unmount Command") ); + mList->setFrameStyle( QFrame::WinPanel + QFrame::Sunken ); + connect( mList, SIGNAL(selectionChanged(QListViewItem *)), + this, SLOT(clicked(QListViewItem *))); + + topLayout->addWidget( mList ); + + text = QString("%1: %2 %3: %4"). + arg(mList->header()->label(DEVCOL)). + arg(i18n("None")). + arg(mList->header()->label(MNTPNTCOL)). + arg(i18n("None")); + mGroupBox = new QGroupBox( text, this ); + Q_CHECK_PTR(mGroupBox); + topLayout->addWidget(mGroupBox); + + QGridLayout *gl = new QGridLayout(mGroupBox, 3, 4, KDialog::spacingHint()); + if( gl == 0 ) { return; } + gl->addRowSpacing( 0, fontMetrics().lineSpacing() ); + + mIconLineEdit = new QLineEdit(mGroupBox); + Q_CHECK_PTR(mIconLineEdit); + mIconLineEdit->setMinimumWidth( fontMetrics().maxWidth()*10 ); + connect( mIconLineEdit, SIGNAL(textChanged(const QString&)), + this,SLOT(iconChanged(const QString&))); + connect( mIconLineEdit, SIGNAL(textChanged(const QString&)), + this,SLOT(slotChanged())); + gl->addWidget( mIconLineEdit, 2, 0 ); + + mIconButton = new KIconButton(mGroupBox); + mIconButton->setIconType(KIcon::Small, KIcon::Device); + Q_CHECK_PTR(mIconButton); + mIconButton->setFixedWidth( mIconButton->sizeHint().height() ); + connect(mIconButton,SIGNAL(iconChanged(QString)),this,SLOT(iconChangedButton(QString))); + gl->addWidget( mIconButton, 2, 1 ); + + //Mount + mMountButton = new QPushButton( i18n("Get Mount Command"), mGroupBox ); + Q_CHECK_PTR(mMountButton); + connect(mMountButton,SIGNAL(clicked()),this,SLOT(selectMntFile())); + gl->addWidget( mMountButton, 1, 2 ); + + mMountLineEdit = new QLineEdit(mGroupBox); + Q_CHECK_PTR(mMountLineEdit); + mMountLineEdit->setMinimumWidth( fontMetrics().maxWidth()*10 ); + connect(mMountLineEdit,SIGNAL(textChanged(const QString&)), + this,SLOT(mntCmdChanged(const QString&))); + connect( mMountLineEdit, SIGNAL(textChanged(const QString&)), + this,SLOT(slotChanged())); + gl->addWidget( mMountLineEdit, 1, 3 ); + + //Umount + mUmountButton = new QPushButton(i18n("Get Unmount Command"), mGroupBox ); + Q_CHECK_PTR( mUmountButton ); + connect(mUmountButton,SIGNAL(clicked()),this,SLOT(selectUmntFile())); + gl->addWidget( mUmountButton, 2, 2 ); + + mUmountLineEdit=new QLineEdit(mGroupBox); + Q_CHECK_PTR(mUmountLineEdit); + mUmountLineEdit->setMinimumWidth( fontMetrics().maxWidth()*10 ); + connect(mUmountLineEdit,SIGNAL(textChanged(const QString&)), + this,SLOT(umntCmdChanged(const QString&))); + connect( mUmountLineEdit, SIGNAL(textChanged(const QString&)), + this,SLOT(slotChanged())); + gl->addWidget( mUmountLineEdit, 2, 3 ); + + } + + loadSettings(); + if(init) + { + applySettings(); + mDiskLookup.resize(0); + } + + mGroupBox->setEnabled( false ); +} + + +MntConfigWidget::~MntConfigWidget( void ) +{ +} + + +void MntConfigWidget::readDFDone( void ) +{ + mInitializing = false; + mList->clear(); + mDiskLookup.resize(mDiskList.count()); + + int i=0; + QListViewItem *item = 0; + for( DiskEntry *disk=mDiskList.first(); disk!=0; disk=mDiskList.next(),++i ) + { + item = new QListViewItem( mList, item, QString::null, disk->deviceName(), + disk->mountPoint(), disk->mountCommand(), disk->umountCommand() ); + item->setPixmap( ICONCOL, SmallIcon( disk->iconName() ) ); + mDiskLookup[i] = item; + } + + loadSettings(); + applySettings(); +} + + +void MntConfigWidget::applySettings( void ) +{ + mDiskList.applySettings(); + + KConfig &config = *kapp->config(); + config.setGroup("MntConfig"); + if(GUI ) + { + config.writeEntry("Width", width() ); + config.writeEntry("Height", height() ); + } + config.sync(); +} + + +void MntConfigWidget::loadSettings( void ) +{ + KConfig &config = *kapp->config(); + if( mInitializing == false && GUI ) + { + config.setGroup("MntConfig"); + if( isTopLevel() ) + { + int w = config.readNumEntry("Width",this->width() ); + int h = config.readNumEntry("Height",this->height() ); + resize(w,h); + } + + QListViewItem *item = mList->selectedItem(); + if( item != 0 ) + { + clicked( item ); + } + } +} + + +void MntConfigWidget::clicked( QListViewItem *item ) +{ + mGroupBox->setEnabled( true ); + mGroupBox->setTitle( QString("%1: %2 %3: %4"). + arg(mList->header()->label(DEVCOL)). + arg(item->text(DEVCOL)). + arg(mList->header()->label(MNTPNTCOL)). + arg(item->text(MNTPNTCOL)) ); + + + const QPixmap *pix = item->pixmap(ICONCOL); + if( pix != 0 ) + { + mIconButton->setPixmap( *pix ); + } + + for(unsigned i=0 ; i < mDiskList.count() ; ++i) + { + if (mDiskLookup[i] == item) + { + DiskEntry *disk = mDiskList.at(i); + if( disk != 0 ) + { + mIconLineEdit->setText( disk->iconName() ); + } + break; + } + } + mMountLineEdit->setText( item->text(MNTCMDCOL) ); + mUmountLineEdit->setText( item->text(UMNTCMDCOL) ); +} + + +void MntConfigWidget::iconChangedButton(QString iconName) +{ + iconChanged(iconName); +} +void MntConfigWidget::iconChanged(const QString &iconName) +{ + if( iconName.findRev('_') == 0 || + (iconName.right(iconName.length()-iconName.findRev('_'))!="_mount" && + iconName.right(iconName.length()-iconName.findRev('_'))!="_unmount")) + { + QString msg = i18n("" + "This filename is not valid: %1\n" + "It must end with " + "\"_mount\" or \"_unmount\".").arg(iconName); + KMessageBox::sorry( this, msg ); + return; + } + + QListViewItem *item = mList->selectedItem(); + for(unsigned i=0 ; i < mDiskList.count() ; ++i) + { + if (mDiskLookup[i] == item) + { + DiskEntry *disk = mDiskList.at(i); + if( disk != 0 ) + { + disk->setIconName(iconName); + mIconLineEdit->setText(iconName); + KIconLoader &loader = *KGlobal::iconLoader(); + item->setPixmap( ICONCOL, loader.loadIcon( iconName, KIcon::Small)); + } + break; + } + } +} + + +void MntConfigWidget::selectMntFile() +{ + KURL url = KFileDialog::getOpenURL( "","*", this ); + + if( url.isEmpty() ) + return; + + if( !url.isLocalFile() ) + { + KMessageBox::sorry( 0L, i18n( "Only local files supported." ) ); + return; + } + + mMountLineEdit->setText( url.path() ); +} + +void MntConfigWidget::selectUmntFile() +{ + KURL url = KFileDialog::getOpenURL( "", "*", this ); + + if( url.isEmpty() ) + return; + + if( !url.isLocalFile() ) + { + KMessageBox::sorry( 0L, i18n( "Only local files are currently supported." ) ); + return; + } + + mUmountLineEdit->setText( url.path() ); +} + +void MntConfigWidget::mntCmdChanged( const QString &data ) +{ + QListViewItem *item = mList->selectedItem(); + for(unsigned i=0 ; i < mDiskList.count() ; ++i) + { + if (mDiskLookup[i] == item) + { + DiskEntry *disk = mDiskList.at(i); + if( disk != 0 ) + { + disk->setMountCommand(data); + item->setText( MNTCMDCOL, data ); + } + break; + } + } +} + + +void MntConfigWidget::umntCmdChanged( const QString &data ) +{ + QListViewItem *item = mList->selectedItem(); + for(unsigned i=0 ; i < mDiskList.count() ; ++i) + { + if (mDiskLookup[i] == item) + { + DiskEntry *disk = mDiskList.at(i); + if( disk != 0 ) + { + disk->setUmountCommand(data); + item->setText( UMNTCMDCOL, data ); + } + break; + } + } +} + + +void MntConfigWidget::closeEvent(QCloseEvent *) +{ +} + +void MntConfigWidget::slotChanged() +{ + emit configChanged(); +} + +#include "mntconfig.moc" diff --git a/kdf/mntconfig.h b/kdf/mntconfig.h new file mode 100644 index 0000000..d24c8b1 --- /dev/null +++ b/kdf/mntconfig.h @@ -0,0 +1,102 @@ +/* + * mntconfig.h + * + * Copyright (c) 1999 Michael Kropfberger + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __MNTCONFIG_H__ +#define __MNTCONFIG_H__ + +#include +#include +#include + +#include "disks.h" +#include "disklist.h" + +class QGroupBox; +class QPushButton; +class QRadioButton; +class QLineEdit; +class KIconButton; + +class CListView; +class QListViewItem; + +/**************************************************************/ + +class MntConfigWidget : public QWidget +{ + Q_OBJECT + + public: + enum ColType + { + ICONCOL=0, + DEVCOL=1, + MNTPNTCOL=2, + MNTCMDCOL=3, + UMNTCMDCOL=4 + }; + + public: + MntConfigWidget( QWidget *parent=0, const char *name=0, bool init=false ); + ~MntConfigWidget(); + + public slots: + void loadSettings( void ); + void applySettings( void ); + + protected slots: + void slotChanged(); + + private slots: + void readDFDone( void ); + void clicked( QListViewItem *item ); + void selectMntFile( void ); + void selectUmntFile( void ); + void iconChangedButton(QString); + void iconChanged( const QString & ); + void mntCmdChanged( const QString & ); + void umntCmdChanged( const QString & ); + + protected: + void closeEvent( QCloseEvent * ); + + private: + CListView *mList; + QGroupBox *mGroupBox; + QLineEdit *mIconLineEdit; + QLineEdit *mMountLineEdit; + QLineEdit *mUmountLineEdit; + QPushButton *mMountButton; + QPushButton *mUmountButton; + KIconButton *mIconButton; + DiskList mDiskList; + bool mInitializing; + QMemArray mDiskLookup; + + signals: + void configChanged(); +}; + + +#endif diff --git a/kdf/optiondialog.cpp b/kdf/optiondialog.cpp new file mode 100644 index 0000000..05c5570 --- /dev/null +++ b/kdf/optiondialog.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 1999 Espen Sand, espen@kde.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include + +#include "kdfconfig.h" +#include "mntconfig.h" +#include "optiondialog.h" + +COptionDialog::COptionDialog( QWidget *parent, const char *name, bool modal ) + :KDialogBase( Tabbed, i18n("Configure"), Help|Apply|Ok|Cancel, Ok, + parent, name, modal ) +{ + setHelp( "kcontrol/kdf/index.html", QString::null ); + + QFrame *f1 = addPage( i18n("General Settings") ); + QVBoxLayout *l1 = new QVBoxLayout( f1 ); + mConf = new KDFConfigWidget( f1, "kdfconf" ); + l1->addWidget(mConf); + connect( mConf, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + + QFrame *f2 = addPage( i18n("Mount Commands") ); + QVBoxLayout *l2 = new QVBoxLayout( f2 ); + mMnt = new MntConfigWidget( f2, "mntconf"); + l2->addWidget(mMnt); + connect( mMnt, SIGNAL( configChanged() ), this, SLOT( slotChanged() ) ); + enableButton( Apply, false ); + dataChanged = false; +} + + +COptionDialog::~COptionDialog( void ) +{ +} + + +void COptionDialog::slotOk( void ) +{ + if( dataChanged ) + slotApply(); + accept(); +} + + +void COptionDialog::slotApply( void ) +{ + mConf->applySettings(); + mMnt->applySettings(); + emit valueChanged(); + enableButton( Apply, false ); + dataChanged = false; +} + +void COptionDialog::slotChanged() +{ + enableButton( Apply, true ); + dataChanged = true; +} + +#include "optiondialog.moc" + + + + + + + + + diff --git a/kdf/optiondialog.h b/kdf/optiondialog.h new file mode 100644 index 0000000..d1a7a5c --- /dev/null +++ b/kdf/optiondialog.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 1999 Espen Sand, espen@kde.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef _OPTION_DIALOG_H_ +#define _OPTION_DIALOG_H_ + +#include + +class KDFConfigWidget; +class MntConfigWidget; + +class COptionDialog : public KDialogBase +{ + Q_OBJECT + + public: + COptionDialog( QWidget *parent=0, const char *name=0, bool modal=true ); + ~COptionDialog( void ); + + protected slots: + virtual void slotOk( void ); + virtual void slotApply( void ); + void slotChanged(); + + signals: + void valueChanged( void ); + + private: + KDFConfigWidget *mConf; + MntConfigWidget *mMnt; + bool dataChanged; +}; + +#endif diff --git a/kdf/pics/Makefile.am b/kdf/pics/Makefile.am new file mode 100644 index 0000000..2f00b0c --- /dev/null +++ b/kdf/pics/Makefile.am @@ -0,0 +1,4 @@ +KDE_ICON = kdf kcmdf kwikdisk +pics_DATA = tick.png delete.png +picsdir = $(kde_datadir)/kdf/pics + diff --git a/kdf/pics/cr16-app-kcmdf.png b/kdf/pics/cr16-app-kcmdf.png new file mode 100644 index 0000000..7b966b6 Binary files /dev/null and b/kdf/pics/cr16-app-kcmdf.png differ diff --git a/kdf/pics/cr22-app-kcmdf.png b/kdf/pics/cr22-app-kcmdf.png new file mode 100644 index 0000000..aa92e25 Binary files /dev/null and b/kdf/pics/cr22-app-kcmdf.png differ diff --git a/kdf/pics/cr32-app-kcmdf.png b/kdf/pics/cr32-app-kcmdf.png new file mode 100644 index 0000000..eb2d9e6 Binary files /dev/null and b/kdf/pics/cr32-app-kcmdf.png differ diff --git a/kdf/pics/delete.png b/kdf/pics/delete.png new file mode 100644 index 0000000..2415dfc Binary files /dev/null and b/kdf/pics/delete.png differ diff --git a/kdf/pics/hi128-app-kdf.png b/kdf/pics/hi128-app-kdf.png new file mode 100644 index 0000000..20ba9bf Binary files /dev/null and b/kdf/pics/hi128-app-kdf.png differ diff --git a/kdf/pics/hi128-app-kwikdisk.png b/kdf/pics/hi128-app-kwikdisk.png new file mode 100644 index 0000000..cbec029 Binary files /dev/null and b/kdf/pics/hi128-app-kwikdisk.png differ diff --git a/kdf/pics/hi16-app-kdf.png b/kdf/pics/hi16-app-kdf.png new file mode 100644 index 0000000..7b966b6 Binary files /dev/null and b/kdf/pics/hi16-app-kdf.png differ diff --git a/kdf/pics/hi16-app-kwikdisk.png b/kdf/pics/hi16-app-kwikdisk.png new file mode 100644 index 0000000..e182aca Binary files /dev/null and b/kdf/pics/hi16-app-kwikdisk.png differ diff --git a/kdf/pics/hi22-app-kdf.png b/kdf/pics/hi22-app-kdf.png new file mode 100644 index 0000000..aa92e25 Binary files /dev/null and b/kdf/pics/hi22-app-kdf.png differ diff --git a/kdf/pics/hi22-app-kwikdisk.png b/kdf/pics/hi22-app-kwikdisk.png new file mode 100644 index 0000000..e150637 Binary files /dev/null and b/kdf/pics/hi22-app-kwikdisk.png differ diff --git a/kdf/pics/hi32-app-kdf.png b/kdf/pics/hi32-app-kdf.png new file mode 100644 index 0000000..eb2d9e6 Binary files /dev/null and b/kdf/pics/hi32-app-kdf.png differ diff --git a/kdf/pics/hi32-app-kwikdisk.png b/kdf/pics/hi32-app-kwikdisk.png new file mode 100644 index 0000000..be2e6ab Binary files /dev/null and b/kdf/pics/hi32-app-kwikdisk.png differ diff --git a/kdf/pics/hi48-app-kdf.png b/kdf/pics/hi48-app-kdf.png new file mode 100644 index 0000000..d976289 Binary files /dev/null and b/kdf/pics/hi48-app-kdf.png differ diff --git a/kdf/pics/hi48-app-kwikdisk.png b/kdf/pics/hi48-app-kwikdisk.png new file mode 100644 index 0000000..29d351f Binary files /dev/null and b/kdf/pics/hi48-app-kwikdisk.png differ diff --git a/kdf/pics/hi64-app-kdf.png b/kdf/pics/hi64-app-kdf.png new file mode 100644 index 0000000..984d3ee Binary files /dev/null and b/kdf/pics/hi64-app-kdf.png differ diff --git a/kdf/pics/hi64-app-kwikdisk.png b/kdf/pics/hi64-app-kwikdisk.png new file mode 100644 index 0000000..58378b1 Binary files /dev/null and b/kdf/pics/hi64-app-kwikdisk.png differ diff --git a/kdf/pics/mini-root.png b/kdf/pics/mini-root.png new file mode 100644 index 0000000..538a1bf Binary files /dev/null and b/kdf/pics/mini-root.png differ diff --git a/kdf/pics/tick.png b/kdf/pics/tick.png new file mode 100644 index 0000000..543710f Binary files /dev/null and b/kdf/pics/tick.png differ diff --git a/kdf/stdoption.cpp b/kdf/stdoption.cpp new file mode 100644 index 0000000..16a9e07 --- /dev/null +++ b/kdf/stdoption.cpp @@ -0,0 +1,148 @@ +/* +** +** Copyright (C) 1998 by Michael Kropfberger +** +*/ + +/* +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to kde-devel@kde.org +*/ + + +#include +#include + +#include "stdoption.h" + +QString CStdOption::mDefaultFileManager = "kfmclient openURL %m"; +int CStdOption::mDefaultUpdateFrequency = 60; + +CStdOption::CStdOption( void ) +{ + setDefault(); +} + + +CStdOption::~CStdOption( void ) +{ +} + + +void CStdOption::updateConfiguration( void ) +{ + KConfig &config = *kapp->config(); + config.setGroup("KDFConfig"); + mFileManager = config.readPathEntry( + "FileManagerCommand", mDefaultFileManager ); + mUpdateFrequency = config.readNumEntry( + "UpdateFrequency", mDefaultUpdateFrequency ); + mPopupIfFull = config.readBoolEntry( + "PopupIfFull", true ); + mOpenFileManagerOnMount = config.readBoolEntry( + "OpenFileMgrOnMount", false ); +} + + +void CStdOption::writeConfiguration( void ) +{ + KConfig &config = *kapp->config(); + config.setGroup("KDFConfig"); + config.writeEntry( "UpdateFrequency", mUpdateFrequency ); + config.writePathEntry( "FileManagerCommand", mFileManager ); + config.writeEntry( "PopupIfFull", mPopupIfFull ); + config.writeEntry( "OpenFileMgrOnMount", mOpenFileManagerOnMount ); + config.sync(); +} + + +void CStdOption::writeDefaultFileManager( void ) +{ + KConfig &config = *kapp->config(); + config.setGroup("KDFConfig"); + config.writePathEntry( "FileManagerCommand", mDefaultFileManager ); + config.sync(); +} + + + +QString CStdOption::fileManager( void ) +{ + return( mFileManager ); +} + + +int CStdOption::updateFrequency( void ) +{ + return( mUpdateFrequency ); +} + + +bool CStdOption::popupIfFull( void ) +{ + return( mPopupIfFull ); +} + + +bool CStdOption::openFileManager( void ) +{ + return( mOpenFileManagerOnMount ); +} + + +void CStdOption::setDefault( void ) +{ + mFileManager = mDefaultFileManager; + mUpdateFrequency = mDefaultUpdateFrequency; + mPopupIfFull = true; + mOpenFileManagerOnMount = false; +} + + +void CStdOption::setFileManager( const QString &fileManager ) +{ + mFileManager = fileManager; +} + + +void CStdOption::setUpdateFrequency( int frequency ) +{ + mUpdateFrequency = frequency; +} + + +void CStdOption::setPopupIfFull( bool popupIfFull ) +{ + mPopupIfFull = popupIfFull; +} + + +void CStdOption::setOpenFileManager( bool openFileManagerOnMount ) +{ + mOpenFileManagerOnMount = openFileManagerOnMount; +} + + + + + + + + + diff --git a/kdf/stdoption.h b/kdf/stdoption.h new file mode 100644 index 0000000..282a16b --- /dev/null +++ b/kdf/stdoption.h @@ -0,0 +1,72 @@ +/* +** +** Copyright (C) 1998 by Michael Kropfberger +** +*/ + +/* +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to kde-devel@kde.org +*/ +#ifndef _STD_OPTION_H_ +#define _STD_OPTION_H_ + +#include + +class CStdOption +{ + public: + CStdOption( void ); + ~CStdOption( void ); + + void updateConfiguration( void ); + void writeConfiguration( void ); + void writeDefaultFileManager( void ); + + QString fileManager( void ); + + int updateFrequency( void ); + bool popupIfFull( void ); + bool openFileManager( void ); + + void setDefault( void ); + void setFileManager( const QString &fileManager ); + void setUpdateFrequency( int frequency ); + void setPopupIfFull( bool popupIfFull ); + void setOpenFileManager( bool openFileManagerOnMount ); + + private: + static QString mDefaultFileManager; + static int mDefaultUpdateFrequency; + QString mFileManager; + int mUpdateFrequency; + bool mPopupIfFull; + bool mOpenFileManagerOnMount; +}; + +#endif + + + + + + + + + diff --git a/kdf/unix_outputs/df-g.hpux b/kdf/unix_outputs/df-g.hpux new file mode 100644 index 0000000..8d1e822 --- /dev/null +++ b/kdf/unix_outputs/df-g.hpux @@ -0,0 +1,392 @@ +/cern (lapphp0.in2p3.fr:/lapphp0_3/cern) : + 8192 file system block size 1024 fragment size + 4067219 total blocks 1381510 total free blocks + 974788 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777209 file system id nfs file system type + 0 flags -1 file system name length + /cern file system specific string +/outils/produits/frame (lapphp0.in2p3.fr:/lapphp0_3/produits/frame) : + 8192 file system block size 1024 fragment size + 4067219 total blocks 1381510 total free blocks + 974788 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777210 file system id nfs file system type + 0 flags -1 file system name length +/outils/produits/frame file system specific string +/outils/produits/rogue (lapphp0.in2p3.fr:/lapphp0_3/produits/rogue) : + 8192 file system block size 1024 fragment size + 4067219 total blocks 1381510 total free blocks + 974788 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777211 file system id nfs file system type + 0 flags -1 file system name length +/outils/produits/rogue file system specific string +/lapphp1_6 (lapphp0.in2p3.fr:/lapphp1_6) : + 8192 file system block size 1024 fragment size + 4067219 total blocks 998796 total free blocks + 592074 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777212 file system id nfs file system type + 0 flags -1 file system name length + /lapphp1_6 file system specific string +/lapphp8/mupad (lapphp8.in2p3.fr:/lapphp8/mupad) : + 8192 file system block size 1024 fragment size + 602301 total blocks 466919 total free blocks + 406688 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777213 file system id nfs file system type + 0 flags -1 file system name length + /lapphp8/mupad file system specific string +/COMMUN (lappa0:/COMMUN ) : + 8192 file system block size 512 fragment size + 45528992 total blocks 8875966 total free blocks + 8578336 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777214 file system id nfs file system type + 0 flags -1 file system name length + /COMMUN file system specific string +/nfs/virgoa1_2 (lappa0:/virgoa1_2 ) : + 8192 file system block size 1024 fragment size + 3783129 total blocks 756162 total free blocks + 377849 allocated free blocks -1 total i-nodes + -1 total free i-nodes -1 allocated free i-nodes + -16777215 file system id nfs file system type + 0 flags -1 file system name length + /nfs/virgoa1_2 file system specific string +/USERS/AMS (/dev/users_services/rio) : + 8192 file system block size 1024 fragment size + 498645 total blocks 163584 total free blocks + 113719 allocated free blocks 79872 total i-nodes + 70578 total free i-nodes 70578 allocated free i-nodes + 1074069514 file system id hfs file system type + 0 flags 255 file system name length + /USERS/AMS file system specific string +/USERS/elec (/dev/export/lvol3 ) : + 8192 file system block size 1024 fragment size + 1008204 total blocks 469459 total free blocks + 368638 allocated free blocks 118784 total i-nodes + 111661 total free i-nodes 111661 allocated free i-nodes + 1074135043 file system id hfs file system type + 0 flags 255 file system name length + /USERS/elec file system specific string +/backup/increm2 (/dev/backup/lvol4 ) : + 8192 file system block size 1024 fragment size + 3791196 total blocks 3145626 total free blocks + 2766506 allocated free blocks 444416 total i-nodes + 438557 total free i-nodes 438557 allocated free i-nodes + 1074003972 file system id hfs file system type + 0 flags 255 file system name length +/backup/increm2 file system specific string +/backup/increm3 (/dev/backup/lvol1 ) : + 8192 file system block size 1024 fragment size + 2535501 total blocks 1158823 total free blocks + 905272 allocated free blocks 184320 total i-nodes + 177347 total free i-nodes 177347 allocated free i-nodes + 1074003969 file system id hfs file system type + 0 flags 255 file system name length +/backup/increm3 file system specific string +/backup/incremental (/dev/backup/lvol2 ) : + 8192 file system block size 1024 fragment size + 4056813 total blocks 2845324 total free blocks + 2439642 allocated free blocks 294912 total i-nodes + 290399 total free i-nodes 290399 allocated free i-nodes + 1074003970 file system id hfs file system type + 0 flags 255 file system name length +/backup/incremental file system specific string +/cdrom (/dev/dsk/c1t2d0 ) : + 2048 file system block size 2048 fragment size + 1228800 total blocks 0 total free blocks + 0 allocated free blocks -1 total i-nodes + 0 total free i-nodes 0 allocated free i-nodes + 469835776 file system id cdfs file system type + 0x1 flags 37 file system name length + /cdrom file system specific string +/export/cetia (/dev/users_services/lvol9) : + 8192 file system block size 1024 fragment size + 504092 total blocks 247465 total free blocks + 197055 allocated free blocks 59392 total i-nodes + 51963 total free i-nodes 51963 allocated free i-nodes + 1074069513 file system id hfs file system type + 0 flags 255 file system name length + /export/cetia file system specific string +/export/fic (/dev/outils/lvol4 ) : + 8192 file system block size 1024 fragment size + 504092 total blocks 457204 total free blocks + 406794 allocated free blocks 59392 total i-nodes + 56723 total free i-nodes 56723 allocated free i-nodes + 1073938436 file system id hfs file system type + 0 flags 255 file system name length + /export/fic file system specific string +/export/hp (/dev/export/lvol5 ) : + 8192 file system block size 1024 fragment size + 999532 total blocks 277788 total free blocks + 177834 allocated free blocks 116736 total i-nodes + 96353 total free i-nodes 96353 allocated free i-nodes + 1074135045 file system id hfs file system type + 0 flags 255 file system name length + /export/hp file system specific string +/export/solaris (/dev/export/lvol4 ) : + 8192 file system block size 1024 fragment size + 604860 total blocks 296077 total free blocks + 235591 allocated free blocks 71680 total i-nodes + 49145 total free i-nodes 49145 allocated free i-nodes + 1074135044 file system id hfs file system type + 0 flags 255 file system name length +/export/solaris file system specific string +/export/sun (/dev/export/lvol1 ) : + 8192 file system block size 1024 fragment size + 1008204 total blocks 483024 total free blocks + 382203 allocated free blocks 118784 total i-nodes + 100998 total free i-nodes 100998 allocated free i-nodes + 1074135041 file system id hfs file system type + 0 flags 255 file system name length + /export/sun file system specific string +/export/tektro (/dev/export/lvol2 ) : + 8192 file system block size 1024 fragment size + 403308 total blocks 59710 total free blocks + 19379 allocated free blocks 47104 total i-nodes + 42499 total free i-nodes 42499 allocated free i-nodes + 1074135042 file system id hfs file system type + 0 flags 255 file system name length + /export/tektro file system specific string +/export/www (/dev/users_services/lvol8) : + 8192 file system block size 1024 fragment size + 604860 total blocks 390825 total free blocks + 330339 allocated free blocks 71680 total i-nodes + 70943 total free i-nodes 70943 allocated free i-nodes + 1074069512 file system id hfs file system type + 0 flags 255 file system name length + /export/www file system specific string +/home (/dev/vg00/lvol4 ) : + 8192 file system block size 1024 fragment size + 19861 total blocks 19851 total free blocks + 17864 allocated free blocks 3456 total i-nodes + 3451 total free i-nodes 3451 allocated free i-nodes + 1073741828 file system id hfs file system type + 0 flags 255 file system name length + /home file system specific string +/outils/adm (/dev/outils/lvol3 ) : + 8192 file system block size 1024 fragment size + 504092 total blocks 240604 total free blocks + 190194 allocated free blocks 59392 total i-nodes + 57466 total free i-nodes 57466 allocated free i-nodes + 1073938435 file system id hfs file system type + 0 flags 255 file system name length + /outils/adm file system specific string +/outils/mail (/dev/outils/lvol6 ) : + 8192 file system block size 1024 fragment size + 302284 total blocks 258286 total free blocks + 228057 allocated free blocks 36864 total i-nodes + 36724 total free i-nodes 36724 allocated free i-nodes + 1073938438 file system id hfs file system type + 0 flags 255 file system name length + /outils/mail file system specific string +/outils/newlp (/dev/vg00/newlp ) : + 8192 file system block size 1024 fragment size + 99669 total blocks 98347 total free blocks + 88380 allocated free blocks 16128 total i-nodes + 16011 total free i-nodes 16011 allocated free i-nodes + 1073741833 file system id hfs file system type + 0 flags 255 file system name length + /outils/newlp file system specific string +/outils/produits (/dev/outils/lvol1 ) : + 8192 file system block size 1024 fragment size + 1806700 total blocks 380397 total free blocks + 199727 allocated free blocks 212992 total i-nodes + 183645 total free i-nodes 183645 allocated free i-nodes + 1073938433 file system id hfs file system type + 0 flags 255 file system name length +/outils/produits file system specific string +/outils/securite (/dev/vg00/securite ) : + 8192 file system block size 1024 fragment size + 175445 total blocks 167330 total free blocks + 149785 allocated free blocks 28416 total i-nodes + 28178 total free i-nodes 28178 allocated free i-nodes + 1073741834 file system id hfs file system type + 0 flags 255 file system name length +/outils/securite file system specific string +/outils/swap (/dev/outils/lvol5 ) : + 8192 file system block size 1024 fragment size + 504092 total blocks 349880 total free blocks + 299470 allocated free blocks 59392 total i-nodes + 59312 total free i-nodes 59312 allocated free i-nodes + 1073938437 file system id hfs file system type + 0 flags 255 file system name length + /outils/swap file system specific string +/outils/tmp (/dev/outils/lvol2 ) : + 8192 file system block size 1024 fragment size + 504092 total blocks 259369 total free blocks + 208959 allocated free blocks 59392 total i-nodes + 57081 total free i-nodes 57081 allocated free i-nodes + 1073938434 file system id hfs file system type + 0 flags 255 file system name length + /outils/tmp file system specific string +/tmp (/dev/vg00/lvol6 ) : + 8192 file system block size 1024 fragment size + 23013 total blocks 13120 total free blocks + 10818 allocated free blocks 10880 total i-nodes + 10456 total free i-nodes 10456 allocated free i-nodes + 1073741830 file system id hfs file system type + 0 flags 255 file system name length + /tmp file system specific string +/users/admin (/dev/users_services/lvol5) : + 8192 file system block size 1024 fragment size + 302284 total blocks 202293 total free blocks + 172064 allocated free blocks 36864 total i-nodes + 34848 total free i-nodes 34848 allocated free i-nodes + 1074069509 file system id hfs file system type + 0 flags 255 file system name length + /users/admin file system specific string +/users/aleph (/dev/users_manip/lvol9) : + 8192 file system block size 1024 fragment size + 403308 total blocks 42599 total free blocks + 2268 allocated free blocks 47104 total i-nodes + 46495 total free i-nodes 46495 allocated free i-nodes + 1073872905 file system id hfs file system type + 0 flags 255 file system name length + /users/aleph file system specific string +/users/atlas (/dev/users_manip/lvol8) : + 8192 file system block size 1024 fragment size + 403308 total blocks 173249 total free blocks + 132918 allocated free blocks 47104 total i-nodes + 45153 total free i-nodes 45153 allocated free i-nodes + 1073872904 file system id hfs file system type + 0 flags 255 file system name length + /users/atlas file system specific string +/users/autres (/dev/users_manip/lvol6) : + 8192 file system block size 1024 fragment size + 403308 total blocks 65799 total free blocks + 25468 allocated free blocks 47104 total i-nodes + 43062 total free i-nodes 43062 allocated free i-nodes + 1073872902 file system id hfs file system type + 0 flags 255 file system name length + /users/autres file system specific string +/users/backup (/dev/backup/lvol3 ) : + 8192 file system block size 1024 fragment size + 2535501 total blocks 242538 total free blocks + 0 allocated free blocks 184320 total i-nodes + 182966 total free i-nodes 182966 allocated free i-nodes + 1074003971 file system id hfs file system type + 0 flags 255 file system name length + /users/backup file system specific string +/users/calcul (/dev/users_services/lvol4) : + 8192 file system block size 1024 fragment size + 2016620 total blocks 538692 total free blocks + 337030 allocated free blocks 235520 total i-nodes + 205815 total free i-nodes 205815 allocated free i-nodes + 1074069508 file system id hfs file system type + 0 flags 255 file system name length + /users/calcul file system specific string +/users/chooz (/dev/users_manip/lvol10) : + 8192 file system block size 1024 fragment size + 403308 total blocks 114724 total free blocks + 74393 allocated free blocks 47104 total i-nodes + 40686 total free i-nodes 40686 allocated free i-nodes + 1073872906 file system id hfs file system type + 0 flags 255 file system name length + /users/chooz file system specific string +/users/cms (/dev/users_manip/lvol3) : + 8192 file system block size 1024 fragment size + 798476 total blocks 284186 total free blocks + 204338 allocated free blocks 94208 total i-nodes + 78569 total free i-nodes 78569 allocated free i-nodes + 1073872899 file system id hfs file system type + 0 flags 255 file system name length + /users/cms file system specific string +/users/ftp (/dev/users_services/lvol3) : + 8192 file system block size 1024 fragment size + 201516 total blocks 70339 total free blocks + 50187 allocated free blocks 24576 total i-nodes + 24019 total free i-nodes 24019 allocated free i-nodes + 1074069507 file system id hfs file system type + 0 flags 255 file system name length + /users/ftp file system specific string +/users/l3 (/dev/users_manip/lvol2) : + 8192 file system block size 1024 fragment size + 201516 total blocks 201097 total free blocks + 180945 allocated free blocks 24576 total i-nodes + 24533 total free i-nodes 24533 allocated free i-nodes + 1073872898 file system id hfs file system type + 0 flags 255 file system name length + /users/l3 file system specific string +/users/mecanique (/dev/users_services/lvol7) : + 8192 file system block size 1024 fragment size + 403308 total blocks 352849 total free blocks + 312518 allocated free blocks 47104 total i-nodes + 44704 total free i-nodes 44704 allocated free i-nodes + 1074069511 file system id hfs file system type + 0 flags 255 file system name length +/users/mecanique file system specific string +/users/na50 (/dev/users_manip/lvol1) : + 8192 file system block size 1024 fragment size + 302284 total blocks 44997 total free blocks + 14768 allocated free blocks 36864 total i-nodes + 34548 total free i-nodes 34548 allocated free i-nodes + 1073872897 file system id hfs file system type + 0 flags 255 file system name length + /users/na50 file system specific string +/users/nomad (/dev/users_manip/lvol4) : + 8192 file system block size 1024 fragment size + 403308 total blocks 49910 total free blocks + 9579 allocated free blocks 47104 total i-nodes + 36509 total free i-nodes 36509 allocated free i-nodes + 1073872900 file system id hfs file system type + 0 flags 255 file system name length + /users/nomad file system specific string +/users/ovw (/dev/users_services/OVW) : + 8192 file system block size 1024 fragment size + 600571 total blocks 587212 total free blocks + 527154 allocated free blocks 95680 total i-nodes + 95584 total free i-nodes 95584 allocated free i-nodes + 1074069506 file system id hfs file system type + 0 flags 255 file system name length + /users/ovw file system specific string +/users/swap (/dev/users_services/lvol1) : + 8192 file system block size 1024 fragment size + 604860 total blocks 604851 total free blocks + 544365 allocated free blocks 71680 total i-nodes + 71676 total free i-nodes 71676 allocated free i-nodes + 1074069505 file system id hfs file system type + 0 flags 255 file system name length + /users/swap file system specific string +/users/theorie (/dev/users_manip/lvol5) : + 8192 file system block size 1024 fragment size + 403308 total blocks 338520 total free blocks + 298189 allocated free blocks 47104 total i-nodes + 45098 total free i-nodes 45098 allocated free i-nodes + 1073872901 file system id hfs file system type + 0 flags 255 file system name length + /users/theorie file system specific string +/users/virgo (/dev/users_manip/lvol7) : + 8192 file system block size 1024 fragment size + 403308 total blocks 48737 total free blocks + 8406 allocated free blocks 47104 total i-nodes + 45583 total free i-nodes 45583 allocated free i-nodes + 1073872903 file system id hfs file system type + 0 flags 255 file system name length + /users/virgo file system specific string +/usr (/dev/vg00/lvol7 ) : + 8192 file system block size 1024 fragment size + 299157 total blocks 42849 total free blocks + 12933 allocated free blocks 48000 total i-nodes + 32334 total free i-nodes 32334 allocated free i-nodes + 1073741831 file system id hfs file system type + 0 flags 255 file system name length + /usr file system specific string +/var (/dev/vg00/lvol8 ) : + 8192 file system block size 1024 fragment size + 69125 total blocks 35338 total free blocks + 28425 allocated free blocks 32640 total i-nodes + 31684 total free i-nodes 31684 allocated free i-nodes + 1073741832 file system id hfs file system type + 0 flags 255 file system name length + /var file system specific string +/ (/dev/vg00/lvol1 ) : + 8192 file system block size 1024 fragment size + 59797 total blocks 22524 total free blocks + 16544 allocated free blocks 9600 total i-nodes + 7301 total free i-nodes 7301 allocated free i-nodes + 1073741825 file system id hfs file system type + 0 flags 255 file system name length + / file system specific string diff --git a/kdf/unix_outputs/df-k.digital b/kdf/unix_outputs/df-k.digital new file mode 100644 index 0000000..ae61ca5 --- /dev/null +++ b/kdf/unix_outputs/df-k.digital @@ -0,0 +1,42 @@ +Filesystem 1024-blocks Used Available Capacity Mounted on +root_domain#root 265536 92583 159784 37% / +/proc 0 0 0 100% /proc +usr_domain#usr 1996712 553180 1424016 28% /usr +var_domain#var 1796712 74125 1714456 5% /var +/dev/rz17a 969738 115812 756952 14% /afscache +user_domain#calcul 1066986 626663 440323 59% /users/calcul +user_domain#atlas 444577 418063 26514 95% /users/atlas +user_domain#mecanique 444577 47918 396659 11% /users/mecanique +user_domain#elec 533493 527901 5592 99% /users/elec +user_domain#ams 889155 749420 139735 85% /users/ams +user_domain#theorie 1600479 1109849 490630 70% /users/theorie +data_domain#calcul 1043416 10376 1033040 1% /data/calcul +data_domain#elec 1043415 144 1043271 1% /data/elec +data_domain#admin 521707 24 521683 1% /data/admin +data_domain#l3 521707 331546 190161 64% /data/l3 +data_domain#theorie 2608538 1558632 1049906 60% /data/theorie +data_domain#atlas 1043415 825608 217807 80% /data/atlas +data_domain#virgo 1043415 32 1043383 1% /data/virgo +data_domain#aleph 1565123 72119 1493004 5% /data/aleph +data_domain#na50 521707 16 521691 1% /data/na50 +data_domain#babar 1043415 24 1043391 1% /data/babar +data_domain#cms 1043415 32 1043383 1% /data/cms +data_domain#ams 2086830 1016564 1070266 49% /data/ams +data_domain#nomad 1043415 32 1043383 1% /data/nomad +user_domain#l3 444577 116017 328560 27% /users/l3 +user_domain#aleph 444577 9672 434905 3% /users/aleph +user_domain#na50 444577 16 444561 1% /users/na50 +user_domain#babar 444577 6561 438016 2% /users/babar +user_domain#cms 444577 5902 438675 2% /users/cms +user_domain#nomad 444577 13956 430621 4% /users/nomad +user_domain#admin 444577 3294 441283 1% /users/admin +data_domain#mecanique 521707 42026 479681 9% /data/mecanique +user_domain#virgo 444577 58 444519 1% /users/virgo +user_domain#autres 444577 857 443720 1% /users/autres +data_domain#autres 521707 17216 504491 4% /data/autres +/COMMUN@lappa0 22764496 18302140 4313416 81% /COMMUN +/opt@lappa0 6245280 4713319 1392480 78% /opt +/var/spool/mail@lappa0 2653928 1201276 1415072 46% /var/spool/mail +/virgoa1_3@lappa0 8574909 7165973 551445 93% /virgoa1_3 +/lappa6_2@lappa0 8598343 4844545 2893963 63% /lappa6_2 +AFS 2000000 0 2000000 0% /afs diff --git a/kdf/unix_outputs/df-k.hpux b/kdf/unix_outputs/df-k.hpux new file mode 100644 index 0000000..3e9a386 --- /dev/null +++ b/kdf/unix_outputs/df-k.hpux @@ -0,0 +1,196 @@ +/cern (lapphp0.in2p3.fr:/lapphp0_3/cern) : 3660497 total allocated Kb + 974788 free allocated Kb + 2685709 used allocated Kb + 73 % allocation used +/outils/produits/frame (lapphp0.in2p3.fr:/lapphp0_3/produits/frame) : 3660497 total allocated Kb + 974788 free allocated Kb + 2685709 used allocated Kb + 73 % allocation used +/outils/produits/rogue (lapphp0.in2p3.fr:/lapphp0_3/produits/rogue) : 3660497 total allocated Kb + 974788 free allocated Kb + 2685709 used allocated Kb + 73 % allocation used +/lapphp1_6 (lapphp0.in2p3.fr:/lapphp1_6) : 3660497 total allocated Kb + 592074 free allocated Kb + 3068423 used allocated Kb + 83 % allocation used +/lapphp8/mupad (lapphp8.in2p3.fr:/lapphp8/mupad) : 542070 total allocated Kb + 406688 free allocated Kb + 135382 used allocated Kb + 24 % allocation used +/COMMUN (lappa0:/COMMUN ) : 0 total allocated Kb + 0 free allocated Kb + 0 used allocated Kb + 81 % allocation used +/nfs/virgoa1_2 (lappa0:/virgoa1_2 ) : 3404816 total allocated Kb + 377849 free allocated Kb + 3026967 used allocated Kb + 88 % allocation used +/USERS/AMS (/dev/users_services/rio) : 448780 total allocated Kb + 113719 free allocated Kb + 335061 used allocated Kb + 74 % allocation used +/USERS/elec (/dev/export/lvol3 ) : 907383 total allocated Kb + 368658 free allocated Kb + 538725 used allocated Kb + 59 % allocation used +/backup/increm2 (/dev/backup/lvol4 ) : 3412076 total allocated Kb + 2766506 free allocated Kb + 645570 used allocated Kb + 18 % allocation used +/backup/increm3 (/dev/backup/lvol1 ) : 2281950 total allocated Kb + 905272 free allocated Kb + 1376678 used allocated Kb + 60 % allocation used +/backup/incremental (/dev/backup/lvol2 ) : 3651131 total allocated Kb + 2439642 free allocated Kb + 1211489 used allocated Kb + 33 % allocation used +/cdrom (/dev/dsk/c1t2d0 ) : 2457600 total allocated Kb + 0 free allocated Kb + 2457600 used allocated Kb + 100 % allocation used +/export/cetia (/dev/users_services/lvol9) : 453682 total allocated Kb + 197055 free allocated Kb + 256627 used allocated Kb + 56 % allocation used +/export/fic (/dev/outils/lvol4 ) : 453682 total allocated Kb + 406794 free allocated Kb + 46888 used allocated Kb + 10 % allocation used +/export/hp (/dev/export/lvol5 ) : 899578 total allocated Kb + 177834 free allocated Kb + 721744 used allocated Kb + 80 % allocation used +/export/solaris (/dev/export/lvol4 ) : 544374 total allocated Kb + 235591 free allocated Kb + 308783 used allocated Kb + 56 % allocation used +/export/sun (/dev/export/lvol1 ) : 907383 total allocated Kb + 382203 free allocated Kb + 525180 used allocated Kb + 57 % allocation used +/export/tektro (/dev/export/lvol2 ) : 362977 total allocated Kb + 19379 free allocated Kb + 343598 used allocated Kb + 94 % allocation used +/export/www (/dev/users_services/lvol8) : 544374 total allocated Kb + 330339 free allocated Kb + 214035 used allocated Kb + 39 % allocation used +/home (/dev/vg00/lvol4 ) : 17874 total allocated Kb + 17864 free allocated Kb + 10 used allocated Kb + 0 % allocation used +/outils/adm (/dev/outils/lvol3 ) : 453682 total allocated Kb + 190194 free allocated Kb + 263488 used allocated Kb + 58 % allocation used +/outils/mail (/dev/outils/lvol6 ) : 272055 total allocated Kb + 228067 free allocated Kb + 43988 used allocated Kb + 16 % allocation used +/outils/newlp (/dev/vg00/newlp ) : 89702 total allocated Kb + 88381 free allocated Kb + 1321 used allocated Kb + 1 % allocation used +/outils/produits (/dev/outils/lvol1 ) : 1626030 total allocated Kb + 199727 free allocated Kb + 1426303 used allocated Kb + 87 % allocation used +/outils/securite (/dev/vg00/securite ) : 157900 total allocated Kb + 149785 free allocated Kb + 8115 used allocated Kb + 5 % allocation used +/outils/swap (/dev/outils/lvol5 ) : 453682 total allocated Kb + 309750 free allocated Kb + 143932 used allocated Kb + 31 % allocation used +/outils/tmp (/dev/outils/lvol2 ) : 453682 total allocated Kb + 208958 free allocated Kb + 244724 used allocated Kb + 53 % allocation used +/tmp (/dev/vg00/lvol6 ) : 20711 total allocated Kb + 10970 free allocated Kb + 9741 used allocated Kb + 47 % allocation used +/users/admin (/dev/users_services/lvol5) : 272055 total allocated Kb + 172064 free allocated Kb + 99991 used allocated Kb + 36 % allocation used +/users/aleph (/dev/users_manip/lvol9) : 362977 total allocated Kb + 2268 free allocated Kb + 360709 used allocated Kb + 99 % allocation used +/users/atlas (/dev/users_manip/lvol8) : 362977 total allocated Kb + 132918 free allocated Kb + 230059 used allocated Kb + 63 % allocation used +/users/autres (/dev/users_manip/lvol6) : 362977 total allocated Kb + 25468 free allocated Kb + 337509 used allocated Kb + 92 % allocation used +/users/backup (/dev/backup/lvol3 ) : 2292963 total allocated Kb + 0 free allocated Kb + 2292963 used allocated Kb + 100 % allocation used +/users/calcul (/dev/users_services/lvol4) : 1814958 total allocated Kb + 337030 free allocated Kb + 1477928 used allocated Kb + 81 % allocation used +/users/chooz (/dev/users_manip/lvol10) : 362977 total allocated Kb + 74394 free allocated Kb + 288583 used allocated Kb + 79 % allocation used +/users/cms (/dev/users_manip/lvol3) : 718628 total allocated Kb + 204338 free allocated Kb + 514290 used allocated Kb + 71 % allocation used +/users/ftp (/dev/users_services/lvol3) : 181364 total allocated Kb + 50187 free allocated Kb + 131177 used allocated Kb + 72 % allocation used +/users/l3 (/dev/users_manip/lvol2) : 181364 total allocated Kb + 180945 free allocated Kb + 419 used allocated Kb + 0 % allocation used +/users/mecanique (/dev/users_services/lvol7) : 362977 total allocated Kb + 312518 free allocated Kb + 50459 used allocated Kb + 13 % allocation used +/users/na50 (/dev/users_manip/lvol1) : 272055 total allocated Kb + 14768 free allocated Kb + 257287 used allocated Kb + 94 % allocation used +/users/nomad (/dev/users_manip/lvol4) : 362977 total allocated Kb + 9579 free allocated Kb + 353398 used allocated Kb + 97 % allocation used +/users/ovw (/dev/users_services/OVW) : 540513 total allocated Kb + 527154 free allocated Kb + 13359 used allocated Kb + 2 % allocation used +/users/swap (/dev/users_services/lvol1) : 544374 total allocated Kb + 544365 free allocated Kb + 9 used allocated Kb + 0 % allocation used +/users/theorie (/dev/users_manip/lvol5) : 362977 total allocated Kb + 298189 free allocated Kb + 64788 used allocated Kb + 17 % allocation used +/users/virgo (/dev/users_manip/lvol7) : 362977 total allocated Kb + 8406 free allocated Kb + 354571 used allocated Kb + 97 % allocation used +/usr (/dev/vg00/lvol7 ) : 269241 total allocated Kb + 12933 free allocated Kb + 256308 used allocated Kb + 95 % allocation used +/var (/dev/vg00/lvol8 ) : 62212 total allocated Kb + 28427 free allocated Kb + 33785 used allocated Kb + 54 % allocation used +/ (/dev/vg00/lvol1 ) : 53817 total allocated Kb + 16544 free allocated Kb + 37273 used allocated Kb + 69 % allocation used diff --git a/kdf/unix_outputs/df.man.hpux b/kdf/unix_outputs/df.man.hpux new file mode 100644 index 0000000..969320d --- /dev/null +++ b/kdf/unix_outputs/df.man.hpux @@ -0,0 +1,198 @@ + + + + df(1M) df(1M) + + + + + NAME + df (generic) - report number of free file system disk blocks + + SYNOPSIS + /usr/bin/df [-F FStype] [-befgiklnv] [-t|-P] [-o specific_options] [-V] + [special|directory]... + + DESCRIPTION + The df command displays the number of free 512-byte blocks and free + inodes available for file systems by examining the counts kept in the + superblock or superblocks. If a special or a directory is not + specified, the free space on all mounted file systems is displayed. + If the arguments to df are path names, df reports on the file systems + containing the named files. If the argument to df is a special of an + unmounted file system, the free space in the unmounted file system is + displayed. + + Options + df recognizes the following options: + + -b Report only the number of kilobytes (KB) free. + + -e Report the number of files free. + + -f Report only the actual count of the blocks in the + free list (free inodes are not reported). + + -F FStype Report only on the FStype file system type (see + fstyp(1M)). + + -g Report the entire structure described in + statvfs(2). + + -i Report the total number of inodes, the number of + free inodes, number of used inodes, and the + percentage of inodes in use. + + -k Report the allocation in kilobytes (KB). + + -l Report on local file systems only. + + -n Report the file system name. If used with no + other options, display a list of mounted file + system types. + + -o specific_options + Specify options specific to each file system type. + specific_options is a comma-separated list of + suboptions intended for a specific FStype module + of the command. See the file-system-specific + manual entries for further details. + + + + Hewlett-Packard Company - 1 - HP-UX Release 10.10: November 1995 + + + + + + + df(1M) df(1M) + + + + + -P Report the name of the file system, the size of + the file system, the number of blocks used, the + number of blocks free, the percentage of blocks + used and the directory below which the file system + hierarchy appears. + + -t Report the total allocated block figures and the + number of free blocks. + + -v Report the percentage of blocks used, the number + of blocks used, and the number of blocks free. + This option cannot be used with other options. + + -V Echo the completed command line, but perform no + other action. The command line is generated by + incorporating the user-specified options and other + information derived from /etc/fstab. This option + allows the user to verify the command line. + + EXTERNAL INFLUENCES + Environment Variables + LC_MESSAGES determines the language in which messages are displayed. + + If LC_MESSAGES is not specified in the environment or is set to the + empty string, the value of LANG is used as a default for each + unspecified or empty variable. If LANG is not specified or is set to + the empty string, a default of "C" (see lang(5)) is used instead of + LANG. + + If any internationalization variable contains an invalid setting, df + behaves as if all internationalization variables are set to "C". See + environ(5). + + International Code Set Support + Single-byte and multi-byte character code sets are supported. + + EXAMPLES + Report the number of free disk blocks for all mounted file systems: + + df + + Report the number of free disk blocks for all mounted HFS file + systems: + + df -F hfs + + Report the number of free files for all mounted NFS file systems: + + df -F nfs -e + + + + + + Hewlett-Packard Company - 2 - HP-UX Release 10.10: November 1995 + + + + + + + df(1M) df(1M) + + + + + Report the total allocated block figures and the number of free + blocks, for all mounted file systems: + + df -t + + Report the total allocated block figures and the number of free + blocks, for the file system mounted as /usr: + + df -t /usr + + FILES + /dev/dsk/* File system devices + /etc/fstab Static information about the file systems + /etc/mnttab Mounted file system table + SEE ALSO + du(1), df_FStype(1M), fsck(1M), fstab(4), fstyp(1M), statvfs(2), + mnttab(4). + STANDARDS CONFORMANCE + df: SVID2, SVID3, XPG2, XPG3, XPG4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hewlett-Packard Company - 3 - HP-UX Release 10.10: November 1995 + + + diff --git a/kdf/unix_outputs/etcfstab.digital b/kdf/unix_outputs/etcfstab.digital new file mode 100644 index 0000000..1bfcc0e --- /dev/null +++ b/kdf/unix_outputs/etcfstab.digital @@ -0,0 +1,43 @@ +root_domain#root / advfs rw 0 0 +/proc /proc procfs rw 0 0 +usr_domain#usr /usr advfs rw 0 0 +var_domain#var /var advfs rw 0 0 +/dev/rz16b swap1 ufs sw 0 2 +/dev/rz14a swap2 ufs sw 0 2 +/dev/rz17a /afscache ufs rw 1 2 +/COMMUN@lappa0 /COMMUN nfs rw,bg 0 0 +/opt@lappa0 /opt nfs rw,bg 0 0 +/var/spool/mail@lappa0 /var/spool/mail nfs rw,bg 0 0 +/w3@lappa0 /w3 nfs rw,bg 0 0 +/virgoa1_3@lappa0 /virgoa1_3 nfs rw,bg 0 0 +/lappa6_2@lappa0 /lappa6_2 nfs rw,bg 0 0 +user_domain#calcul /users/calcul advfs rw,userquota,groupquota 0 2 +user_domain#atlas /users/atlas advfs rw,userquota,groupquota 0 2 +user_domain#mecanique /users/mecanique advfs rw,userquota,groupquota 0 2 +user_domain#elec /users/elec advfs rw,userquota,groupquota 0 2 +user_domain#ams /users/ams advfs rw,userquota,groupquota 0 2 +user_domain#theorie /users/theorie advfs rw,userquota,groupquota 0 2 +data_domain#calcul /data/calcul advfs rw,userquota,groupquota 0 2 +data_domain#elec /data/elec advfs rw,userquota,groupquota 0 2 +data_domain#admin /data/admin advfs rw,userquota,groupquota 0 2 +data_domain#l3 /data/l3 advfs rw,userquota,groupquota 0 2 +data_domain#theorie /data/theorie advfs rw,userquota,groupquota 0 2 +data_domain#atlas /data/atlas advfs rw,userquota,groupquota 0 2 +data_domain#virgo /data/virgo advfs rw,userquota,groupquota 0 2 +data_domain#aleph /data/aleph advfs rw,userquota,groupquota 0 2 +data_domain#na50 /data/na50 advfs rw,userquota,groupquota 0 2 +data_domain#babar /data/babar advfs rw,userquota,groupquota 0 2 +data_domain#cms /data/cms advfs rw,userquota,groupquota 0 2 +data_domain#ams /data/ams advfs rw,userquota,groupquota 0 2 +data_domain#nomad /data/nomad advfs rw,userquota,groupquota 0 2 +user_domain#l3 /users/l3 advfs rw,userquota,groupquota 0 2 +user_domain#aleph /users/aleph advfs rw,userquota,groupquota 0 2 +user_domain#na50 /users/na50 advfs rw,userquota,groupquota 0 2 +user_domain#babar /users/babar advfs rw,userquota,groupquota 0 2 +user_domain#cms /users/cms advfs rw,userquota,groupquota 0 2 +user_domain#nomad /users/nomad advfs rw,userquota,groupquota 0 2 +user_domain#admin /users/admin advfs rw,userquota,groupquota 0 2 +data_domain#mecanique /data/mecanique advfs rw,userquota,groupquota 0 2 +user_domain#virgo /users/virgo advfs rw,userquota,groupquota 0 2 +user_domain#autres /users/autres advfs rw,userquota,groupquota 0 2 +data_domain#autres /data/autres advfs rw,userquota,groupquota 0 2 diff --git a/kdf/unix_outputs/etcfstab.hpux b/kdf/unix_outputs/etcfstab.hpux new file mode 100644 index 0000000..af333b1 --- /dev/null +++ b/kdf/unix_outputs/etcfstab.hpux @@ -0,0 +1,75 @@ +/dev/vg00/lvol1 / hfs defaults 0 1 +/dev/vg00/lvol3 ... swap defaults 0 0 +/dev/vg00/lvol4 /home hfs defaults 0 2 +/dev/vg00/lvol6 /tmp hfs defaults 0 2 +/dev/vg00/lvol7 /usr hfs defaults 0 2 +/dev/vg00/lvol8 /var hfs defaults 0 2 +/dev/vg00/newlp /outils/newlp hfs rw,suid 0 2 +# +/dev/export/lvol1 /export/sun hfs rw,suid 0 2 +/dev/export/lvol2 /export/tektro hfs rw,suid 0 2 +/dev/export/lvol3 /USERS/elec hfs rw,suid 0 2 +/dev/export/lvol4 /export/solaris hfs rw,suid 0 2 +/dev/export/lvol5 /export/hp hfs rw,suid 0 2 +# +/dev/users_manip/lvol1 /users/na50 hfs rw,suid 0 2 +/dev/users_manip/lvol2 /users/l3 hfs rw,suid 0 2 +/dev/users_manip/lvol3 /users/cms hfs rw,suid 0 2 +/dev/users_manip/lvol4 /users/nomad hfs rw,suid 0 2 +/dev/users_manip/lvol5 /users/theorie hfs rw,suid 0 2 +/dev/users_manip/lvol6 /users/autres hfs rw,suid 0 2 +/dev/users_manip/lvol7 /users/virgo hfs rw,suid 0 2 +/dev/users_manip/lvol8 /users/atlas hfs rw,suid 0 2 +/dev/users_manip/lvol9 /users/aleph hfs rw,suid 0 2 +/dev/users_manip/lvol10 /users/chooz hfs rw,suid 0 2 +# +/dev/users_services/lvol1 /users/swap hfs rw,suid 0 2 +/dev/users_services/lvol3 /users/ftp hfs rw,suid 0 2 +/dev/users_services/lvol4 /users/calcul hfs rw,suid 0 2 +/dev/users_services/lvol5 /users/admin hfs rw,suid 0 2 +/dev/users_services/lvol7 /users/mecanique hfs rw,suid 0 2 +/dev/users_services/lvol8 /export/www hfs rw,suid 0 2 +/dev/users_services/lvol9 /export/cetia hfs rw,suid 0 2 +/dev/users_services/rio /USERS/AMS hfs rw,suid 0 2 +/dev/users_services/OVW /users/ovw hfs rw,suid 0 2 +# +/dev/outils/lvol1 /outils/produits hfs rw,suid 0 2 +/dev/outils/lvol2 /outils/tmp hfs rw,suid 0 2 +/dev/outils/lvol3 /outils/adm hfs rw,suid 0 2 +/dev/outils/lvol4 /export/fic hfs rw,suid 0 2 +/dev/outils/lvol5 /outils/swap hfs rw,suid 0 2 +/dev/outils/lvol5 /outils/swap swapfs min=12800,lim=38400,pri=1 0 2 +/dev/outils/lvol6 /outils/mail hfs rw,suid 0 2 +# +/dev/backup/lvol1 /backup/increm3 hfs rw,suid 0 2 +/dev/backup/lvol2 /backup/incremental hfs rw,suid 0 2 +/dev/backup/lvol3 /users/backup hfs rw,suid 0 2 +/dev/backup/lvol4 /backup/increm2 hfs rw,suid 0 2 +# +#---------------------------------------------------- +# le CDROM est toujours a part +#------------------------------------------- +/dev/dsk/c1t2d0 /cdrom cdfs ro,suid 0 2 +# +#----------------------------------- +# rondelles NFS +#--------------------------------------------------- +# lapphp0 +lapphp0.in2p3.fr:/lapphp0_3/cern /cern nfs rw,suid,bg 0 0 +lapphp0.in2p3.fr:/lapphp0_3/produits/frame /outils/produits/frame nfs rw,suid,bg 0 0 +lapphp0.in2p3.fr:/lapphp0_3/produits/rogue /outils/produits/rogue nfs rw,suid,bg 0 0 +lapphp0.in2p3.fr:/lapphp1_6 /lapphp1_6 nfs rw,suid,bg 0 0 +#lapphp0.in2p3.fr:/lapphp0_2/local /usr/local.hp0 nfs rw,suid,bg 0 0 +# pour Alain Bazan (5/01/98) +#lapphp0.in2p3.fr:/usr/lib/X11R6 /usr/lib/X11R6 nfs rw,suid,bg 0 0 +#lapphp0.in2p3.fr:/usr/lib/Motif1.2_R6 /usr/lib/Motif1.2_R6 nfs rw,suid,bg 0 0 + +# rondelles lapphp8 : produits logiciels a deplacer sur lapphp0 +# pour eviter les NFS croises +lapphp8.in2p3.fr:/lapphp8/mupad /lapphp8/mupad nfs rw,suid,bg 0 0 +lapphp8.in2p3.fr:/lapphp8/maple /lapphp8/maple nfs rw,suid,bg 0 0 + +# lappa0 +lappa0:/COMMUN /COMMUN nfs rw,suid,bg 0 0 +lappa0:/virgoa1_2 /nfs/virgoa1_2 nfs rw,suid,bg 0 0 +/dev/vg00/securite /outils/securite hfs rw,suid 0 2 diff --git a/kdf/unix_outputs/unix-defines.txt b/kdf/unix_outputs/unix-defines.txt new file mode 100644 index 0000000..75a2846 --- /dev/null +++ b/kdf/unix_outputs/unix-defines.txt @@ -0,0 +1,125 @@ +What about using builtin symbols defined by the compiler (gcc) +itself. For example on Alpha I have : + +lappa{bussat}(74) echo 'main(){printf("hello world\n";}' |gcc -E -v - +Reading specs from /usr/local/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.3/specs +gcc version 2.7.2.3 + /usr/local/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.3/cpp -lang-c -v -undef +-D__GNUC__=2 -D__GNUC_MINOR__=7 -Dunix -D__osf__ -D__alpha -D__alpha__ +-D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__ -D__osf__ -D__alpha +-D__alpha__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix +-D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) +-Amachine(alpha) -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C - +GNU CPP version 2.7.2.3 +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + /usr/local/alpha-dec-osf4.0/include + /usr/local/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.3/include + /usr/include +End of search list. +# 1 "" +main(){printf("hello world\n";} + +On HP, this becomes : +bussat [21] echo 'main(){printf("hello world\n";}' |gcc -E -v - +Reading specs from +/opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.10/2.7.2.2/specs +gcc version 2.7.2.2 + /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.10/2.7.2.2/cpp -lang-c -v -undef +-D__GNUC__=2 -D__GNUC_MINOR__=7 -Dhppa -Dhp9000s800 -D__hp9000s800 +-Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ +-D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ +-D_HPUX_SOURCE -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux +-D__unix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa) +-D__hp9000s700 -D_PA_RISC1_1 - +GNU CPP version 2.7.2.2 (hppa) +#include "..." search starts here: +#include <...> search starts here: + /opt/gcc/include + /opt/gcc/hppa1.1-hp-hpux10.10/include + /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.10/2.7.2.2/include + /usr/include +End of search list. +# 1 "" +main(){printf("hello world +";} + +On Sun Solaris2.5 I found +lappsun8{bussat}[1]: echo 'main(){printf("hello world\n";}' |gcc -E -v - +Reading specs from +/opt/FSFgcc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/specs +gcc version 2.7.2 + /opt/FSFgcc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/cpp -lang-c -v +-undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dsun -Dsparc -Dunix -D__svr4__ +-D__SVR4 -D__GCC_NEW_VARARGS__ -D__sun__ -D__sparc__ -D__unix__ +-D__svr4__ -D__SVR4 -D__GCC_NEW_VARARGS__ -D__sun -D__sparc -D__unix +-Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc) - +GNU CPP version 2.7.2 (sparc) +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + /opt/FSFgcc/sparc-sun-solaris2.5/include + /opt/FSFgcc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/include + /usr/include +End of search list. +# 1 "" +main(){printf("hello world +";} + +Finally, on Sun with SunOS4.1 the results are : +lappsun1{bussat}[1]: echo 'main(){printf("hello world\n";}' |gcc -E -v +- +Reading specs from +/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.6.0/specs +gcc version 2.6.0 + /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.6.0/cpp -lang-c -v +-undef -D__GNUC__=2 -D__GNUC_MINOR__=6 -Dsparc -Dsun -Dunix +-D__GCC_NEW_VARARGS__ -D__sparc__ -D__sun__ -D__unix__ +-D__GCC_NEW_VARARGS__ -D__sparc -D__sun -D__unix -Asystem(unix) +-Asystem(bsd) -Acpu(sparc) -Amachine(sparc) - +GNU CPP version 2.6.0 (sparc) +#include "..." search starts here: +#include <...> search starts here: + /usr/local/include + /usr/local/sparc-sun-sunos4.1.3_U1/include + /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3_U1/2.6.0/include + /usr/include +End of search list. +# 1 "" +main(){printf("hello world +";} + +on a Linux box there is: +mike@kermit:/home/mike > echo 'main(){printf("hello world\n";}' |gcc -E -v - +Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.1/specs +gcc version 2.7.2.1 + /usr/lib/gcc-lib/i486-linux/2.7.2.1/cpp -lang-c -v -undef -D__GNUC__=2 +-D__GNUC_MINOR__=7 -D__ELF__ -Dunix -Di386 -Dlinux -D__ELF__ -D__unix__ +-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) +-Asystem(posix) -Acpu(i386) -Amachine(i386) -D__i486__ - GNU CPP version +2.7.2.1 (i386 Linux/ELF) #include "..." search starts here: #include <...> +search starts here: /usr/local/include + /usr/i486-linux/include + /usr/lib/gcc-lib/i486-linux/2.7.2.1/include + /usr/include +End of search list. +# 1 "" +main(){printf("hello world\n";} + +on digital UNIX V3.2D-1 there is +mkropfbe@edusrv(1)$ echo 'main(){printf("hello world\n";}' |gcc -E -v - +Reading specs from /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/specs +gcc version 2.7.2 + /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/cpp -lang-c -v -undef +-D__GNUC__=2 -D__GNUC_MINOR__=7 -Dunix -D__osf__ -D__alpha -D__alpha__ +-D_LONGLONG -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__unix__ -D__osf__ -D__alpha +-D__alpha__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix +-D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) -Amachine(alpha) +-D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C - GNU CPP version 2.7.2 #include +"..." search starts here: #include <...> search starts here: +/usr/local/include /usr/local/alpha-dec-osf3.2/include +/usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/include /usr/include +End of search list. +# 1 "" +main(){printf("hello world\n";} -- cgit v1.2.1