-rw-r--r-- | core/launcher/launcher.cpp | 10 | ||||
-rw-r--r-- | core/launcher/mediummountgui.cpp | 54 | ||||
-rw-r--r-- | core/launcher/mediummountgui.h | 17 |
3 files changed, 46 insertions, 35 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index d1df4cc..f9c6c02 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -548,46 +548,52 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
548 | docsFolder->appendFrom( *tmp ); | 548 | docsFolder->appendFrom( *tmp ); |
549 | delete tmp; | 549 | delete tmp; |
550 | // find out wich filesystems are new in this round | 550 | // find out wich filesystems are new in this round |
551 | // We will do this by having a timestamp inside each mountpoint | 551 | // We will do this by having a timestamp inside each mountpoint |
552 | // if the current timestamp doesn't match this is a new file system and | 552 | // if the current timestamp doesn't match this is a new file system and |
553 | // come up with our MediumMountGui :) let the hacking begin | 553 | // come up with our MediumMountGui :) let the hacking begin |
554 | int stamp = uidgen.generate(); | 554 | int stamp = uidgen.generate(); |
555 | 555 | ||
556 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 556 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
557 | StorageInfo storage; | 557 | StorageInfo storage; |
558 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 558 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
559 | QListIterator<FileSystem> it ( fileSystems ); | 559 | QListIterator<FileSystem> it ( fileSystems ); |
560 | |||
561 | |||
560 | for ( ; it.current(); ++it ) { | 562 | for ( ; it.current(); ++it ) { |
561 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 563 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
562 | qWarning("%s is removeable", (*it)->path().latin1() ); | 564 | qWarning("%s is removeable", (*it)->path().latin1() ); |
563 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); | 565 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); |
564 | cfg.setGroup("main"); | 566 | cfg.setGroup("main"); |
565 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 567 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
566 | if( stamp == m_timeStamp ){ // ok we know this card | 568 | if( stamp == m_timeStamp ){ // ok we know this card |
567 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 569 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
568 | // we need to scan the list now. Hopefully the cache will be there | 570 | // we need to scan the list now. Hopefully the cache will be there |
569 | // read the mimetypes from the config and search for documents | 571 | // read the mimetypes from the config and search for documents |
570 | QStringList mimetypes = configToMime( &cfg); | 572 | QStringList mimetypes = configToMime( &cfg); |
571 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 573 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
572 | docsFolder->appendFrom( *tmp ); | 574 | docsFolder->appendFrom( *tmp ); |
573 | delete tmp; | 575 | delete tmp; |
574 | 576 | ||
575 | }else{ // come up with the gui cause this a new card | 577 | }else{ // come up with the gui cause this a new card |
576 | MediumMountGui medium((*it)->path() ); | 578 | MediumMountGui medium(&cfg, (*it)->path() ); |
577 | if( medium.check() ){ // we did not ask before or ask again is off | 579 | if( medium.check() ){ // we did not ask before or ask again is off |
578 | if( medium.exec() ){ // he clicked yes so search it | 580 | if( medium.exec() ){ // he clicked yes so search it |
579 | // speicher | 581 | // speicher |
580 | cfg.read(); // cause of a race we need to reread | 582 | //cfg.read(); // cause of a race we need to reread - fixed |
581 | cfg.writeEntry("timestamp", newStamp ); | 583 | cfg.writeEntry("timestamp", newStamp ); |
584 | cfg.write(); | ||
585 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | ||
586 | docsFolder->appendFrom( *tmp ); | ||
587 | delete tmp; | ||
582 | }// no else | 588 | }// no else |
583 | }else{ // we checked | 589 | }else{ // we checked |
584 | // do something different see what we need to do | 590 | // do something different see what we need to do |
585 | // let's see if we should check the device | 591 | // let's see if we should check the device |
586 | cfg.setGroup("main" ); | 592 | cfg.setGroup("main" ); |
587 | bool check = cfg.readBoolEntry("autocheck", true ); | 593 | bool check = cfg.readBoolEntry("autocheck", true ); |
588 | if( check ){ // find the documents | 594 | if( check ){ // find the documents |
589 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 595 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); |
590 | docsFolder->appendFrom( *tmp ); | 596 | docsFolder->appendFrom( *tmp ); |
591 | delete tmp; | 597 | delete tmp; |
592 | } | 598 | } |
593 | } | 599 | } |
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index e0acf4e..8cc2411 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp | |||
@@ -5,109 +5,111 @@ | |||
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | #include <qgroupbox.h> | 6 | #include <qgroupbox.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qtooltip.h> | 11 | #include <qtooltip.h> |
12 | #include <qwhatsthis.h> | 12 | #include <qwhatsthis.h> |
13 | #include <qimage.h> | 13 | #include <qimage.h> |
14 | #include <qpixmap.h> | 14 | #include <qpixmap.h> |
15 | 15 | ||
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/config.h> | ||
18 | |||
17 | #include <opie/oconfig.h> | 19 | #include <opie/oconfig.h> |
18 | 20 | ||
19 | 21 | ||
20 | #include <qapplication.h> | 22 | #include <qapplication.h> |
21 | 23 | ||
22 | 24 | ||
23 | MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) | 25 | MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags ) |
24 | : QDialog( parent, name, true ) { | 26 | : QDialog( parent, name, true ) { |
25 | 27 | ||
26 | 28 | m_cfg = cfg; | |
27 | QWidget *d = QApplication::desktop(); | 29 | QWidget *d = QApplication::desktop(); |
28 | int w=d->width(); | 30 | int w=d->width(); |
29 | int h=d->height(); | 31 | int h=d->height(); |
30 | resize( w , h ); | 32 | resize( w , h ); |
31 | setCaption( tr( "Medium inserted" ) ); | 33 | setCaption( tr( "Medium inserted" ) ); |
32 | 34 | ||
33 | mediumPath = path; | 35 | mediumPath = path; |
34 | readConfig(); | 36 | readConfig(); |
35 | startGui(); | 37 | startGui(); |
36 | } | 38 | } |
37 | 39 | ||
38 | void MediumMountGui::readConfig(){ | 40 | void MediumMountGui::readConfig(){ |
39 | 41 | ||
40 | OConfig cfg (mediumPath +"/.opiestorage.cf"); | 42 | //OConfig cfg (mediumPath +"/.opiestorage.cf"); |
41 | cfg.setGroup("main"); | 43 | m_cfg->setGroup("main"); |
42 | checkagain = cfg.readBoolEntry("check", false); | 44 | checkagain = m_cfg->readBoolEntry("check", false); |
43 | 45 | ||
44 | cfg.setGroup("mimetypes"); | 46 | m_cfg->setGroup("mimetypes"); |
45 | checkmimeaudio = cfg.readBoolEntry("audio", true); | 47 | checkmimeaudio = m_cfg->readBoolEntry("audio", true); |
46 | checkmimeimage = cfg.readBoolEntry("image", true); | 48 | checkmimeimage = m_cfg->readBoolEntry("image", true); |
47 | checkmimetext = cfg.readBoolEntry("text", true); | 49 | checkmimetext = m_cfg->readBoolEntry("text", true); |
48 | checkmimevideo = cfg.readBoolEntry("video", true); | 50 | checkmimevideo = m_cfg->readBoolEntry("video", true); |
49 | checkmimeall = cfg.readBoolEntry("all", true); | 51 | checkmimeall = m_cfg->readBoolEntry("all", true); |
50 | 52 | ||
51 | cfg.setGroup("dirs"); | 53 | m_cfg->setGroup("dirs"); |
52 | limittodirs = cfg.readEntry("dirs", ""); | 54 | limittodirs = m_cfg->readEntry("dirs", ""); |
53 | } | 55 | } |
54 | 56 | ||
55 | bool MediumMountGui::check() { | 57 | bool MediumMountGui::check() { |
56 | return !checkagain; | 58 | return !checkagain; |
57 | } | 59 | } |
58 | 60 | ||
59 | QStringList MediumMountGui::dirs() { | 61 | QStringList MediumMountGui::dirs() { |
60 | QStringList list = QStringList::split(",", limittodirs ); | 62 | QStringList list = QStringList::split(",", limittodirs ); |
61 | return list; | 63 | return list; |
62 | } | 64 | } |
63 | 65 | ||
64 | void MediumMountGui::writeConfig(bool autocheck) { | 66 | void MediumMountGui::writeConfig(bool autocheck) { |
65 | 67 | ||
66 | OConfig cfg (mediumPath +"/.opiestorage.cf"); | 68 | //OConfig cfg (mediumPath +"/.opiestorage.cf"); |
67 | cfg.setGroup("main"); | 69 | m_cfg->setGroup("main"); |
68 | cfg.writeEntry("check", AskBox->isChecked() ); | 70 | m_cfg->writeEntry("check", AskBox->isChecked() ); |
69 | cfg.writeEntry("autocheck", autocheck ); | 71 | m_cfg->writeEntry("autocheck", autocheck ); |
70 | 72 | ||
71 | cfg.setGroup("mimetypes"); | 73 | m_cfg->setGroup("mimetypes"); |
72 | 74 | ||
73 | cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); | 75 | m_cfg->writeEntry("audio", CheckBoxAudio->isChecked() ); |
74 | cfg.writeEntry("image",CheckBoxImage->isChecked() ); | 76 | m_cfg->writeEntry("image",CheckBoxImage->isChecked() ); |
75 | cfg.writeEntry("text",CheckBoxImage->isChecked() ); | 77 | m_cfg->writeEntry("text",CheckBoxImage->isChecked() ); |
76 | cfg.writeEntry("video",CheckBoxVideo->isChecked() ); | 78 | m_cfg->writeEntry("video",CheckBoxVideo->isChecked() ); |
77 | cfg.writeEntry("all",CheckBoxAll->isChecked() ); | 79 | m_cfg->writeEntry("all",CheckBoxAll->isChecked() ); |
78 | 80 | ||
79 | cfg.setGroup("dirs"); | 81 | m_cfg->setGroup("dirs"); |
80 | cfg.writeEntry("dirs", ""); | 82 | m_cfg->writeEntry("dirs", ""); |
81 | 83 | ||
82 | 84 | ||
83 | // if all is checked then add only "QString::null" to the list. | 85 | // if all is checked then add only "QString::null" to the list. |
84 | if (checkmimeall) { | 86 | if (checkmimeall) { |
85 | mimeTypeList.clear(); | 87 | mimeTypeList.clear(); |
86 | mimeTypeList += QString::null; | 88 | mimeTypeList += QString::null; |
87 | } else { | 89 | } else { |
88 | if (checkmimeaudio) { | 90 | if (checkmimeaudio) { |
89 | mimeTypeList += ("audio/*"); | 91 | mimeTypeList += ("audio/*"); |
90 | } | 92 | } |
91 | if (checkmimetext) { | 93 | if (checkmimetext) { |
92 | mimeTypeList += ("text/*"); | 94 | mimeTypeList += ("text/*"); |
93 | } | 95 | } |
94 | if (checkmimevideo) { | 96 | if (checkmimevideo) { |
95 | mimeTypeList += ("video/*"); | 97 | mimeTypeList += ("video/*"); |
96 | } | 98 | } |
97 | if (checkmimeimage) { | 99 | if (checkmimeimage) { |
98 | mimeTypeList += ("image/*"); | 100 | mimeTypeList += ("image/*"); |
99 | } | 101 | } |
100 | } | 102 | } |
101 | cfg.write(); // not really needed here but just to be sure | 103 | m_cfg->write(); // not really needed here but just to be sure |
102 | } | 104 | } |
103 | 105 | ||
104 | void MediumMountGui::startGui() { | 106 | void MediumMountGui::startGui() { |
105 | 107 | ||
106 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); | 108 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); |
107 | 109 | ||
108 | Text_2 = new QLabel( this ); | 110 | Text_2 = new QLabel( this ); |
109 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); | 111 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); |
110 | Text_2->setPixmap( image ); | 112 | Text_2->setPixmap( image ); |
111 | 113 | ||
112 | Text = new QLabel( this, "Text" ); | 114 | Text = new QLabel( this, "Text" ); |
113 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); | 115 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); |
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h index 2e04f94..8292c3a 100644 --- a/core/launcher/mediummountgui.h +++ b/core/launcher/mediummountgui.h | |||
@@ -2,67 +2,70 @@ | |||
2 | #define MEDIUMMOUNTGUI_H | 2 | #define MEDIUMMOUNTGUI_H |
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | class QVBoxLayout; | 6 | class QVBoxLayout; |
7 | class QHBoxLayout; | 7 | class QHBoxLayout; |
8 | class QGridLayout; | 8 | class QGridLayout; |
9 | class QCheckBox; | 9 | class QCheckBox; |
10 | class QGroupBox; | 10 | class QGroupBox; |
11 | class QLabel; | 11 | class QLabel; |
12 | class QLineEdit; | 12 | class QLineEdit; |
13 | class QPushButton; | 13 | class QPushButton; |
14 | class Config; | ||
14 | 15 | ||
15 | class MediumMountGui : public QDialog | 16 | class MediumMountGui : public QDialog |
16 | { | 17 | { |
17 | Q_OBJECT | 18 | Q_OBJECT |
18 | 19 | ||
19 | public: | 20 | public: |
20 | MediumMountGui( const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); | 21 | MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); |
21 | ~MediumMountGui(); | 22 | ~MediumMountGui(); |
22 | 23 | ||
23 | protected: | 24 | protected: |
24 | QPushButton* quit; | 25 | QPushButton* quit; |
25 | QPushButton* quit_2; | 26 | QPushButton* quit_2; |
26 | QLabel* DirSelectText_2; | 27 | QLabel* DirSelectText_2; |
27 | QLineEdit* LineEdit1; | 28 | QLineEdit* LineEdit1; |
28 | QPushButton* PushButton3; | 29 | QPushButton* PushButton3; |
29 | QLabel* DirSelectText; | 30 | QLabel* DirSelectText; |
30 | QLabel* Text_2; | 31 | QLabel* Text_2; |
31 | QLabel* Text; | 32 | QLabel* Text; |
32 | QGroupBox* GroupBox1; | 33 | QGroupBox* GroupBox1; |
33 | QCheckBox* CheckBoxAudio; | 34 | QCheckBox* CheckBoxAudio; |
34 | QCheckBox* CheckBoxImage; | 35 | QCheckBox* CheckBoxImage; |
35 | QCheckBox* CheckBoxText; | 36 | QCheckBox* CheckBoxText; |
36 | QCheckBox* CheckBoxVideo; | 37 | QCheckBox* CheckBoxVideo; |
37 | QCheckBox* CheckBoxAll; | 38 | QCheckBox* CheckBoxAll; |
38 | QCheckBox* CheckBoxLink; | 39 | QCheckBox* CheckBoxLink; |
39 | QCheckBox* AskBox; | 40 | QCheckBox* AskBox; |
40 | 41 | ||
42 | |||
41 | public: | 43 | public: |
42 | bool check(); | 44 | bool check(); |
43 | QStringList mimeTypes(); | 45 | QStringList mimeTypes(); |
44 | QStringList dirs(); | 46 | QStringList dirs(); |
45 | private: | 47 | private: |
46 | void startGui(); | 48 | void startGui(); |
47 | void readConfig(); | 49 | void readConfig(); |
48 | void writeConfig(bool checkagain); | 50 | void writeConfig(bool checkagain); |
49 | 51 | ||
50 | private slots: | 52 | private slots: |
51 | void yesPressed(); | 53 | void yesPressed(); |
52 | void noPressed(); | 54 | void noPressed(); |
53 | void deactivateOthers(); | 55 | void deactivateOthers(); |
54 | private: | 56 | private: |
55 | QString mediumPath; | 57 | QString mediumPath; |
56 | 58 | ||
57 | bool checkagain; | 59 | bool checkagain:1; |
58 | bool checkmimeaudio; | 60 | bool checkmimeaudio:1; |
59 | bool checkmimeimage; | 61 | bool checkmimeimage:1; |
60 | bool checkmimetext; | 62 | bool checkmimetext:1; |
61 | bool checkmimevideo; | 63 | bool checkmimevideo:1; |
62 | bool checkmimeall; | 64 | bool checkmimeall:1; |
63 | QString limittodirs; | 65 | QString limittodirs; |
64 | QStringList mimeTypeList; | 66 | QStringList mimeTypeList; |
67 | Config *m_cfg; | ||
65 | 68 | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | #endif | 71 | #endif |