-rw-r--r-- | core/launcher/documentlist.cpp | 10 | ||||
-rw-r--r-- | core/launcher/documentlist.h | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 25 | ||||
-rw-r--r-- | core/launcher/launcher.h | 1 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 4 | ||||
-rw-r--r-- | core/launcher/server.cpp | 2 |
6 files changed, 37 insertions, 6 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index d8e7a83..9781a32 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -257,51 +257,59 @@ void DocumentList::reloadAppLnks() AppLnk* l; while ( (l=itapp.current()) ) { ++itapp; if ( d->sendAppLnks && d->serverGui ) d->serverGui->applicationAdded( l->type(), *l ); } if ( d->sendAppLnks && d->serverGui ) d->serverGui->applicationScanningProgress( 100 ); } void DocumentList::reloadDocLnks() { if ( !d->scanDocs ) return; if ( d->sendDocLnks && d->serverGui ) { d->serverGui->documentScanningProgress( 0 ); d->serverGui->allDocumentsRemoved(); } rescan(); } +void DocumentList::reforceDocuments() +{ + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + d->scanDocs = cfg.readBoolEntry( "Enable", true ); + reloadDocLnks(); +} + void DocumentList::linkChanged( QString arg ) { - //odebug << "linkchanged( " << arg << " )" << oendl; + 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 ) ) { //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 //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 diff --git a/core/launcher/documentlist.h b/core/launcher/documentlist.h index 232bb6a..8b69e95 100644 --- a/core/launcher/documentlist.h +++ b/core/launcher/documentlist.h @@ -21,48 +21,49 @@ #define DOCUMENT_LIST_H #include <qobject.h> #include <qtopia/applnk.h> class DocumentListPrivate; class ServerInterface; class DocumentList : public QObject { Q_OBJECT public: DocumentList( ServerInterface *serverGui, bool scanDocs = TRUE, QObject *parent = 0, const char *name = 0 ); ~DocumentList(); void linkChanged( QString link ); void restoreDone(); void storageChanged(); void sendAllDocLinks(); void reloadAppLnks(); void reloadDocLnks(); + void reforceDocuments(); void DiffAppLnks(); // Orig DocList stuff void start(); void pause(); void resume(); void rescan(); static AppLnkSet *appLnkSet; /* void resend(); signals: void added( const DocLnk& doc ); void removed( const DocLnk& doc ); void changed( const DocLnk& oldDoc, const DocLnk& newDoc ); void allRemoved(); void doneForNow(); private slots: void resendWorker(); */ private slots: void startInitialScan(); protected: diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index ccc2114..970b8cb 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -420,54 +420,75 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & QString fam; stream >> fam; int size; stream >> size; int weight; stream >> weight; int italic; stream >> italic; if ( view(id) ) { if ( !fam.isEmpty() ) { view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; } else { view(id)->clearViewFont(); } } }else if ( msg == "setBusyIndicatorType(QString)" ) { QString type; stream >> type; setBusyIndicatorType( type ); }else if ( msg == "home()" ) { if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { if (categoryBar) categoryBar->nextTab(); - }else + }else { static_cast<QWidget*>(parent())->raise(); } + } else if (msg=="doctabEnabled(int)") { + int id; stream >> id; + odebug << "Doctab enabled " << id << oendl; + reCheckDoctab(id); + } } - +void LauncherTabWidget::reCheckDoctab(int how) +{ + if ((bool)how == docTabEnabled) { + /* nothing to do */ + return; + } + if (docLoadingWidget) { + stack->removeWidget(docLoadingWidget); + delete docLoadingWidget; + docLoadingWidget = 0; + } + createDocLoadingWidget(); + { + QCopEnvelope( "QPE/System", "reforceDocuments()" ); + odebug << "Sending doc rescan" << oendl; + } +} //--------------------------------------------------------------------------- Launcher::Launcher() : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) { tabs = 0; tb = 0; Config cfg( "Launcher" ); cfg.setGroup( "DocTab" ); docTabEnabled = cfg.readBoolEntry( "Enable", true ); } void Launcher::createGUI() { setCaption( tr("Launcher") ); // we have a pretty good idea how big we'll be setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); tb = new TaskBar; tabs = new LauncherTabWidget( this ); setCentralWidget( tabs ); diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index db6ac54..b741064 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -60,48 +60,49 @@ public: void setLoadingProgress( int percent ); LauncherTabBar* categoryBar; void setBusyIndicatorType( const QString& type ); signals: void selected(const QString&); void clicked(const AppLnk*); void rightPressed(AppLnk*); protected slots: void raiseTabWidget(); void tabProperties(); void initLayout(); private slots: void launcherMessage( const QCString &, const QByteArray &); void appMessage( const QCString &, const QByteArray &); void setProgressStyle(); protected: void paletteChange( const QPalette &p ); void styleChange( QStyle & ); + void reCheckDoctab(int how); private: Launcher *launcher; LauncherView *docview; QWidgetStack *stack; LauncherView *docLoadingWidget; QProgressBar *docLoadingWidgetProgress; bool docLoadingWidgetEnabled; bool docTabEnabled; int m_DocumentTabId; }; class Launcher : public QMainWindow, public ServerInterface { Q_OBJECT public: Launcher(); ~Launcher(); // implementing ServerInterface void createGUI(); void destroyGUI(); void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index c9efacb..2783423 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -311,51 +311,48 @@ int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) switch (sortmeth) { case Name: return a->name().lower().compare(b->name().lower()); case Date: { QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); return fa.lastModified().secsTo(fb.lastModified()); } case Type: return a->type().compare(b->type()); } return 0; } void LauncherIconView::setSortMethod( SortMethod m ) { if ( sortmeth != m ) { sortmeth = m; sort(); } } void LauncherIconView::setCategoryFilter( int catfilter, bool resort ) { - Categories cat; - cat.load( categoryFileName() ); - QString str; if ( catfilter == -2 ) cf = 0; else cf = catfilter; hideOrShowItems(resort); } void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) { tf = QRegExp(typefilter,FALSE,TRUE); hideOrShowItems(resort); } void LauncherIconView::setItemTextPos( ItemTextPos pos ) { calculateGrid( pos ); QIconView::setItemTextPos( pos ); } void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) { if ( !bgPixmap.isNull() ) { p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), @@ -1062,48 +1059,49 @@ void LauncherView::itemClicked( int btn, QIconViewItem *item ) if ( btn == LeftButton ) { // Make sure it's the item we execute that gets highlighted icons->setCurrentItem( item ); emit clicked( appLnk ); } item->setSelected(FALSE); } } void LauncherView::itemPressed( int btn, QIconViewItem *item ) { if ( item ) { AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); if ( btn == RightButton ) emit rightPressed( appLnk ); else if ( btn == ShiftButton ) emit rightPressed( appLnk ); item->setSelected(FALSE); } } void LauncherView::removeAllItems() { odebug << "LauncherView::removeAllItems()" << oendl; + if (LauncherIconView::sm_EyeCache) LauncherIconView::sm_EyeCache->clear(); icons->clear(); } bool LauncherView::removeLink(const QString& linkfile) { return icons->removeLink(linkfile); } void LauncherView::addItem(AppLnk* app, bool resort) { icons->addItem(app,resort); } void LauncherView::changeItem(const AppLnk&old,AppLnk*nlink) { icons->changeItem(old,nlink); } void LauncherView::setSortEnabled( bool v ) { icons->setSorting( v ); if ( v ) sort(); } diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 42186d3..15cd686 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp @@ -321,48 +321,50 @@ bool Server::setKeyboardLayout( const QString &kb ) #endif void Server::systemMsg(const QCString &msg, const QByteArray &data) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "securityChanged()" ) { if ( transferServer ) transferServer->authorizeConnections(); if ( qcopBridge ) qcopBridge->authorizeConnections(); #warning FIXME support TempScreenSaverMode #if 0 } else if ( msg == "setTempScreenSaverMode(int,int)" ) { int mode, pid; stream >> mode >> pid; tsmMonitor->setTempMode(mode, pid); #endif } else if ( msg == "linkChanged(QString)" ) { QString link; stream >> link; odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; docList->linkChanged(link); + } else if (msg =="reforceDocuments()") { + docList->reforceDocuments(); } else if ( msg == "serviceChanged(QString)" ) { MimeType::updateApplications(); } else if ( msg == "mkdir(QString)" ) { QString dir; stream >> dir; if ( !dir.isEmpty() ) mkdir( dir ); } else if ( msg == "rdiffGenSig(QString,QString)" ) { QString baseFile, sigFile; stream >> baseFile >> sigFile; QRsync::generateSignature( baseFile, sigFile ); } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { QString baseFile, sigFile, deltaFile; stream >> baseFile >> sigFile >> deltaFile; QRsync::generateDiff( baseFile, sigFile, deltaFile ); } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { QString baseFile, deltaFile; stream >> baseFile >> deltaFile; if ( !QFile::exists( baseFile ) ) { QFile f( baseFile ); f.open( IO_WriteOnly ); f.close(); } QRsync::applyDiff( baseFile, deltaFile ); |