-rw-r--r-- | core/launcher/launcher.cpp | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index bcc2495..d9fc8e4 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -22,6 +22,8 @@ | |||
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | 24 | ||
25 | //#include <opie/ofiledialog.h> | ||
26 | #include <opie/ofileselector.h> | ||
25 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
27 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
@@ -197,7 +199,7 @@ void CategoryTabWidget::addItem( const QString& linkfile ) | |||
197 | } | 199 | } |
198 | 200 | ||
199 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
200 | AppLnkSet* docFolder, const QList<FileSystem> &fs) | 202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) |
201 | { | 203 | { |
202 | QString current; | 204 | QString current; |
203 | if ( categoryBar ) { | 205 | if ( categoryBar ) { |
@@ -251,13 +253,23 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
251 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 253 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
252 | QPixmap pm; | 254 | QPixmap pm; |
253 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
254 | docview = newView( "Documents", // No tr | 256 | |
255 | pm, tr("Documents")); | 257 | //ljpotter |
256 | docview->populate( docFolder, QString::null ); | 258 | CategoryTab *catTab ; |
257 | docFolder->detachChildren(); | 259 | catTab = new CategoryTab( pm, "Documents" ); |
258 | docview->setFileSystems(fs); | 260 | |
259 | docview->setToolsEnabled(TRUE); | 261 | categoryBar->addTab( catTab ); |
260 | setTabAppearance( "Documents", cfg ); // No tr | 262 | |
263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); | ||
264 | stack->addWidget( fileSel, tabs++ ); | ||
265 | |||
266 | // fileSel->hide(); | ||
267 | |||
268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), | ||
269 | this, SLOT(clickie(const DocLnk&)) ); | ||
270 | |||
271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), | ||
272 | // this, SLOT(clickie(const QString&)) ); | ||
261 | 273 | ||
262 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
263 | 275 | ||
@@ -273,9 +285,20 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
273 | categoryBar->show(); | 285 | categoryBar->show(); |
274 | stack->show(); | 286 | stack->show(); |
275 | 287 | ||
288 | |||
276 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
277 | } | 290 | } |
278 | 291 | ||
292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { | ||
293 | lnk.execute(); | ||
294 | // fileSel->reparse(); | ||
295 | } | ||
296 | |||
297 | void CategoryTabWidget::clickie(const QString &appStr) { | ||
298 | // DocLnk lnk(appStr); | ||
299 | // lnk.execute(); | ||
300 | } | ||
301 | |||
279 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
280 | { | 303 | { |
281 | QString grp( "Tab %1" ); // No tr | 304 | QString grp( "Tab %1" ); // No tr |
@@ -318,13 +341,10 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
318 | tab->fgColor = QColor(tabTextCol); | 341 | tab->fgColor = QColor(tabTextCol); |
319 | } | 342 | } |
320 | 343 | ||
321 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) | 344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) |
322 | { | 345 | //{ |
323 | docview->populate( docFolder, QString::null ); | 346 | // docFolder->detachChildren(); |
324 | docFolder->detachChildren(); | 347 | //} |
325 | docview->setFileSystems(fs); | ||
326 | docview->updateTools(); | ||
327 | } | ||
328 | 348 | ||
329 | void CategoryTabWidget::tabProperties() | 349 | void CategoryTabWidget::tabProperties() |
330 | { | 350 | { |
@@ -343,7 +363,7 @@ void CategoryTabWidget::tabProperties() | |||
343 | 363 | ||
344 | QString CategoryTabWidget::getAllDocLinkInfo() const | 364 | QString CategoryTabWidget::getAllDocLinkInfo() const |
345 | { | 365 | { |
346 | return docview->getAllDocLinkInfo(); | 366 | return ""; |
347 | } | 367 | } |
348 | 368 | ||
349 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
@@ -361,15 +381,14 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, | |||
361 | 381 | ||
362 | void CategoryTabWidget::updateLink(const QString& linkfile) | 382 | void CategoryTabWidget::updateLink(const QString& linkfile) |
363 | { | 383 | { |
364 | int i=0; | 384 | // LauncherView* view; |
365 | LauncherView* view; | ||
366 | qApp->processEvents(); | 385 | qApp->processEvents(); |
367 | while ((view = (LauncherView*)stack->widget(i++))) { | 386 | // while ((view = (LauncherView*)stack->widget(i++))) { |
368 | if ( view->removeLink(linkfile) ) | 387 | // if ( view->removeLink(linkfile) ) |
369 | break; | 388 | // break; |
370 | } | 389 | // } |
371 | addItem(linkfile); | 390 | // addItem(linkfile); |
372 | docview->updateTools(); | 391 | fileSel->reparse(); |
373 | } | 392 | } |
374 | 393 | ||
375 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 394 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
@@ -387,7 +406,7 @@ void CategoryTabWidget::setBusy(bool on) | |||
387 | if ( on ) | 406 | if ( on ) |
388 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
389 | else | 408 | else |
390 | for (int i=0; i<tabs; i++) | 409 | for (int i=0; i<tabs-1; i++) |
391 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
392 | } | 411 | } |
393 | 412 | ||
@@ -648,6 +667,7 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
648 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 667 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
649 | this, SLOT(properties(AppLnk*))); | 668 | this, SLOT(properties(AppLnk*))); |
650 | 669 | ||
670 | |||
651 | #if !defined(QT_NO_COP) | 671 | #if !defined(QT_NO_COP) |
652 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 672 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
653 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 673 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
@@ -732,16 +752,13 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
732 | */ | 752 | */ |
733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 753 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
734 | { | 754 | { |
735 | |||
736 | OWait *owait = new OWait(); | 755 | OWait *owait = new OWait(); |
737 | Global::statusMessage( tr( "Finding documents" ) ); | 756 | Global::statusMessage( tr( "Finding documents" ) ); |
738 | 757 | ||
739 | owait->show(); | 758 | owait->show(); |
740 | qApp->processEvents(); | 759 | qApp->processEvents(); |
741 | 760 | if(docsFolder) delete docsFolder; | |
742 | delete docsFolder; | ||
743 | docsFolder = new DocLnkSet; | 761 | docsFolder = new DocLnkSet; |
744 | |||
745 | DocLnkSet *tmp = 0; | 762 | DocLnkSet *tmp = 0; |
746 | QString home = QString(getenv("HOME")) + "/Documents"; | 763 | QString home = QString(getenv("HOME")) + "/Documents"; |
747 | tmp = new DocLnkSet( home , QString::null); | 764 | tmp = new DocLnkSet( home , QString::null); |
@@ -764,9 +781,11 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
764 | Config mediumCfg( "medium"); | 781 | Config mediumCfg( "medium"); |
765 | mediumCfg.setGroup("main"); | 782 | mediumCfg.setGroup("main"); |
766 | // a) -zecke we don't want to check | 783 | // a) -zecke we don't want to check |
767 | if(!mediumCfg.readBoolEntry("use", true ) ) | 784 | if(!mediumCfg.readBoolEntry("use", true ) ) { |
785 | owait->hide(); | ||
786 | delete owait; | ||
768 | return; | 787 | return; |
769 | 788 | } | |
770 | // find out wich filesystems are new in this round | 789 | // find out wich filesystems are new in this round |
771 | // We will do this by having a timestamp inside each mountpoint | 790 | // We will do this by having a timestamp inside each mountpoint |
772 | // if the current timestamp doesn't match this is a new file system and | 791 | // if the current timestamp doesn't match this is a new file system and |
@@ -785,6 +804,8 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
785 | delete tmp; | 804 | delete tmp; |
786 | } | 805 | } |
787 | } // done | 806 | } // done |
807 | owait->hide(); | ||
808 | delete owait; | ||
788 | return; // save the else | 809 | return; // save the else |
789 | } | 810 | } |
790 | // c) zecke | 811 | // c) zecke |
@@ -848,7 +869,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
848 | void Launcher::updateTabs() | 869 | void Launcher::updateTabs() |
849 | { | 870 | { |
850 | MimeType::updateApplications(); // ### reads all applnks twice | 871 | MimeType::updateApplications(); // ### reads all applnks twice |
851 | |||
852 | delete rootFolder; | 872 | delete rootFolder; |
853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 873 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
854 | 874 | ||
@@ -860,7 +880,7 @@ void Launcher::updateTabs() | |||
860 | void Launcher::updateDocs() | 880 | void Launcher::updateDocs() |
861 | { | 881 | { |
862 | loadDocs(); | 882 | loadDocs(); |
863 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 883 | // tabs->updateDocs(docsFolder,storage->fileSystems()); |
864 | } | 884 | } |
865 | 885 | ||
866 | void Launcher::viewSelected(const QString& s) | 886 | void Launcher::viewSelected(const QString& s) |
@@ -1317,3 +1337,19 @@ void Launcher::preloadApps() | |||
1317 | #endif | 1337 | #endif |
1318 | } | 1338 | } |
1319 | } | 1339 | } |
1340 | |||
1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) | ||
1342 | : OFileSelector(parent,mode,selector,dirName,fileName) | ||
1343 | { | ||
1344 | setYesCancelVisible(false); | ||
1345 | setToolbarVisible(true); | ||
1346 | setPermissionBarVisible(false); | ||
1347 | setLineEditVisible(false) ; | ||
1348 | //setChooserVisible( bool chooser ); | ||
1349 | |||
1350 | } | ||
1351 | |||
1352 | DocumentTab::~DocumentTab() { | ||
1353 | |||
1354 | } | ||
1355 | |||