summaryrefslogtreecommitdiff
path: root/core/launcher
authorllornkcor <llornkcor>2003-07-05 15:30:22 (UTC)
committer llornkcor <llornkcor>2003-07-05 15:30:22 (UTC)
commit2f6b0ede633948b44a5ed3ee1ec641395620f076 (patch) (unidiff)
tree1c3d86b2932fe0ae18ce50f72c680949b1b22ee8 /core/launcher
parent51cb7e4cd9a7ec7f1bf864884928c61b9f2db3b0 (diff)
downloadopie-2f6b0ede633948b44a5ed3ee1ec641395620f076.zip
opie-2f6b0ede633948b44a5ed3ee1ec641395620f076.tar.gz
opie-2f6b0ede633948b44a5ed3ee1ec641395620f076.tar.bz2
initial new doc tab using ofileselector
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp102
-rw-r--r--core/launcher/launcher.h29
2 files changed, 93 insertions, 38 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
@@ -19,12 +19,14 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT 21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
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>
28#include <qpe/config.h> 30#include <qpe/config.h>
29#include <qpe/global.h> 31#include <qpe/global.h>
30#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
@@ -194,13 +196,13 @@ void CategoryTabWidget::addItem( const QString& linkfile )
194 } 196 }
195 197
196 QCopEnvelope e("QPE/TaskBar","reloadApps()"); 198 QCopEnvelope e("QPE/TaskBar","reloadApps()");
197} 199}
198 200
199void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, 201void 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 ) {
204 int c = categoryBar->currentTab(); 206 int c = categoryBar->currentTab();
205 if ( c >= 0 ) current = ids[c]; 207 if ( c >= 0 ) current = ids[c];
206 } 208 }
@@ -248,19 +250,29 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
248 ((LauncherView*)stack->widget(i))->sort(); 250 ((LauncherView*)stack->widget(i))->sort();
249 251
250 // all documents 252 // all documents
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
264 ((LauncherView*)stack->widget(0))->setFocus(); 276 ((LauncherView*)stack->widget(0))->setFocus();
265 277
266 cfg. setGroup ( "GUI" ); 278 cfg. setGroup ( "GUI" );
@@ -270,15 +282,26 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
270 showTab(current); 282 showTab(current);
271 } 283 }
272 284
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
292void CategoryTabWidget::clickie(const DocLnk &lnk) {
293 lnk.execute();
294 // fileSel->reparse();
295}
296
297void CategoryTabWidget::clickie(const QString &appStr) {
298// DocLnk lnk(appStr);
299// lnk.execute();
300}
301
279void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) 302void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
280{ 303{
281 QString grp( "Tab %1" ); // No tr 304 QString grp( "Tab %1" ); // No tr
282 cfg.setGroup( grp.arg(id) ); 305 cfg.setGroup( grp.arg(id) );
283 LauncherView *v = view( id ); 306 LauncherView *v = view( id );
284 int idx = ids.findIndex( id ); 307 int idx = ids.findIndex( id );
@@ -315,19 +338,16 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg )
315 if ( tabTextCol.isEmpty() ) 338 if ( tabTextCol.isEmpty() )
316 tab->fgColor = QColor(); 339 tab->fgColor = QColor();
317 else 340 else
318 tab->fgColor = QColor(tabTextCol); 341 tab->fgColor = QColor(tabTextCol);
319} 342}
320 343
321void 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
329void CategoryTabWidget::tabProperties() 349void CategoryTabWidget::tabProperties()
330{ 350{
331 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); 351 LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() );
332 QPopupMenu *m = new QPopupMenu( this ); 352 QPopupMenu *m = new QPopupMenu( this );
333 m->insertItem( tr("Icon View"), LauncherView::Icon ); 353 m->insertItem( tr("Icon View"), LauncherView::Icon );
@@ -340,13 +360,13 @@ void CategoryTabWidget::tabProperties()
340 360
341 delete m; 361 delete m;
342} 362}
343 363
344QString CategoryTabWidget::getAllDocLinkInfo() const 364QString CategoryTabWidget::getAllDocLinkInfo() const
345{ 365{
346 return docview->getAllDocLinkInfo(); 366 return "";
347} 367}
348 368
349LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 369LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
350{ 370{
351 LauncherView* view = new LauncherView( stack ); 371 LauncherView* view = new LauncherView( stack );
352 connect( view, SIGNAL(clicked(const AppLnk*)), 372 connect( view, SIGNAL(clicked(const AppLnk*)),
@@ -358,21 +378,20 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
358 stack->addWidget( view, tabs++ ); 378 stack->addWidget( view, tabs++ );
359 return view; 379 return view;
360} 380}
361 381
362void CategoryTabWidget::updateLink(const QString& linkfile) 382void 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
375void CategoryTabWidget::paletteChange( const QPalette &p ) 394void CategoryTabWidget::paletteChange( const QPalette &p )
376{ 395{
377 QVBox::paletteChange( p ); 396 QVBox::paletteChange( p );
378 QPalette pal = palette(); 397 QPalette pal = palette();
@@ -384,13 +403,13 @@ void CategoryTabWidget::paletteChange( const QPalette &p )
384 403
385void CategoryTabWidget::setBusy(bool on) 404void CategoryTabWidget::setBusy(bool on)
386{ 405{
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
394LauncherView *CategoryTabWidget::view( const QString &id ) 413LauncherView *CategoryTabWidget::view( const QString &id )
395{ 414{
396 int idx = ids.findIndex( id ); 415 int idx = ids.findIndex( id );
@@ -645,12 +664,13 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
645 this, SLOT(viewSelected(const QString&)) ); 664 this, SLOT(viewSelected(const QString&)) );
646 connect( tabs, SIGNAL(clicked(const AppLnk*)), 665 connect( tabs, SIGNAL(clicked(const AppLnk*)),
647 this, SLOT(select(const AppLnk*))); 666 this, SLOT(select(const AppLnk*)));
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 &)),
654 this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); 674 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
655 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 675 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
656 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 676 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
@@ -729,22 +749,19 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
729 * c) the user enabled medium checking on a per medium bases 749 * c) the user enabled medium checking on a per medium bases
730 * c1) we already checked and its not ask again turns 750 * c1) we already checked and its not ask again turns
731 * c2) we need to ask and then apply the mimefilter 751 * c2) we need to ask and then apply the mimefilter
732 */ 752 */
733void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 753void 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);
748 docsFolder->appendFrom( *tmp ); 765 docsFolder->appendFrom( *tmp );
749 delete tmp; 766 delete tmp;
750 767
@@ -761,15 +778,17 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
761 } 778 }
762 } 779 }
763 780
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
773 // come up with our MediumMountGui :) let the hacking begin 792 // come up with our MediumMountGui :) let the hacking begin
774 int stamp = uidgen.generate(); 793 int stamp = uidgen.generate();
775 794
@@ -782,12 +801,14 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
782 if( (*it)->isRemovable() ){ 801 if( (*it)->isRemovable() ){
783 tmp = new DocLnkSet( (*it)->path(), mime ); 802 tmp = new DocLnkSet( (*it)->path(), mime );
784 docsFolder->appendFrom( *tmp ); 803 docsFolder->appendFrom( *tmp );
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
791 for ( it.toFirst(); it.current(); ++it ) { 812 for ( it.toFirst(); it.current(); ++it ) {
792 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 813 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
793 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); 814 Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
@@ -845,25 +866,24 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
845 delete owait; 866 delete owait;
846} 867}
847 868
848void Launcher::updateTabs() 869void 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
855 loadDocs(); 875 loadDocs();
856 876
857 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 877 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
858} 878}
859 879
860void Launcher::updateDocs() 880void Launcher::updateDocs()
861{ 881{
862 loadDocs(); 882 loadDocs();
863 tabs->updateDocs(docsFolder,storage->fileSystems()); 883 // tabs->updateDocs(docsFolder,storage->fileSystems());
864} 884}
865 885
866void Launcher::viewSelected(const QString& s) 886void Launcher::viewSelected(const QString& s)
867{ 887{
868 setCaption( s + tr(" - Launcher") ); 888 setCaption( s + tr(" - Launcher") );
869} 889}
@@ -1314,6 +1334,22 @@ void Launcher::preloadApps()
1314 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { 1334 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
1315#ifndef QT_NO_COP 1335#ifndef QT_NO_COP
1316 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 1336 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
1317#endif 1337#endif
1318 } 1338 }
1319} 1339}
1340
1341DocumentTab::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
1352DocumentTab::~DocumentTab() {
1353
1354}
1355
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
index c92ef5d..0616734 100644
--- a/core/launcher/launcher.h
+++ b/core/launcher/launcher.h
@@ -1,11 +1,10 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.**
5**
6** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 8** packaging of this file.
10** 9**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -18,12 +17,16 @@
18** 17**
19**********************************************************************/ 18**********************************************************************/
20#ifndef LAUNCHER_H 19#ifndef LAUNCHER_H
21#define LAUNCHER_H 20#define LAUNCHER_H
22 21
23#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/applnk.h>
24
25#include <opie/ofileselector.h>
26
24#include <qmainwindow.h> 27#include <qmainwindow.h>
25#include <qtabbar.h> 28#include <qtabbar.h>
26#include <qstringlist.h> 29#include <qstringlist.h>
27#include <qvbox.h> 30#include <qvbox.h>
28#include <qlist.h> 31#include <qlist.h>
29#include <qpe/palmtopuidgen.h> 32#include <qpe/palmtopuidgen.h>
@@ -33,50 +36,66 @@ class AppLnk;
33class AppLnkSet; 36class AppLnkSet;
34class DocLnkSet; 37class DocLnkSet;
35class QWidgetStack; 38class QWidgetStack;
36class StorageInfo; 39class StorageInfo;
37class SyncDialog; 40class SyncDialog;
38 41
42
43class DocumentTab : public OFileSelector
44{
45 Q_OBJECT
46public:
47 DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName);//, 4,0, "/","");
48~DocumentTab();
49private:
50
51};
52
39class CategoryTabBar : public QTabBar 53class CategoryTabBar : public QTabBar
40{ 54{
41 Q_OBJECT 55 Q_OBJECT
42public: 56public:
43 CategoryTabBar( QWidget *parent=0, const char *name=0 ); 57 CategoryTabBar( QWidget *parent=0, const char *name=0 );
44 ~CategoryTabBar(); 58 ~CategoryTabBar();
45 59
60signals:
61
46protected slots: 62protected slots:
47 virtual void layoutTabs(); 63 virtual void layoutTabs();
48 64
49protected: 65protected:
50 void paint ( QPainter *p, QTab *t, bool f ) const; 66 void paint ( QPainter *p, QTab *t, bool f ) const;
51 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; 67 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const;
68
52}; 69};
53 70
54class CategoryTabWidget : public QVBox { 71class CategoryTabWidget : public QVBox {
55 // can't use a QTabWidget, since it won't let us set the frame style. 72 // can't use a QTabWidget, since it won't let us set the frame style.
56 Q_OBJECT 73 Q_OBJECT
57public: 74public:
58 CategoryTabWidget( QWidget* parent ); 75 CategoryTabWidget( QWidget* parent );
59 void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, 76 void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder,
60 const QList<FileSystem> &); 77 const QList<FileSystem> &);
61 void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); 78// void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs);
62 void updateLink(const QString& linkfile); 79 void updateLink(const QString& linkfile);
63 void setBusy(bool on); 80 void setBusy(bool on);
64 QString getAllDocLinkInfo() const; 81 QString getAllDocLinkInfo() const;
65 LauncherView *view( const QString &id ); 82 LauncherView *view( const QString &id );
66 void setBusyIndicatorType ( const QString &type ); 83 void setBusyIndicatorType ( const QString &type );
84 DocumentTab *fileSel;
67signals: 85signals:
68 void selected(const QString&); 86 void selected(const QString&);
69 void clicked(const AppLnk*); 87 void clicked(const AppLnk*);
70 void rightPressed(AppLnk*); 88 void rightPressed(AppLnk*);
71 89 void ofileSel(const DocLnk &);
72public slots: 90public slots:
73 void nextTab(); 91 void nextTab();
74 void prevTab(); 92 void prevTab();
75 void showTab(const QString&); 93 void showTab(const QString&);
76 94 void clickie(const DocLnk&);
95 void clickie(const QString &);
77protected slots: 96protected slots:
78 void tabProperties(); 97 void tabProperties();
79 98
80protected: 99protected:
81 void setTabAppearance( const QString &id, Config &cfg ); 100 void setTabAppearance( const QString &id, Config &cfg );
82 void paletteChange( const QPalette &p ); 101 void paletteChange( const QPalette &p );