-rw-r--r-- | core/launcher/launcher.cpp | 10 | ||||
-rw-r--r-- | core/launcher/mediummountgui.cpp | 56 | ||||
-rw-r--r-- | core/launcher/mediummountgui.h | 17 |
3 files changed, 47 insertions, 36 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 @@ -556,8 +556,10 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: QString newStamp = QString::number( stamp ); // generates newtime Stamp StorageInfo storage; const QList<FileSystem> &fileSystems = storage.fileSystems(); QListIterator<FileSystem> it ( fileSystems ); + + for ( ; it.current(); ++it ) { if ( (*it)->isRemovable() ) { // let's find out if we should search on it qWarning("%s is removeable", (*it)->path().latin1() ); OConfig cfg( (*it)->path() + "/.opiestorage.cf"); @@ -572,14 +574,18 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: docsFolder->appendFrom( *tmp ); delete tmp; }else{ // come up with the gui cause this a new card - MediumMountGui medium((*it)->path() ); + MediumMountGui medium(&cfg, (*it)->path() ); if( medium.check() ){ // we did not ask before or ask again is off if( medium.exec() ){ // he clicked yes so search it // speicher - cfg.read(); // cause of a race we need to reread + //cfg.read(); // cause of a race we need to reread - fixed cfg.writeEntry("timestamp", newStamp ); + cfg.write(); + tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); + docsFolder->appendFrom( *tmp ); + delete tmp; }// no else }else{ // we checked // do something different see what we need to do // let's see if we should check the device 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 @@ -13,18 +13,20 @@ #include <qimage.h> #include <qpixmap.h> #include <qpe/resource.h> +#include <qpe/config.h> + #include <opie/oconfig.h> #include <qapplication.h> -MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) +MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags ) : QDialog( parent, name, true ) { - + m_cfg = cfg; QWidget *d = QApplication::desktop(); int w=d->width(); int h=d->height(); resize( w , h ); @@ -36,21 +38,21 @@ MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const cha } void MediumMountGui::readConfig(){ - OConfig cfg (mediumPath +"/.opiestorage.cf"); - cfg.setGroup("main"); - checkagain = cfg.readBoolEntry("check", false); + //OConfig cfg (mediumPath +"/.opiestorage.cf"); + m_cfg->setGroup("main"); + checkagain = m_cfg->readBoolEntry("check", false); - cfg.setGroup("mimetypes"); - checkmimeaudio = cfg.readBoolEntry("audio", true); - checkmimeimage = cfg.readBoolEntry("image", true); - checkmimetext = cfg.readBoolEntry("text", true); - checkmimevideo = cfg.readBoolEntry("video", true); - checkmimeall = cfg.readBoolEntry("all", true); - - cfg.setGroup("dirs"); - limittodirs = cfg.readEntry("dirs", ""); + m_cfg->setGroup("mimetypes"); + checkmimeaudio = m_cfg->readBoolEntry("audio", true); + checkmimeimage = m_cfg->readBoolEntry("image", true); + checkmimetext = m_cfg->readBoolEntry("text", true); + checkmimevideo = m_cfg->readBoolEntry("video", true); + checkmimeall = m_cfg->readBoolEntry("all", true); + + m_cfg->setGroup("dirs"); + limittodirs = m_cfg->readEntry("dirs", ""); } bool MediumMountGui::check() { return !checkagain; @@ -62,23 +64,23 @@ QStringList MediumMountGui::dirs() { } void MediumMountGui::writeConfig(bool autocheck) { - OConfig cfg (mediumPath +"/.opiestorage.cf"); - cfg.setGroup("main"); - cfg.writeEntry("check", AskBox->isChecked() ); - cfg.writeEntry("autocheck", autocheck ); + //OConfig cfg (mediumPath +"/.opiestorage.cf"); + m_cfg->setGroup("main"); + m_cfg->writeEntry("check", AskBox->isChecked() ); + m_cfg->writeEntry("autocheck", autocheck ); - cfg.setGroup("mimetypes"); + m_cfg->setGroup("mimetypes"); - cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); - cfg.writeEntry("image",CheckBoxImage->isChecked() ); - cfg.writeEntry("text",CheckBoxImage->isChecked() ); - cfg.writeEntry("video",CheckBoxVideo->isChecked() ); - cfg.writeEntry("all",CheckBoxAll->isChecked() ); + m_cfg->writeEntry("audio", CheckBoxAudio->isChecked() ); + m_cfg->writeEntry("image",CheckBoxImage->isChecked() ); + m_cfg->writeEntry("text",CheckBoxImage->isChecked() ); + m_cfg->writeEntry("video",CheckBoxVideo->isChecked() ); + m_cfg->writeEntry("all",CheckBoxAll->isChecked() ); - cfg.setGroup("dirs"); - cfg.writeEntry("dirs", ""); + m_cfg->setGroup("dirs"); + m_cfg->writeEntry("dirs", ""); // if all is checked then add only "QString::null" to the list. if (checkmimeall) { @@ -97,9 +99,9 @@ void MediumMountGui::writeConfig(bool autocheck) { if (checkmimeimage) { mimeTypeList += ("image/*"); } } - cfg.write(); // not really needed here but just to be sure + m_cfg->write(); // not really needed here but just to be sure } void MediumMountGui::startGui() { 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 @@ -10,15 +10,16 @@ class QCheckBox; class QGroupBox; class QLabel; class QLineEdit; class QPushButton; +class Config; class MediumMountGui : public QDialog { Q_OBJECT public: - MediumMountGui( const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); + MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); ~MediumMountGui(); protected: QPushButton* quit; @@ -36,8 +37,9 @@ protected: QCheckBox* CheckBoxVideo; QCheckBox* CheckBoxAll; QCheckBox* CheckBoxLink; QCheckBox* AskBox; + public: bool check(); QStringList mimeTypes(); @@ -53,16 +55,17 @@ private slots: void deactivateOthers(); private: QString mediumPath; - bool checkagain; - bool checkmimeaudio; - bool checkmimeimage; - bool checkmimetext; - bool checkmimevideo; - bool checkmimeall; + bool checkagain:1; + bool checkmimeaudio:1; + bool checkmimeimage:1; + bool checkmimetext:1; + bool checkmimevideo:1; + bool checkmimeall:1; QString limittodirs; QStringList mimeTypeList; + Config *m_cfg; }; #endif |