-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 | |||
@@ -22,8 +22,6 @@ | |||
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> | ||
27 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
@@ -165,41 +163,41 @@ void CategoryTabWidget::showTab(const QString& id) | |||
165 | 163 | ||
166 | void CategoryTabWidget::addItem( const QString& linkfile ) | 164 | void CategoryTabWidget::addItem( const QString& linkfile ) |
167 | { | 165 | { |
168 | // int i=0; | 166 | int i=0; |
169 | // AppLnk *app = new AppLnk(linkfile); | 167 | AppLnk *app = new AppLnk(linkfile); |
170 | // if ( !app->isValid() ) { | 168 | if ( !app->isValid() ) { |
171 | // delete app; | 169 | delete app; |
172 | // app=0; | 170 | app=0; |
173 | // } | 171 | } |
174 | // if ( !app || !app->file().isEmpty() ) { | 172 | if ( !app || !app->file().isEmpty() ) { |
175 | // A document | 173 | // A document |
176 | // delete app; | 174 | delete app; |
177 | // app = new DocLnk(linkfile); | 175 | app = new DocLnk(linkfile); |
178 | // if ( app->fileKnown() ) { | 176 | if ( app->fileKnown() ) { |
179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 177 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
180 | // } else { | 178 | } else { |
181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); | 179 | ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); |
182 | // delete app; | 180 | delete app; |
183 | // } | 181 | } |
184 | // return; | 182 | return; |
185 | // } | 183 | } |
186 | // An application | 184 | // An application |
187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 185 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
188 | // if ( !(*it).isEmpty() ) { | 186 | if ( !(*it).isEmpty() ) { |
189 | // QRegExp tf(*it,FALSE,TRUE); | 187 | QRegExp tf(*it,FALSE,TRUE); |
190 | // if ( tf.match(app->type()) >= 0 ) { | 188 | if ( tf.match(app->type()) >= 0 ) { |
191 | // ((LauncherView*)stack->widget(i))->addItem(app); | 189 | ((LauncherView*)stack->widget(i))->addItem(app); |
192 | // return; | 190 | return; |
193 | // } | 191 | } |
194 | // i++; | 192 | i++; |
195 | // } | 193 | } |
196 | // } | 194 | } |
197 | 195 | ||
198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 196 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
199 | } | 197 | } |
200 | 198 | ||
201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 199 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) | 200 | AppLnkSet* docFolder, const QList<FileSystem> &fs) |
203 | { | 201 | { |
204 | QString current; | 202 | QString current; |
205 | if ( categoryBar ) { | 203 | if ( categoryBar ) { |
@@ -253,23 +251,13 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
253 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 251 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
254 | QPixmap pm; | 252 | QPixmap pm; |
255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 253 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
256 | 254 | docview = newView( "Documents", // No tr | |
257 | //ljpotter | 255 | pm, tr("Documents")); |
258 | CategoryTab *catTab ; | 256 | docview->populate( docFolder, QString::null ); |
259 | catTab = new CategoryTab( pm, "Documents" ); | 257 | docFolder->detachChildren(); |
260 | 258 | docview->setFileSystems(fs); | |
261 | categoryBar->addTab( catTab ); | 259 | docview->setToolsEnabled(TRUE); |
262 | 260 | setTabAppearance( "Documents", cfg ); // No tr | |
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&)) ); | ||
273 | 261 | ||
274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 262 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
275 | 263 | ||
@@ -285,20 +273,9 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
285 | categoryBar->show(); | 273 | categoryBar->show(); |
286 | stack->show(); | 274 | stack->show(); |
287 | 275 | ||
288 | |||
289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 276 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
290 | } | 277 | } |
291 | 278 | ||
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 | |||
302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 279 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
303 | { | 280 | { |
304 | QString grp( "Tab %1" ); // No tr | 281 | QString grp( "Tab %1" ); // No tr |
@@ -341,10 +318,13 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
341 | tab->fgColor = QColor(tabTextCol); | 318 | tab->fgColor = QColor(tabTextCol); |
342 | } | 319 | } |
343 | 320 | ||
344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) | 321 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) |
345 | //{ | 322 | { |
346 | // docFolder->detachChildren(); | 323 | docview->populate( docFolder, QString::null ); |
347 | //} | 324 | docFolder->detachChildren(); |
325 | docview->setFileSystems(fs); | ||
326 | docview->updateTools(); | ||
327 | } | ||
348 | 328 | ||
349 | void CategoryTabWidget::tabProperties() | 329 | void CategoryTabWidget::tabProperties() |
350 | { | 330 | { |
@@ -363,7 +343,7 @@ void CategoryTabWidget::tabProperties() | |||
363 | 343 | ||
364 | QString CategoryTabWidget::getAllDocLinkInfo() const | 344 | QString CategoryTabWidget::getAllDocLinkInfo() const |
365 | { | 345 | { |
366 | return ""; | 346 | return docview->getAllDocLinkInfo(); |
367 | } | 347 | } |
368 | 348 | ||
369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 349 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
@@ -381,14 +361,15 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, | |||
381 | 361 | ||
382 | void CategoryTabWidget::updateLink(const QString& linkfile) | 362 | void CategoryTabWidget::updateLink(const QString& linkfile) |
383 | { | 363 | { |
384 | // LauncherView* view; | 364 | int i=0; |
385 | qApp->processEvents(); | 365 | LauncherView* view; |
386 | // while ((view = (LauncherView*)stack->widget(i++))) { | 366 | //qApp->processEvents(); |
387 | // if ( view->removeLink(linkfile) ) | 367 | while ((view = (LauncherView*)stack->widget(i++))) { |
388 | // break; | 368 | if ( view->removeLink(linkfile) ) |
389 | // } | 369 | break; |
390 | // addItem(linkfile); | 370 | } |
391 | fileSel->reparse(); | 371 | addItem(linkfile); |
372 | docview->updateTools(); | ||
392 | } | 373 | } |
393 | 374 | ||
394 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 375 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
@@ -406,7 +387,7 @@ void CategoryTabWidget::setBusy(bool on) | |||
406 | if ( on ) | 387 | if ( on ) |
407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 388 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
408 | else | 389 | else |
409 | for (int i=0; i<tabs-1; i++) | 390 | for (int i=0; i<tabs; i++) |
410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 391 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
411 | } | 392 | } |
412 | 393 | ||
@@ -667,7 +648,6 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
667 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 648 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
668 | this, SLOT(properties(AppLnk*))); | 649 | this, SLOT(properties(AppLnk*))); |
669 | 650 | ||
670 | |||
671 | #if !defined(QT_NO_COP) | 651 | #if !defined(QT_NO_COP) |
672 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 652 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
673 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 653 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
@@ -752,13 +732,16 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
752 | */ | 732 | */ |
753 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
754 | { | 734 | { |
735 | |||
755 | OWait *owait = new OWait(); | 736 | OWait *owait = new OWait(); |
756 | Global::statusMessage( tr( "Finding documents" ) ); | 737 | Global::statusMessage( tr( "Finding documents" ) ); |
757 | 738 | ||
758 | owait->show(); | 739 | owait->show(); |
759 | qApp->processEvents(); | 740 | qApp->processEvents(); |
760 | if(docsFolder) delete docsFolder; | 741 | |
742 | delete docsFolder; | ||
761 | docsFolder = new DocLnkSet; | 743 | docsFolder = new DocLnkSet; |
744 | |||
762 | DocLnkSet *tmp = 0; | 745 | DocLnkSet *tmp = 0; |
763 | QString home = QString(getenv("HOME")) + "/Documents"; | 746 | QString home = QString(getenv("HOME")) + "/Documents"; |
764 | tmp = new DocLnkSet( home , QString::null); | 747 | tmp = new DocLnkSet( home , QString::null); |
@@ -781,11 +764,9 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
781 | Config mediumCfg( "medium"); | 764 | Config mediumCfg( "medium"); |
782 | mediumCfg.setGroup("main"); | 765 | mediumCfg.setGroup("main"); |
783 | // a) -zecke we don't want to check | 766 | // a) -zecke we don't want to check |
784 | if(!mediumCfg.readBoolEntry("use", true ) ) { | 767 | if(!mediumCfg.readBoolEntry("use", true ) ) |
785 | owait->hide(); | ||
786 | delete owait; | ||
787 | return; | 768 | return; |
788 | } | 769 | |
789 | // find out wich filesystems are new in this round | 770 | // find out wich filesystems are new in this round |
790 | // We will do this by having a timestamp inside each mountpoint | 771 | // We will do this by having a timestamp inside each mountpoint |
791 | // if the current timestamp doesn't match this is a new file system and | 772 | // if the current timestamp doesn't match this is a new file system and |
@@ -804,8 +785,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
804 | delete tmp; | 785 | delete tmp; |
805 | } | 786 | } |
806 | } // done | 787 | } // done |
807 | owait->hide(); | ||
808 | delete owait; | ||
809 | return; // save the else | 788 | return; // save the else |
810 | } | 789 | } |
811 | // c) zecke | 790 | // c) zecke |
@@ -869,6 +848,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
869 | void Launcher::updateTabs() | 848 | void Launcher::updateTabs() |
870 | { | 849 | { |
871 | MimeType::updateApplications(); // ### reads all applnks twice | 850 | MimeType::updateApplications(); // ### reads all applnks twice |
851 | |||
872 | delete rootFolder; | 852 | delete rootFolder; |
873 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
874 | 854 | ||
@@ -880,7 +860,7 @@ void Launcher::updateTabs() | |||
880 | void Launcher::updateDocs() | 860 | void Launcher::updateDocs() |
881 | { | 861 | { |
882 | loadDocs(); | 862 | loadDocs(); |
883 | // tabs->updateDocs(docsFolder,storage->fileSystems()); | 863 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
884 | } | 864 | } |
885 | 865 | ||
886 | void Launcher::viewSelected(const QString& s) | 866 | void Launcher::viewSelected(const QString& s) |
@@ -1337,19 +1317,3 @@ void Launcher::preloadApps() | |||
1337 | #endif | 1317 | #endif |
1338 | } | 1318 | } |
1339 | } | 1319 | } |
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(false); | ||
1346 | setPermissionBarVisible(false); | ||
1347 | setLineEditVisible(false) ; | ||
1348 | //setChooserVisible( bool chooser ); | ||
1349 | |||
1350 | } | ||
1351 | |||
1352 | DocumentTab::~DocumentTab() { | ||
1353 | |||
1354 | } | ||
1355 | |||