Commit ac77731a authored by Max Howell's avatar Max Howell

Simplify df reading code significantly

Add KURL drag and drop
Add click center to go up directory
Refactor TODO

svn path=/trunk/extragear/utils/filelight/; revision=574070
parent dcfdfcdd
1.0
Added copy to clipboard function to segment context menus
Accepts URLs from drag and drop
Click central circle to go "up"
0.6.3
Made "Scan Directory..." a KStdAction::open with setText( "Scan Directory..." );
......
1.3
features for sysadmins, split by users etc.
1.2
split rendering engine from data-gatherer and allow data to be fed through a pipe thus allowing different data sources to be profiled.
show preview icons next to the labels
last access time colour scheme
History actions need to have menu pulldown just like konqi
show statusbar signal to say that diretories weren't scanned due to lack of permissions (allow user to enter root password, for this scan only or to keep and then scan only bits that were missed)
determine if canvas is too square and shrink map accordingly
1.1
If scanning a partition show free space
if the view is square shrink the map slightly as a slightly rectangular view is preferable
use kdirwatcher, then move rescan to scan menu, rename force rescan
clicking center goes up directory
1.0
better summary screen, use mtab properly, remove horrid codebase
fix that Part settings file is not same as app settings file
Support drag and drop of URLs
check for zero toolbar buttons, and actions in general since KDE still doesn't tell the user when UI not installed properly
EVENTUALLY
refactor disklister.cpp
implement vectors instead of double-linked lists for file data
Remove the majority of Chain uses, use the Qt/STL ones you doofus!
split rendering engine from data-gatherer and allow data to be fed through a pipe thus allowing different data sources to be profiled.
0.7.0
Use AC_CHECK_FUNC to check for sincos() as this is the worst bug currently in the sources
Make a KPart
Summary screen that shows mounts and various statistics (can be added to the table,like juk)
Trace inodes in binarytree to avoid hardlink problems
place a KDirWatch on the directory under scrutiny
show preview icons next to the labels
Trace inodes in binarytree to avoid recursive hardlinks and counting same directory tree twice
admin mode
REIMPLEMENT LABEL SYSTEM
allow system to go back on itself if situation gets sticky
improve selection of which labels are shown
make labels aware of whitespace they can use due to segment depth being low in that region (only use for labels that are too large though as it will look messy to always use, or will it? would allow us to put in more detail)
implement storage of LabelLists
SCHEMES
colour by username scheme
show file density statistics <-- make that a colour scheme
last access time colour scheme
0.6.4
BASICALLY, 0.7.0 will be kparting Filelight, so finish up the codebase in the 0.6.x series
Submit to KDE(utils/admin ??)
fullscreen option
Flicking mouse wheel shows different information in tooltip, and there's an off setting, show temp status message to reflect info box
History actions need to have menu pulldown just like konqi
online translations (Welsh guy's site, contact him)
implement optimisations you learnt from that book
implement memory savings by not using double linked lists all the time
Use QPixmapCache for the circle on the end of labels. (fill with white?)
Implement a LabelList cache somehow.
Allow breaking of trees so rescans don't invalidate the cache, however you must either do integrity checks on the cache after scans or carry a pointer to the rejoin point with the scanning code so they can be reconnected (remove the bad tree from the cache first and then reinsert when complete)
// seperate scanning code from Filelight class
see if a QThread pool helps scans, if so, implement
?? reduce redundancy of 3 referals to current path (make it so location bar reflects place when left cleared too long or something)
when focus leaves editcombo and is clear, set to current path
implement Marcel's desktop file and credit him for bug reports and stuff too
put in Jeff's patch and credit him
optimise tooltip code a bit more, it's a shame to use the expensive version of drawText()
show same labels for 2nd to last and last layers
show statusbar signal to say that diretories weren't scanned due to lack of permissions (allow user to enter root password, for this scan only or to keep and then scan only bits that were missed)
MAYBE
- make the canvas hold the signature (can be built easily now)
- filemap then accepts signature as parameter to build but doesn't own it
- who then controls various ring variables?
- rename canvas component in preparation for kparting
- for colour schemes, have colour scheme, and colour patterning methods (eg rainbow + modtime, kde colourse + file density, etc)
make FileMap strictly a building class, returns a pixmap and a parameter structure
m_map->make() should cause the canvas to update surely? (would save LOC) (needs to be made a QObject, but this will be part of builder anyway which can emit signals as appropriate
fontvary should use floats
0.6.3
label strut joins shouldn't be interfere with map, so insist on min length
- if needs to be shrunk instead reverse and extend previous label struts if poss
- this could be done with seperate function, perhaps you should split this into canvaslabels.cpp and have a few non-class functions that handle labels and take iterator parameters
mnt/detritus/media/new/full_length_mixes/ shows how top labels don't show
- determine if canvas is too square and shrink map accordingly
too many labels get shown often
add spacing above and below labels
ideally, eventually show which labels are children of which by grouping them with a coloured square or something
finish colour system
- multi-segment rendering technique is not good enough yet
- multi-segments could be half height same colour as parent without line inbetween type things (worth trying out)
- don't show multi segment if unshown directory? Just show arrowhead?
need better judgement of map spacer (combo of pixmap and placement), key in with arrowhead size and label strut lengths
BUG clicking contrast slider doesn't cause re-aa after rerendering (clicking should skip the non-aa step really, even if many clicks are planned (as otherwise you need another timer))
filesize units should stay the same on single map, or perhaps builder should determine unit to use for the map, you can have divergence with the central unit if absolutely necessary but labels should show base unit always and show lower/higher units in brackets after if appropriate, can we make it so that makeHumanReadable returns a processed string perhaps? What's best? (so you pass "blah %1" and get back "blah 12MB")
test session management still works
BUGGY various signals in the dialog on clicking reset()
improve session management loading (no unecessary signals please)
// - slightly indent labels for higher levels too
?? - improve indent, maybe a little more idented (is ident direction irrational?)
?? - when showing root labels, show all labels if you're not showing many or if there isn't many labels
?? if you click on segment you can get a strange blt after image where tip would be
?? font size bug, credit bug reporter -- check to see if it was a bug by testing with 0.6.2
?? WHAT'S the point in showing the multi-file segments when no files in dir shown as the dir shows most that info already
?? - make it so multi-file and file segments are half height or have pre-spacer or something to differentiate, discern multi as already tho)
?? grep through KDE code for thread applications and figure out why yours crashes sometimes on exit
// set processing in background cursor when you do non-disable type scan operations (as the aa takes ages)
// make other colour schemes do generic things to files/dirs etc.
// make highcontrast scheme have blue hue
// make max. contrast higher, unify contrast system (? or wait for plugin method)
?? allow multi-segments to express their hiddenChildreness
?? - actually what's the point? the hidden Segments may as well not be shown anyway but you are showing them to appease, nobody wants to see such small directories, and if they do, they can select it through the appropriate dialog
// you need to show when there are unrepresented subdirectories always at all depths
// you also need to make the stop button disable and wait cursor be set when stop is pushed
// allow changing of maximum possible scan depth (zoom actions?)
// zoom actions don't work fully yet:
// - nothing happens when limit is reached, yet MAX_RING_DEPTH is still incremented]
?? - the opposite of what people want can happen when zooming out displays less!
?? - often hidden segments will remain hidden because the files inside are too small to be displayed
// BUG doesn't show tip for first pixel inside segments
// BUG when you click to expand tooltip isn't shown but labels are if cursor is over segment
// BUG segmentTipArrows for segments > 180 degs muck up
// BUG attempting to rescan an empty directory crashes filelight
// use and install default configuration, remove various if() defaults (skipList, window size)
// you can't use KStds for the history action, restore the XML gui method of enable() as this is far more sensible
NO for first level of labels (try to) show file sizes in lighter grey font (depends on contrast) underneath label
// #include mocs
?? COMPILE ISSUE sincos issues (detect if available?)
// CRASH when cacheIsInvalid() is called from settingsDialog
// check for potential divide by zero errors
// - Use Std::back and Std::forward to reduce translation requirements
NO - can I grab the similar strings from konqi for locationbar etc?
// RecentScans menu needs to be checked that it's selected the right thing after all scan operations
// Think about a scanCannotCommence type signal or a return value from startScan?
// - you are seperating scanmanagement from interface soon so you need something or other
?? remove use of m_canvas->path() and remove that function. Interface shouldn't know via that route
?? CRASH in startScan() after rescan requested then back pushed and cache was definately corrupted at some point as it said cache state: *(()*W( or so!
// CRASH in build (recursed several times) when showSmallFiles is set
// (also back and forward have back: back and forward didn't load which is probably due to the scan finishing after the list is set so you need to set the bool )
// set work in bg cursor as app overide too
// session reloads still delete forward hist (make install fresh to check)
// history actions go back: back once clicked once
// 450 files < 40kB sounds like the whole lot is less than 40kB (possibly replace with average size instead)
// makeumanReadable() should aim for megabytes and show 3 sig figures
// replace xOffset blah with QPoint? <-if worthwhile only
// the above needs to alter units as appropriate too
// fix all known bugs
?? stop middle/left click doing stuff after a popup is cancelled
// standardise internal string names
// check style guide
// extract all defines and add to a define.h or something
// (add define for LABEL_ANGLE_FACTOR too)
// stop 2 lines tips showing as 3 line
// Shouldn't be open in Konqueror for files, should be open by mimetype (can use XML gui system for this I think)
// serious mis-render bug see: /mnt/detritus/media
// if hidden files > 15% of segment size you should show them
// set recentScans tick if map that is in there is shown
// show when directory has unshown subdirs (perhaps an arrow pointing outwards or box on string to click. something fancy anyway)
// remove file density colour scheme and code it properly for 0.7.0 with plugin based system and extended flexability (i.e. record details of max and min file sizes etc or allow colour scheme plugin to interact with the builder to get required information)
// do proc in background cursor so people know (and proc is imposing when appropriate too).
// implement ./ from command prompt
// implement flickerless labels
// stop the cursor always being focused on the location bar (stealing mouse wheel events is only problem, bar ugliness when not enabled)
// show status messages for confusing operations (eg. resize triggers change in map appearance)
// stop the map from suddenly showing a new level on resize (confusing to user and usually not very useful)
// make statusbar look nicer
// fill space that is unrepresented with a gooey-grey colour
0.6.2
// XML gui
// Rework UI, everything becomes an action
// Rework scanning slot/signal sequences to reduce potential future bugs.
// move cancel button to toolbar if poss.
// make the Files Scanned not look silly next to the #Files label.
// fix all known bugs
// add location bar (limited functionality so far)
// make a const iterator
// implement the const iterators as appropriate
// make bgPix on map non-pointer member
0.6.1
// check requires right KDE
// Always show first level directory names
// make antialiasing checkbox work, grey out font box for now
// remove dependence on KDE 3.1.3
// show tip so it's nearest the centre of the map (sounds hard eh?) <-- made timer hide() for now
// only show full path in statusbar
MAYBE
report bitblt bug -- is bug??
make bitblt/paintpixmap a configure flag (check code to see if paintpixmap is slower)
TWEAKS
do style guidelines require actions to have only initial character capitalised? --looks ugly IMO
don't cover map with setting dialog if you can help it
get it so that you can pass const Directorys most of the time (eg scanCompleteEvent)
make segementtip a plain QWidget, and paint the text on yourself to stop flicker
try making files half height segments
make names and ui names consistent
clean up code lots!
clean up filelightcanvas's methodology (m_focus sucks)
implement preference for MB (needed?)
FEATURES
?? need to code in history saves to disk
?? allow filters in the location bar (eg *.cpp)
check net for a generic filesize -> human readable format function to replace yours (maybe put into KDE) <-- how does Konqi do it currently?
make colour schemes plugins so other people can write schemes easily
Translations
// Differentiate files from directories visibly (partially transparent pixmap?)
// Large directory segments should have a label
// Internationalise
// Make everything an action
// set history duplication to off as it seems to be on for most people despite the environment variable being resposible
// need to expand size of recent scans menu
// need to add scans from command prompt to recent scans menu
// need to add most of location done stuff to recent scans history too..
// implement session management
// save toolbar positions /window positions
BUGS
?? konq can give info on files I have no access to, so the access() bit of scan needs reworking
?? near vertical up labels don't show
// why does the filecounter always show more files than the #files label?
// when you cancel a rescan you should add what you were rescanning to the back history
// operations that reset the signature don't NULL m_focus first. Ah.
// if you click to expand a segment before scanbox disappears, well it's showing incorrect info then innit. You need to make sure it dissapears before clicks like that, or remove it entirely
// changing colour scheme in options no longer updates immediately
// test scans can be cancelled <-- can but it shows a tree anyway
// reimplement don'tScan functions
// reimplement scanbox progress mem_statusMessage->setTextter
// reimplement segmentExpand()
// some bad resize/maketree bugs when new visible level gets revealed
// directories that contain only files that are less than 1kB are rendered empty
// The first map displayed is shown with uncalculated m_visibleDepth (and thus the ring breadth is wrong) and consequently resizing it makes it do a strange jump after the signature is recalculated
// Click anywhere when popup displayed gens that dir's map
// center text rounds down! 28.7MB -> 28MB
// segmenttip can exceed right and bottom edges of screen
// collections of files should not show popup
// scan non existant directory gives scan fa//you can only call this with popupmenu slots - you use the menu's titleiled error message, a why would be nice. (the prog thinks we have no access currently!) (maybe check for existance before scan is sensible, then easy to cancel it, scan() should alwyas have ok dirs)
// if you do a hold-down release popup click, your system gets stuck
// stop rescans corrupting the cache
// mouseReleaseEvent for contrastSlider needs to call the AApaint
// segmenttips that exceed filelight's boundry don't render well at exceeding point
// reset() won't trigger a map update if only colour scheme changed
GENERAL
check through all notes, write them up, etc.
write some decent quick start /explanation help
make a list of dirs/files that could not be scanned
URGENT
you must implement system to scan treeCache and unbreak trees, otherwise you will run into problems, you really shall
-- well you might not if you create the list the scan uses before the scan like detailed in source somewhere.
-- so don't worry about things until you get to doing that.
SCANS
if you have no permissions on a file/dir still add 1 to file count?
create list of trees that can be added/should be ignored before the scan
fix that Part settings file is not same as app settings file
INTERFACE
// Stop button on toolbar
add standard KDE toolbar and menubar /show/hide/configure settings to menus
1.0
figure out the 50% of time crash on startup with no URLs
check for zero toolbar buttons, and actions in general since KDE still doesn't tell the user when UI not installed properly
MAYBE
Stick the pixmap in a gridlayout so it's always central? See Kuickshow maybe..
FEATURES
Handle recursive hardlinks
// You shouldn't have to rescan stuff you've scanned
create html summary files (pics and text)
support other protocols than file:/
OPTIMISATION
if you could make only Directorys double linked links then you would save a lot of memory (files never need to be changed, directories can be shifted around)
try the multi-threaded scan approach again, but this time with a pool of 10 or so threads, not as many as directories are found
Customise GNU code for scans and QT code for drawPie
Avoid setting widget properties that cause lots of code to be executed if it's already been done
CONST the base class paramters since you forgot
Pass vars by reference as appropriate
use ints in functions, shorts for databases
Make signals and slots have sensible names for each end of the call
// Make a Link class that templates with any pointer, and use that instead of all these annoyiong unique classes
// redesign chain to use iterators
flicking mouse wheel shows different information in tooltip, and there's an off setting, show temp status message to reflect info box
ideally, eventually show which labels are children of which by grouping them with a coloured square or something
create html summary files (pics and text)
\ No newline at end of file
......@@ -16,6 +16,4 @@ libfilelight_la_SOURCES = \
fileTree.cpp \
localLister.cpp \
remoteLister.cpp \
diskLister.cpp \
disk.cpp \
summaryWidget.cpp
/*
* disks.cpp
*
* Copyright (c) 1998 Michael Kropfberger <michael.kropfberger@gmx.net>
*
* 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 Steet, Fifth Floor, Boston, MA 02111-1307, USA.
*/
#include "debug.h"
#include "disk.h"
#include <kglobal.h>
#include <klocale.h>
#include <kprocess.h>
#include <kprogress.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qregexp.h>
Disk::Disk()
: QObject()
, size( 0 ), used( 0 ), avail( 0 )
, isMounted( false ), readingSysStdErrOut( false )
{
sysProc = new KShellProcess();
Q_CHECK_PTR( sysProc );
connect( sysProc, SIGNAL(receivedStdout( KProcess*, char*, int )), SLOT(receivedSysStdErrOut( KProcess*, char*, int )) );
connect( sysProc, SIGNAL(receivedStderr( KProcess*, char*, int )), SLOT(receivedSysStdErrOut( KProcess*, char*, int )) );
insertChild( sysProc );
}
void
Disk::guessIconName()
{
if( mountPoint().contains( "cdrom", false ) ) icon = "cdrom";
else if( deviceName().contains( "cdrom", false ) ) icon = "cdrom";
else if( mountPoint().contains( "writer", false ) ) icon = "cdwriter";
else if( deviceName().contains( "writer", false ) ) icon = "cdwriter";
else if( mountPoint().contains( "mo", false ) ) icon = "mo";
else if( deviceName().contains( "mo", false ) ) icon = "mo";
else if( deviceName().contains( "fd", false ) ) {
if( deviceName().contains( "360", false ) ) icon = "5floppy";
if( deviceName().contains( "1200", false ) ) icon = "5floppy";
else
icon = "3floppy";
}
else if( mountPoint().contains( "floppy", false ) ) icon = "3floppy";
else if( mountPoint().contains( "zip", false ) ) icon = "zip";
else if( fsType().contains( "nfs", false ) ) icon = "nfs";
else
icon = "hdd";
icon += mounted() ? "_mount" : "_unmount";
}
/**
* Starts a command on the underlying system via /bin/sh
*/
int
Disk::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 ) )
fatal() << i18n( "could not execute %1" ).arg( command.local8Bit().data() ) << endl;
if( sysProc->exitStatus() != 0 )
emit sysCallError( this, sysProc->exitStatus() );
return ( sysProc->exitStatus() );
}
void
Disk::receivedSysStdErrOut( KProcess *, char *data, int len )
{
sysStringErrOut += QString::fromLocal8Bit( data, len );
}
QString
Disk::realDeviceName() const
{
const QFileInfo info( device );
QString relativePath = info.fileName();
if( info.isSymLink() ) {
const QString link = info.readLink();
if( link.startsWith( "/" ) )
return link;
relativePath = link;
}
return QDir( info.dirPath( true ) ).canonicalPath() + '/' + relativePath;
}
QString
Disk::realMountPoint() const
{
return QDir( mount ).canonicalPath();
}
void
Disk::setUsedKB( int kb_used )
{
used = kb_used;
if ( size < (used + avail) ) { //adjust kBAvail
kdWarning() << "device " << device << ": kBAvail(" << avail << ")+*kBUsed(" << used << ") exceeds kBSize(" << size << ")" << endl;
setFreeKB( size - used );
}
}
void
Disk::setFreeKB( int kb_avail )
{
avail = kb_avail;
if ( size < (used + avail) ) { //adjust kBUsed
kdWarning() << "device " << device << ": *kBAvail(" << avail << ")+kBUsed(" << used << ") exceeds kBSize(" << size << ")" << endl;
setUsedKB( size - avail );
}
}
#include "disk.moc"
/*
* disk.h
*
* Copyright (c) 1999 Michael Kropfberger <michael.kropfberger@gmx.net>
* Copyright (c) 2004 Max Howell <max.howell@methylblue.com>
*
* 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 Steet, Fifth Floor, Boston, MA 02111-1307, USA.
*/
#ifndef __DISK_H__
#define __DISK_H__
#include <kio/global.h>
#include <qobject.h>
class KProcess;
class Disk : public QObject
{
Q_OBJECT
public:
Disk();
QString lastSysError() const { return sysStringErrOut; }
/// The real device (in case deviceName() is a symlink)
QString realMountPoint() const;
/// The real device (in case deviceName() is a symlink)
QString realDeviceName() const;
QString deviceName() const { return device; }
QString mountPoint() const { return mount; }
QString prettyKBSize() const { return KIO::convertSizeFromKB( size ); }
QString prettyKBUsed() const { return KIO::convertSizeFromKB( used ); }
QString prettyKBFree() const { return KIO::convertSizeFromKB( avail ); }
QString fsType() const { return type; }
QString iconName() const { return icon; }
float percentFull() const { return size == 0 ? -1 : 100 - ((float)avail / (float)size) * 100; }
bool mounted() const { return isMounted; };
int usedKB() const { return used; }
int freeKB() const { return avail; }
int sizeKB() const { return size; }
signals:
void sysCallError( Disk *disk, int err_no );
public:
void setMounted( bool b) { isMounted = b; }
void setDeviceName( const QString &s ) { device = s; }
void setMountPoint( const QString &s ) { mount = s; }
void setMountOptions( const QString &s ) { options = s; }
void setFsType( const QString &s ) { type = s; }
void setSizeKB( int kb_size ) { size = kb_size; }
void setUsedKB( int kb_used );
void setFreeKB( int kb_avail );
void guessIconName();
private slots:
void receivedSysStdErrOut( KProcess*, char *data, int len );
private:
int sysCall( const QString & command );
class KShellProcess *sysProc;
QString sysStringErrOut;
QString device;
QString type;
QString mount;
QString options;
QString icon;
int size;
int used;
int avail; //NOTE used+avail != size (clustersize!)
bool isMounted;
bool readingSysStdErrOut;
};
#endif
/*
* Copyright (c) 1999 Michael Kropfberger <michael.kropfberger@gmx.net>
* Copyright (c) 2006 Max Howell <max.howell@methylblue.com>
*
* 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 Steet, Fifth Floor, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "debug.h"
#include "diskLister.h"
#include <kapplication.h>
#include <kprocess.h>
#include <math.h>
#include <qfile.h>
#include <stdlib.h>
#define BLANK ' '
#define DELIMITER '#'
#define FULL_PERCENT 95.0
DiskList::DiskList( QObject *parent )
: QObject( parent )
, QPtrList<Disk>()
{
updatesDisabled = false;
if( NO_FS_TYPE )
debug() << "df gives no FS_TYPE" << endl;
dfProc = new KProcess();
Q_CHECK_PTR( dfProc );
connect( dfProc, SIGNAL( receivedStdout( KProcess*, char*, int ) ), SLOT( receivedDFStdErrOut( KProcess *, char *, int ) ) );
connect( dfProc, SIGNAL( processExited( KProcess* ) ), SLOT( dfDone() ) );
readingDFStdErrOut = FALSE;
}
/**
* Updated need to be disabled sometimes to avoid pulling the Disk out from the popupmenu handler
*/
void
DiskList::setUpdatesDisabled( bool disable )
{
updatesDisabled = disable;
}
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<char>( 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()
{
debug() << k_funcinfo << endl;
if ( readingDFStdErrOut || dfProc->isRunning() )
return -1;
QFile f( FSTAB );
if( f.open( IO_ReadOnly ) ) {
QTextStream t ( &f );
QString s;
Disk *disk;
while( ! t.eof() ) {
s = t.readLine();
s = s.simplifyWhiteSpace();
if( !s.isEmpty() && s.find( DELIMITER ) != 0 ) {