summaryrefslogtreecommitdiff
path: root/core/launcher/documentlist.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/documentlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 3e0a96c..92b8c25 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -18,25 +18,28 @@
**
**********************************************************************/
#include "documentlist.h"
#include "serverinterface.h"
#include "mediadlg.h"
+/* OPIE */
#include <opie2/oglobal.h>
-
+#include <opie2/odebug.h>
#include <qtopia/config.h>
#include <qtopia/mimetype.h>
#include <qtopia/resource.h>
#include <qtopia/private/categories.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/applnk.h>
#include <qtopia/storage.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
+using namespace Opie::Core;
+/* QT */
#include <qtimer.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qdir.h>
#include <qpainter.h>
@@ -44,13 +47,12 @@
#include <qcopchannel_qws.h>
#include <qlistview.h>
#include <qlist.h>
#include <qpixmap.h>
-using namespace Opie::Core;
AppLnkSet *DocumentList::appLnkSet = 0;
static const int MAX_SEARCH_DEPTH = 10;
class DocumentListPrivate : public QObject {
@@ -105,13 +107,13 @@ DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
d = new DocumentListPrivate( serverGui );
d->needToSendAllDocLinks = false;
Config cfg( "Launcher" );
cfg.setGroup( "DocTab" );
d->scanDocs = cfg.readBoolEntry( "Enable", true );
- qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs );
+ odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl;
QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
}
void DocumentList::startInitialScan()
{
@@ -138,23 +140,23 @@ void DocumentList::start()
resume();
}
void DocumentList::pause()
{
- //qDebug("pause %i", d->tid);
+ //odebug << "pause " << d->tid << "" << oendl;
killTimer( d->tid );
d->tid = 0;
}
void DocumentList::resume()
{
if ( d->tid == 0 ) {
d->tid = startTimer( 20 );
- //qDebug("resumed %i", d->tid);
+ //odebug << "resumed " << d->tid << "" << oendl;
}
}
/*
void DocumentList::resend()
{
@@ -174,13 +176,13 @@ void DocumentList::resendWorker()
resume();
}
*/
void DocumentList::rescan()
{
- //qDebug("rescan");
+ //odebug << "rescan" << oendl;
pause();
d->initialize();
resume();
}
@@ -229,22 +231,22 @@ void DocumentList::reloadAppLnks()
if (pm.isNull()) {
QImage img( Resource::loadImage( "UnknownDocument" ) );
pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
}
- //qDebug("adding type %s", (*ittypes).latin1());
+ //odebug << "adding type " << (*ittypes) << "" << oendl;
// ### our current launcher expects docs tab to be last
d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
}
prevTypeList.remove(*ittypes);
}
}
for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
- //qDebug("removing type %s", (*ittypes).latin1());
+ //odebug << "removing type " << (*ittypes) << "" << oendl;
d->serverGui->typeRemoved(*ittypes);
}
prevTypeList = types;
}
QListIterator<AppLnk> itapp( appLnkSet->children() );
@@ -271,39 +273,39 @@ void DocumentList::reloadDocLnks()
rescan();
}
void DocumentList::linkChanged( QString arg )
{
- //qDebug( "linkchanged( %s )", arg.latin1() );
+ //odebug << "linkchanged( " << arg << " )" << oendl;
if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
reloadAppLnks();
} else {
const QList<DocLnk> &list = d->dls.children();
QListIterator<DocLnk> it( list );
while ( it.current() ) {
DocLnk *doc = it.current();
++it;
if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
|| ( doc->fileKnown() && doc->file() == arg ) ) {
- //qDebug( "found old link" );
+ //odebug << "found old link" << oendl;
DocLnk* dl = new DocLnk( arg );
// add new one if it exists and matches the mimetype
if ( d->store( dl ) ) {
// Existing link has been changed, send old link ref and a ref
// to the new link
- //qDebug( "change case" );
+ //odebug << "change case" << oendl;
if ( d->serverGui )
d->serverGui->documentChanged( *doc, *dl );
} else {
// Link has been removed or doesn't match the mimetypes any more
// so we aren't interested in it, so take it away from the list
- //qDebug( "removal case" );
+ //odebug << "removal case" << oendl;
if ( d->serverGui )
d->serverGui->documentRemoved( *doc );
}
d->dls.remove( doc ); // remove old link from docLnkSet
delete doc;
@@ -311,13 +313,13 @@ void DocumentList::linkChanged( QString arg )
}
}
// Didn't find existing link, must be new
DocLnk* dl = new DocLnk( arg );
if ( d->store( dl ) ) {
// Add if it's a link we are interested in
- //qDebug( "add case" );
+ //odebug << "add case" << oendl;
add( *dl );
}
}
}
@@ -375,18 +377,18 @@ void DocumentList::sendAllDocLinks()
contents += "Type = "+doc->type()+"\n"; // No tr
}
contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
contents += QString("Size = %1\n").arg( fi.size() ); // No tr
}
- //qDebug( "sending length %d", contents.length() );
+ //odebug << "sending length " << contents.length() << "" << oendl;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
e << contents;
#endif
- //qDebug( "================ \n\n%s\n\n===============", contents.latin1() );
+ //odebug << "================ \n\n" << contents << "\n\n===============" << oendl;
d->needToSendAllDocLinks = false;
}
@@ -533,13 +535,13 @@ void DocumentListPrivate::estimatedPercentScanned()
}
} else {
break;
}
}
- // qDebug( "overallProgress: %f", overallProgress );
+ // odebug << "overallProgress: " << overallProgress << "" << oendl;
if ( serverGui )
serverGui->documentScanningProgress( (int)overallProgress );
}
@@ -550,13 +552,13 @@ const QString DocumentListPrivate::nextFile()
// go to next base path
if ( docPathsSearched >= docPaths.count() ) {
// end of base paths
return QString::null;
} else {
QDir dir( docPaths[docPathsSearched] );
- // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() );
+ // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl;
docPathsSearched++;
if ( !dir.exists( ".Qtopia-ignore" ) ) {
listDirs[0] = new QDir( dir );
lists[0] = listDirs[0]->entryInfoList();
listPositions[0] = 0;
searchDepth = 0;
@@ -584,13 +586,13 @@ const QString DocumentListPrivate::nextFile()
QString bn = fi->fileName();
if ( bn[0] != '.' ) {
if ( fi->isDir() ) {
if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
// go down a depth
QDir dir( fi->filePath() );
- // qDebug("now going in to path: %s", bn.latin1() );
+ // odebug << "now going in to path: " << bn << "" << oendl;
if ( !dir.exists( ".Qtopia-ignore" ) ) {
if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
searchDepth++;
listDirs[searchDepth] = new QDir( dir );
lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
listPositions[searchDepth] = 0;
@@ -625,13 +627,13 @@ bool DocumentListPrivate::store( DocLnk* dl )
#define MAGIC_NUMBER ((void*)2)
const DocLnk *DocumentListPrivate::iterate()
{
if ( state == Find ) {
- //qDebug("state Find");
+ //odebug << "state Find" << oendl;
QString file = nextFile();
while ( !file.isNull() ) {
if ( file.right(8) == ".desktop" ) { // No tr
DocLnk* dl = new DocLnk( file );
if ( store(dl) )
return dl;
@@ -647,13 +649,13 @@ const DocLnk *DocumentListPrivate::iterate()
}
static int iterationI;
static int iterationCount;
if ( state == RemoveKnownFiles ) {
- //qDebug("state RemoveKnownFiles");
+ //odebug << "state RemoveKnownFiles" << oendl;
const QList<DocLnk> &list = dls.children();
for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
reference.remove( (*it)->file() );
// ### does this need to be deleted?
}
dit = new QDictIterator<void>(reference);
@@ -661,13 +663,13 @@ const DocLnk *DocumentListPrivate::iterate()
iterationI = 0;
iterationCount = dit->count();
}
if ( state == MakeUnknownFiles ) {
- //qDebug("state MakeUnknownFiles");
+ //odebug << "state MakeUnknownFiles" << oendl;
for (void* c; (c=dit->current()); ++(*dit) ) {
if ( c == MAGIC_NUMBER ) {
DocLnk* dl = new DocLnk;
QFileInfo fi( dit->currentKey() );
dl->setFile( fi.filePath() );
dl->setName( fi.baseName() );
@@ -684,13 +686,13 @@ const DocLnk *DocumentListPrivate::iterate()
delete dit;
dit = 0;
state = Done;
}
- //qDebug("state Done");
+ //odebug << "state Done" << oendl;
return NULL;
}
#include "documentlist.moc"