-rw-r--r-- | core/launcher/launcher.cpp | 158 |
1 files changed, 97 insertions, 61 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 8b2907a..0205622 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -23,4 +23,6 @@ #define QTOPIA_INTERNAL_FSLP +//#include <opie/ofiledialog.h> +#include <opie/ofileselector.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> @@ -164,33 +166,33 @@ void CategoryTabWidget::showTab(const QString& id) 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++; + // } + // } QCopEnvelope e("QPE/TaskBar","reloadApps()"); @@ -198,5 +200,5 @@ void CategoryTabWidget::addItem( const QString& linkfile ) void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, - AppLnkSet* docFolder, const QList<FileSystem> &fs) + AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) { QString current; @@ -252,11 +254,21 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, QPixmap pm; pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); - 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 + + //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&)) ); connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); @@ -274,7 +286,18 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, stack->show(); + QCopEnvelope e("QPE/TaskBar","reloadApps()"); } +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 ) { @@ -319,11 +342,8 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) } -void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) -{ - docview->populate( docFolder, QString::null ); - docFolder->detachChildren(); - docview->setFileSystems(fs); - docview->updateTools(); -} +//void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) +//{ + // docFolder->detachChildren(); +//} void CategoryTabWidget::tabProperties() @@ -344,5 +364,5 @@ void CategoryTabWidget::tabProperties() QString CategoryTabWidget::getAllDocLinkInfo() const { - return docview->getAllDocLinkInfo(); + return ""; } @@ -362,13 +382,12 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, void CategoryTabWidget::updateLink(const QString& linkfile) { - int i=0; - LauncherView* view; - //qApp->processEvents(); - while ((view = (LauncherView*)stack->widget(i++))) { - if ( view->removeLink(linkfile) ) - break; - } - addItem(linkfile); - docview->updateTools(); + // LauncherView* view; + qApp->processEvents(); +// while ((view = (LauncherView*)stack->widget(i++))) { +// if ( view->removeLink(linkfile) ) +// break; +// } + // addItem(linkfile); + fileSel->reparse(); } @@ -388,5 +407,5 @@ void CategoryTabWidget::setBusy(bool on) ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); else - for (int i=0; i<tabs; i++) + for (int i=0; i<tabs-1; i++) ((LauncherView*)stack->widget(i))->setBusy(FALSE); } @@ -649,4 +668,5 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) this, SLOT(properties(AppLnk*))); + #if !defined(QT_NO_COP) QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); @@ -733,5 +753,4 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) void Launcher::loadDocs() // ok here comes a hack belonging to Global:: { - OWait *owait = new OWait(); Global::statusMessage( tr( "Finding documents" ) ); @@ -739,8 +758,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: owait->show(); qApp->processEvents(); - - delete docsFolder; + if(docsFolder) delete docsFolder; docsFolder = new DocLnkSet; - DocLnkSet *tmp = 0; QString home = QString(getenv("HOME")) + "/Documents"; @@ -765,7 +782,9 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: mediumCfg.setGroup("main"); // a) -zecke we don't want to check - if(!mediumCfg.readBoolEntry("use", true ) ) + if(!mediumCfg.readBoolEntry("use", true ) ) { + owait->hide(); + delete owait; return; - + } // find out wich filesystems are new in this round // We will do this by having a timestamp inside each mountpoint @@ -786,4 +805,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: } } // done + owait->hide(); + delete owait; return; // save the else } @@ -849,5 +870,4 @@ void Launcher::updateTabs() { MimeType::updateApplications(); // ### reads all applnks twice - delete rootFolder; rootFolder = new AppLnkSet( MimeType::appsFolderName() ); @@ -861,5 +881,5 @@ void Launcher::updateDocs() { loadDocs(); - tabs->updateDocs(docsFolder,storage->fileSystems()); + // tabs->updateDocs(docsFolder,storage->fileSystems()); } @@ -1318,2 +1338,18 @@ 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() { + +} + |