summaryrefslogtreecommitdiff
path: root/core/launcher
authoralwin <alwin>2004-02-22 21:40:20 (UTC)
committer alwin <alwin>2004-02-22 21:40:20 (UTC)
commitcaa64a311d665e4d5c75cc9d45e0b3cd8ef2fdf1 (patch) (unidiff)
treeef464310a07582a7179a4d136b555b806f43fe1a /core/launcher
parent936fc191ac5756a4de2e8b2a83c8bc910f918b95 (diff)
downloadopie-caa64a311d665e4d5c75cc9d45e0b3cd8ef2fdf1.zip
opie-caa64a311d665e4d5c75cc9d45e0b3cd8ef2fdf1.tar.gz
opie-caa64a311d665e4d5c75cc9d45e0b3cd8ef2fdf1.tar.bz2
when inserting a new media without .opiestorage.cf a dialog comes
setting up this file.
Diffstat (limited to 'core/launcher') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp7
-rw-r--r--core/launcher/mediadlg.cpp31
-rw-r--r--core/launcher/mediadlg.h29
-rw-r--r--core/launcher/server.pro12
4 files changed, 74 insertions, 5 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 9736e65..39dc7c9 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,69 +1,70 @@
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** 5**
6** This file may be distributed and/or modified under the terms of the 6** 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 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "documentlist.h" 20#include "documentlist.h"
21#include "serverinterface.h" 21#include "serverinterface.h"
22#include "mediadlg.h"
22 23
23#include <opie2/oglobal.h> 24#include <opie2/oglobal.h>
24 25
25#include <qtopia/config.h> 26#include <qtopia/config.h>
26#include <qtopia/mimetype.h> 27#include <qtopia/mimetype.h>
27#include <qtopia/resource.h> 28#include <qtopia/resource.h>
28#include <qtopia/private/categories.h> 29#include <qtopia/private/categories.h>
29#include <qtopia/qpeapplication.h> 30#include <qtopia/qpeapplication.h>
30#include <qtopia/applnk.h> 31#include <qtopia/applnk.h>
31#include <qtopia/storage.h> 32#include <qtopia/storage.h>
32#ifdef Q_WS_QWS 33#ifdef Q_WS_QWS
33#include <qtopia/qcopenvelope_qws.h> 34#include <qtopia/qcopenvelope_qws.h>
34#endif 35#endif
35 36
36#include <qtimer.h> 37#include <qtimer.h>
37#include <qfileinfo.h> 38#include <qfileinfo.h>
38#include <qtextstream.h> 39#include <qtextstream.h>
39#include <qfile.h> 40#include <qfile.h>
40#include <qdir.h> 41#include <qdir.h>
41#include <qpainter.h> 42#include <qpainter.h>
42#include <qimage.h> 43#include <qimage.h>
43#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
44#include <qlistview.h> 45#include <qlistview.h>
45#include <qlist.h> 46#include <qlist.h>
46#include <qpixmap.h> 47#include <qpixmap.h>
47 48
48 49
49AppLnkSet *DocumentList::appLnkSet = 0; 50AppLnkSet *DocumentList::appLnkSet = 0;
50 51
51static const int MAX_SEARCH_DEPTH = 10; 52static const int MAX_SEARCH_DEPTH = 10;
52 53
53 54
54class DocumentListPrivate : public QObject { 55class DocumentListPrivate : public QObject {
55 Q_OBJECT 56 Q_OBJECT
56public: 57public:
57 DocumentListPrivate( ServerInterface *gui ); 58 DocumentListPrivate( ServerInterface *gui );
58 ~DocumentListPrivate(); 59 ~DocumentListPrivate();
59 60
60 void initialize(); 61 void initialize();
61 62
62 const QString nextFile(); 63 const QString nextFile();
63 const DocLnk *iterate(); 64 const DocLnk *iterate();
64 bool store( DocLnk* dl ); 65 bool store( DocLnk* dl );
65 void estimatedPercentScanned(); 66 void estimatedPercentScanned();
66 void appendDocpath(FileSystem*); 67 void appendDocpath(FileSystem*);
67 68
68 69
69 DocLnkSet dls; 70 DocLnkSet dls;
@@ -389,100 +390,100 @@ void DocumentList::sendAllDocLinks()
389 390
390 391
391 392
392 393
393 394
394 395
395 396
396 397
397 398
398 399
399 400
400 401
401 402
402 403
403 404
404 405
405 406
406 407
407 408
408 409
409 410
410 411
411 412
412DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) 413DocumentListPrivate::DocumentListPrivate( ServerInterface *gui )
413{ 414{
414 storage = new StorageInfo( this ); 415 storage = new StorageInfo( this );
415 serverGui = gui; 416 serverGui = gui;
416 if ( serverGui ) { 417 if ( serverGui ) {
417 sendAppLnks = serverGui->requiresApplications(); 418 sendAppLnks = serverGui->requiresApplications();
418 sendDocLnks = serverGui->requiresDocuments(); 419 sendDocLnks = serverGui->requiresDocuments();
419 } else { 420 } else {
420 sendAppLnks = false; 421 sendAppLnks = false;
421 sendDocLnks = false; 422 sendDocLnks = false;
422 } 423 }
423 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { 424 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
424 listDirs[i] = 0; 425 listDirs[i] = 0;
425 lists[i] = 0; 426 lists[i] = 0;
426 listPositions[i] = 0; 427 listPositions[i] = 0;
427 } 428 }
428 initialize(); 429 initialize();
429 tid = 0; 430 tid = 0;
430} 431}
431 432
432void DocumentListPrivate::appendDocpath(FileSystem*fs) 433void DocumentListPrivate::appendDocpath(FileSystem*fs)
433{ 434{
434 QDir defPath(fs->path()+"/Documents"); 435 QDir defPath(fs->path()+"/Documents");
435 QFileInfo f(fs->path()+"/.opiestorage.cf"); 436 QFileInfo f(fs->path()+"/.opiestorage.cf");
436 if (!f.exists()) { 437 if (!f.exists()) {
437 if (defPath.exists()) { 438 Mediadlg dlg(fs);
438 docPaths+=defPath.path(); 439 if (QDialog::Accepted != QPEApplication::execDialog( &dlg )) {
440 return;
439 } 441 }
440 return;
441 } 442 }
442 Config conf(f.filePath(), Config::File ); 443 Config conf(f.filePath(), Config::File );
443 conf.setGroup("subdirs"); 444 conf.setGroup("subdirs");
444 bool read_all = conf.readBoolEntry("wholemedia",true); 445 bool read_all = conf.readBoolEntry("wholemedia",true);
445 if (read_all) { 446 if (read_all) {
446 docPaths+=fs->path(); 447 docPaths+=fs->path();
447 return; 448 return;
448 } 449 }
449 QStringList subDirs = conf.readListEntry("subdirs",':'); 450 QStringList subDirs = conf.readListEntry("subdirs",':');
450 if (subDirs.isEmpty()) { 451 if (subDirs.isEmpty()) {
451 if (defPath.exists()) { 452 if (defPath.exists()) {
452 docPaths+=defPath.path(); 453 docPaths+=defPath.path();
453 } 454 }
454 return; 455 return;
455 } 456 }
456 for (unsigned c = 0; c < subDirs.count();++c) { 457 for (unsigned c = 0; c < subDirs.count();++c) {
457 QDir docDir(QString(fs->path()+"/"+subDirs[c])); 458 QDir docDir(QString(fs->path()+"/"+subDirs[c]));
458 if (docDir.exists()) { 459 if (docDir.exists()) {
459 docPaths+=docDir.path(); 460 docPaths+=docDir.path();
460 } 461 }
461 } 462 }
462} 463}
463 464
464void DocumentListPrivate::initialize() 465void DocumentListPrivate::initialize()
465{ 466{
466 // Reset 467 // Reset
467 dls.clear(); 468 dls.clear();
468 docPaths.clear(); 469 docPaths.clear();
469 reference.clear(); 470 reference.clear();
470 471
471 QDir docDir( QPEApplication::documentDir() ); 472 QDir docDir( QPEApplication::documentDir() );
472 if ( docDir.exists() ) 473 if ( docDir.exists() )
473 docPaths += QPEApplication::documentDir(); 474 docPaths += QPEApplication::documentDir();
474 int i = 1; 475 int i = 1;
475 const QList<FileSystem> &fs = storage->fileSystems(); 476 const QList<FileSystem> &fs = storage->fileSystems();
476 QListIterator<FileSystem> it( fs ); 477 QListIterator<FileSystem> it( fs );
477 for ( ; it.current(); ++it ) { 478 for ( ; it.current(); ++it ) {
478 if ( (*it)->isRemovable() ) { 479 if ( (*it)->isRemovable() ) {
479 appendDocpath((*it)); 480 appendDocpath((*it));
480 ++i; 481 ++i;
481 } 482 }
482 } 483 }
483 484
484 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) { 485 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) {
485 if ( listDirs[i] ) { 486 if ( listDirs[i] ) {
486 delete listDirs[i]; 487 delete listDirs[i];
487 listDirs[i] = 0; 488 listDirs[i] = 0;
488 } 489 }
diff --git a/core/launcher/mediadlg.cpp b/core/launcher/mediadlg.cpp
new file mode 100644
index 0000000..6448863
--- a/dev/null
+++ b/core/launcher/mediadlg.cpp
@@ -0,0 +1,31 @@
1#include "mediadlg.h"
2#include "mediumwidget.h"
3#include <qtopia/storage.h>
4#include <qpixmap.h>
5#include <qlayout.h>
6
7Mediadlg::Mediadlg(FileSystem*fs,QWidget *parent, const char *name, bool modal, WFlags fl)
8 : QDialog(parent,name,modal,fl)
9{
10 m_fs = fs;
11 m_widget = 0;
12 init();
13}
14
15Mediadlg::~Mediadlg()
16{
17}
18
19void Mediadlg::init()
20{
21 if (!m_fs) return;
22 m_lay = new QVBoxLayout( this );
23 m_widget = new MediumMountSetting::MediumMountWidget(m_fs->path(),QPixmap(),this);
24 m_lay->addWidget(m_widget);
25}
26
27void Mediadlg::accept()
28{
29 if (m_widget) m_widget->writeConfig();
30 QDialog::accept();
31}
diff --git a/core/launcher/mediadlg.h b/core/launcher/mediadlg.h
new file mode 100644
index 0000000..f4d552d
--- a/dev/null
+++ b/core/launcher/mediadlg.h
@@ -0,0 +1,29 @@
1#ifndef __MEDIA_DLG_H
2#define __MEDIA_DLG_H
3
4#include <qdialog.h>
5
6namespace MediumMountSetting {
7 class MediumMountWidget;
8}
9class FileSystem;
10class QVBoxLayout;
11
12class Mediadlg:public QDialog
13{
14 Q_OBJECT
15public:
16 Mediadlg(FileSystem*,QWidget *parent = 0, const char *name = 0 , bool modal = TRUE, WFlags fl = 0);
17 virtual ~Mediadlg();
18protected slots:
19 virtual void accept();
20
21protected:
22 MediumMountSetting::MediumMountWidget*m_widget;
23 FileSystem*m_fs;
24 QVBoxLayout *m_lay;
25 void init();
26};
27
28#endif
29
diff --git a/core/launcher/server.pro b/core/launcher/server.pro
index f82c741..e341e1a 100644
--- a/core/launcher/server.pro
+++ b/core/launcher/server.pro
@@ -2,123 +2,131 @@ TEMPLATE = app
2 2
3 CONFIG += qtopia warn_on release 3 CONFIG += qtopia warn_on release
4 4
5 DESTDIR = $$(OPIEDIR)/bin 5 DESTDIR = $$(OPIEDIR)/bin
6 6
7 HEADERS += server.h \ 7 HEADERS += server.h \
8 serverinterface.h \ 8 serverinterface.h \
9 launchertab.h \ 9 launchertab.h \
10 documentlist.h \ 10 documentlist.h \
11 appicons.h \ 11 appicons.h \
12 taskbar.h \ 12 taskbar.h \
13 runningappbar.h \ 13 runningappbar.h \
14 applauncher.h \ 14 applauncher.h \
15 stabmon.h \ 15 stabmon.h \
16 inputmethods.h \ 16 inputmethods.h \
17 systray.h \ 17 systray.h \
18 wait.h \ 18 wait.h \
19 shutdownimpl.h \ 19 shutdownimpl.h \
20 launcher.h \ 20 launcher.h \
21 launcherview.h \ 21 launcherview.h \
22 $$(OPIEDIR)/core/apps/calibrate/calibrate.h \ 22 $$(OPIEDIR)/core/apps/calibrate/calibrate.h \
23 startmenu.h \ 23 startmenu.h \
24 transferserver.h \ 24 transferserver.h \
25 qcopbridge.h \ 25 qcopbridge.h \
26 packageslave.h \ 26 packageslave.h \
27 irserver.h \ 27 irserver.h \
28 firstuse.h \ 28 firstuse.h \
29 $$(OPIEDIR)/rsync/buf.h \ 29 $$(OPIEDIR)/rsync/buf.h \
30 $$(OPIEDIR)/rsync/checksum.h \ 30 $$(OPIEDIR)/rsync/checksum.h \
31 $$(OPIEDIR)/rsync/command.h \ 31 $$(OPIEDIR)/rsync/command.h \
32 $$(OPIEDIR)/rsync/emit.h \ 32 $$(OPIEDIR)/rsync/emit.h \
33 $$(OPIEDIR)/rsync/job.h \ 33 $$(OPIEDIR)/rsync/job.h \
34 $$(OPIEDIR)/rsync/netint.h \ 34 $$(OPIEDIR)/rsync/netint.h \
35 $$(OPIEDIR)/rsync/protocol.h \ 35 $$(OPIEDIR)/rsync/protocol.h \
36 $$(OPIEDIR)/rsync/prototab.h \ 36 $$(OPIEDIR)/rsync/prototab.h \
37 $$(OPIEDIR)/rsync/rsync.h \ 37 $$(OPIEDIR)/rsync/rsync.h \
38 $$(OPIEDIR)/rsync/search.h \ 38 $$(OPIEDIR)/rsync/search.h \
39 $$(OPIEDIR)/rsync/stream.h \ 39 $$(OPIEDIR)/rsync/stream.h \
40 $$(OPIEDIR)/rsync/sumset.h \ 40 $$(OPIEDIR)/rsync/sumset.h \
41 $$(OPIEDIR)/rsync/trace.h \ 41 $$(OPIEDIR)/rsync/trace.h \
42 $$(OPIEDIR)/rsync/types.h \ 42 $$(OPIEDIR)/rsync/types.h \
43 $$(OPIEDIR)/rsync/util.h \ 43 $$(OPIEDIR)/rsync/util.h \
44 $$(OPIEDIR)/rsync/whole.h \ 44 $$(OPIEDIR)/rsync/whole.h \
45 $$(OPIEDIR)/rsync/config_rsync.h \ 45 $$(OPIEDIR)/rsync/config_rsync.h \
46 $$(OPIEDIR)/rsync/qrsync.h \ 46 $$(OPIEDIR)/rsync/qrsync.h \
47 syncdialog.h \ 47 syncdialog.h \
48 serverapp.h \ 48 serverapp.h \
49 qprocess.h \ 49 qprocess.h \
50 screensaver.h 50 screensaver.h \
51 $$(OPIEDIR)/noncore/settings/mediummount/mediumwidget.h \
52 mediadlg.h
51 53
52 SOURCES += server.cpp \ 54 SOURCES += server.cpp \
53 serverinterface.cpp \ 55 serverinterface.cpp \
54 launchertab.cpp \ 56 launchertab.cpp \
55 documentlist.cpp \ 57 documentlist.cpp \
56 appicons.cpp \ 58 appicons.cpp \
57 taskbar.cpp \ 59 taskbar.cpp \
58 runningappbar.cpp \ 60 runningappbar.cpp \
59 applauncher.cpp \ 61 applauncher.cpp \
60 stabmon.cpp \ 62 stabmon.cpp \
61 inputmethods.cpp \ 63 inputmethods.cpp \
62 systray.cpp \ 64 systray.cpp \
63 wait.cpp \ 65 wait.cpp \
64 shutdownimpl.cpp \ 66 shutdownimpl.cpp \
65 launcher.cpp \ 67 launcher.cpp \
66 launcherview.cpp \ 68 launcherview.cpp \
67 $$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \ 69 $$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \
68 transferserver.cpp \ 70 transferserver.cpp \
69 packageslave.cpp \ 71 packageslave.cpp \
70 irserver.cpp \ 72 irserver.cpp \
71 qcopbridge.cpp \ 73 qcopbridge.cpp \
72 startmenu.cpp \ 74 startmenu.cpp \
73 main.cpp \ 75 main.cpp \
74 firstuse.cpp \ 76 firstuse.cpp \
75 $$(OPIEDIR)/rsync/base64.c \ 77 $$(OPIEDIR)/rsync/base64.c \
76 $$(OPIEDIR)/rsync/buf.c \ 78 $$(OPIEDIR)/rsync/buf.c \
77 $$(OPIEDIR)/rsync/checksum.c \ 79 $$(OPIEDIR)/rsync/checksum.c \
78 $$(OPIEDIR)/rsync/command.c \ 80 $$(OPIEDIR)/rsync/command.c \
79 $$(OPIEDIR)/rsync/delta.c \ 81 $$(OPIEDIR)/rsync/delta.c \
80 $$(OPIEDIR)/rsync/emit.c \ 82 $$(OPIEDIR)/rsync/emit.c \
81 $$(OPIEDIR)/rsync/hex.c \ 83 $$(OPIEDIR)/rsync/hex.c \
82 $$(OPIEDIR)/rsync/job.c \ 84 $$(OPIEDIR)/rsync/job.c \
83 $$(OPIEDIR)/rsync/mdfour.c \ 85 $$(OPIEDIR)/rsync/mdfour.c \
84 $$(OPIEDIR)/rsync/mksum.c \ 86 $$(OPIEDIR)/rsync/mksum.c \
85 $$(OPIEDIR)/rsync/msg.c \ 87 $$(OPIEDIR)/rsync/msg.c \
86 $$(OPIEDIR)/rsync/netint.c \ 88 $$(OPIEDIR)/rsync/netint.c \
87 $$(OPIEDIR)/rsync/patch.c \ 89 $$(OPIEDIR)/rsync/patch.c \
88 $$(OPIEDIR)/rsync/prototab.c \ 90 $$(OPIEDIR)/rsync/prototab.c \
89 $$(OPIEDIR)/rsync/readsums.c \ 91 $$(OPIEDIR)/rsync/readsums.c \
90 $$(OPIEDIR)/rsync/scoop.c \ 92 $$(OPIEDIR)/rsync/scoop.c \
91 $$(OPIEDIR)/rsync/search.c \ 93 $$(OPIEDIR)/rsync/search.c \
92 $$(OPIEDIR)/rsync/stats.c \ 94 $$(OPIEDIR)/rsync/stats.c \
93 $$(OPIEDIR)/rsync/stream.c \ 95 $$(OPIEDIR)/rsync/stream.c \
94 $$(OPIEDIR)/rsync/sumset.c \ 96 $$(OPIEDIR)/rsync/sumset.c \
95 $$(OPIEDIR)/rsync/trace.c \ 97 $$(OPIEDIR)/rsync/trace.c \
96 $$(OPIEDIR)/rsync/tube.c \ 98 $$(OPIEDIR)/rsync/tube.c \
97 $$(OPIEDIR)/rsync/util.c \ 99 $$(OPIEDIR)/rsync/util.c \
98 $$(OPIEDIR)/rsync/version.c \ 100 $$(OPIEDIR)/rsync/version.c \
99 $$(OPIEDIR)/rsync/whole.c \ 101 $$(OPIEDIR)/rsync/whole.c \
100 $$(OPIEDIR)/rsync/qrsync.cpp \ 102 $$(OPIEDIR)/rsync/qrsync.cpp \
101 syncdialog.cpp \ 103 syncdialog.cpp \
102 serverapp.cpp \ 104 serverapp.cpp \
103 qprocess.cpp \ 105 qprocess.cpp \
104 qprocess_unix.cpp \ 106 qprocess_unix.cpp \
105 screensaver.cpp 107 screensaver.cpp \
108 $$(OPIEDIR)/noncore/settings/mediummount/mediumwidget.cc \
109 mediadlg.cpp
106 110
107 111
108INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate 112INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate
109 DEPENDPATH+= $(OPIEDIR)/core/apps/calibrate 113 DEPENDPATH+= $(OPIEDIR)/core/apps/calibrate
110 114
111INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync 115INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync
112 DEPENDPATH+= $(OPIEDIR)/rsync 116 DEPENDPATH+= $(OPIEDIR)/rsync
113 117
118INCLUDEPATH += $(OPIEDIR)/noncore/settings/mediummount
119 DEPENDPATH+= $(OPIEDIR)/noncore/settings/mediummount
120
121
114 TARGET = qpe 122 TARGET = qpe
115 123
116#needs OWait and ODevice 124#needs OWait and ODevice
117CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) 125CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
118contains( CONFTEST, y ){ 126contains( CONFTEST, y ){
119 LIBS += -lqpe -lopiecore2 -lopieui2 127 LIBS += -lqpe -lopiecore2 -lopieui2
120}else{ 128}else{
121 LIBS+= -lcrypt -lqpe -lopiecore2 -lopieui2 129 LIBS+= -lcrypt -lqpe -lopiecore2 -lopieui2
122} 130}
123 131
124include ( $(OPIEDIR)/include.pro ) 132include ( $(OPIEDIR)/include.pro )