-rw-r--r-- | core/launcher/launcher.cpp | 158 |
1 files changed, 61 insertions, 97 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 0205622..8b2907a 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -24,4 +24,2 @@ -//#include <opie/ofiledialog.h> -#include <opie/ofileselector.h> #include <qpe/qcopenvelope_qws.h> @@ -167,31 +165,31 @@ void CategoryTabWidget::addItem( const QString& linkfile ) { -// int i=0; -// AppLnk *app = new AppLnk(linkfile); -// if ( !app->isValid() ) { -// delete app; -// app=0; -// } -// if ( !app || !app->file().isEmpty() ) { + int i=0; + AppLnk *app = new AppLnk(linkfile); + if ( !app->isValid() ) { + delete app; + app=0; + } + if ( !app || !app->file().isEmpty() ) { // A document -// delete app; -// app = new DocLnk(linkfile); -// if ( app->fileKnown() ) { -// ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); -// } else { -// ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); -// delete app; -// } -// return; -// } + delete app; + app = new DocLnk(linkfile); + if ( app->fileKnown() ) { + ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); + } else { + ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); + delete app; + } + return; + } // An application -// for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { -// if ( !(*it).isEmpty() ) { -// QRegExp tf(*it,FALSE,TRUE); -// if ( tf.match(app->type()) >= 0 ) { -// ((LauncherView*)stack->widget(i))->addItem(app); -// return; -// } -// i++; - // } - // } + for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { + if ( !(*it).isEmpty() ) { + QRegExp tf(*it,FALSE,TRUE); + if ( tf.match(app->type()) >= 0 ) { + ((LauncherView*)stack->widget(i))->addItem(app); + return; + } + i++; + } + } @@ -201,3 +199,3 @@ void CategoryTabWidget::addItem( const QString& linkfile ) void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, - AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) + AppLnkSet* docFolder, const QList<FileSystem> &fs) { @@ -255,19 +253,9 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); - - //ljpotter - CategoryTab *catTab ; - catTab = new CategoryTab( pm, "Documents" ); - - categoryBar->addTab( catTab ); - - fileSel = new DocumentTab( stack, 4, 0, "/",""); - stack->addWidget( fileSel, tabs++ ); - - // fileSel->hide(); - - connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), - this, SLOT(clickie(const DocLnk&)) ); - -// connect( fileSel, SIGNAL( fileSelected( const QString & )), -// this, SLOT(clickie(const QString&)) ); + docview = newView( "Documents", // No tr + pm, tr("Documents")); + docview->populate( docFolder, QString::null ); + docFolder->detachChildren(); + docview->setFileSystems(fs); + docview->setToolsEnabled(TRUE); + setTabAppearance( "Documents", cfg ); // No tr @@ -287,3 +275,2 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, - QCopEnvelope e("QPE/TaskBar","reloadApps()"); @@ -291,12 +278,2 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, -void CategoryTabWidget::clickie(const DocLnk &lnk) { - lnk.execute(); - // fileSel->reparse(); -} - -void CategoryTabWidget::clickie(const QString &appStr) { -// DocLnk lnk(appStr); -// lnk.execute(); -} - void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) @@ -343,6 +320,9 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) -//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) -//{ - // docFolder->detachChildren(); -//} +void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) +{ + docview->populate( docFolder, QString::null ); + docFolder->detachChildren(); + docview->setFileSystems(fs); + docview->updateTools(); +} @@ -365,3 +345,3 @@ QString CategoryTabWidget::getAllDocLinkInfo() const { - return ""; + return docview->getAllDocLinkInfo(); } @@ -383,10 +363,11 @@ void CategoryTabWidget::updateLink(const QString& linkfile) { - // LauncherView* view; - qApp->processEvents(); -// while ((view = (LauncherView*)stack->widget(i++))) { -// if ( view->removeLink(linkfile) ) -// break; -// } - // addItem(linkfile); - fileSel->reparse(); + int i=0; + LauncherView* view; + //qApp->processEvents(); + while ((view = (LauncherView*)stack->widget(i++))) { + if ( view->removeLink(linkfile) ) + break; + } + addItem(linkfile); + docview->updateTools(); } @@ -408,3 +389,3 @@ void CategoryTabWidget::setBusy(bool on) else - for (int i=0; i<tabs-1; i++) + for (int i=0; i<tabs; i++) ((LauncherView*)stack->widget(i))->setBusy(FALSE); @@ -669,3 +650,2 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) - #if !defined(QT_NO_COP) @@ -754,2 +734,3 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: { + OWait *owait = new OWait(); @@ -759,4 +740,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: qApp->processEvents(); - if(docsFolder) delete docsFolder; + + delete docsFolder; docsFolder = new DocLnkSet; + DocLnkSet *tmp = 0; @@ -783,7 +766,5 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: // a) -zecke we don't want to check - if(!mediumCfg.readBoolEntry("use", true ) ) { - owait->hide(); - delete owait; + if(!mediumCfg.readBoolEntry("use", true ) ) return; - } + // find out wich filesystems are new in this round @@ -806,4 +787,2 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: } // done - owait->hide(); - delete owait; return; // save the else @@ -871,2 +850,3 @@ void Launcher::updateTabs() MimeType::updateApplications(); // ### reads all applnks twice + delete rootFolder; @@ -882,3 +862,3 @@ void Launcher::updateDocs() loadDocs(); - // tabs->updateDocs(docsFolder,storage->fileSystems()); + tabs->updateDocs(docsFolder,storage->fileSystems()); } @@ -1339,17 +1319 @@ void Launcher::preloadApps() } - -DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) - : OFileSelector(parent,mode,selector,dirName,fileName) -{ - setYesCancelVisible(false); - setToolbarVisible(false); - setPermissionBarVisible(false); - setLineEditVisible(false) ; - //setChooserVisible( bool chooser ); - -} - -DocumentTab::~DocumentTab() { - -} - |