-rw-r--r-- | core/launcher/mediummountgui.cpp | 26 | ||||
-rw-r--r-- | core/launcher/mediummountgui.h | 5 |
2 files changed, 28 insertions, 3 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index 2454efa..8307eb6 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp @@ -42,47 +42,66 @@ void MediumMountGui::readConfig(){ checkagain = cfg.readBoolEntry("check", false); cfg.setGroup("mimetypes"); checkmimeaudio = cfg.readBoolEntry("audio", false); checkmimeimage = cfg.readBoolEntry("image", true); checkmimetext = cfg.readBoolEntry("text", true); checkmimevideo = cfg.readBoolEntry("video", true); cfg.setGroup("dirs"); limittodirs = cfg.readEntry("dirs", "/"); } bool MediumMountGui::check() { return checkagain; } +QStringList MediumMountGui::dirs() { + QStringList list = QStringList::split(",", limittodirs ); + return list; +} void MediumMountGui::writeConfig() { OConfig cfg (mediumPath +"/.opiestorage.cf"); cfg.setGroup("main"); cfg.writeEntry("check", AskBox->isChecked() ); cfg.setGroup("mimetypes"); cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); cfg.writeEntry("image",CheckBoxImage->isChecked() ); cfg.writeEntry("text",CheckBoxImage->isChecked() ); cfg.writeEntry("video",CheckBoxVideo->isChecked() ); cfg.setGroup("dirs"); - cfg.writeEntry("dirs", "/"); + cfg.writeEntry("dirs", "/"); + + + if (checkmimeaudio) { + mimeTypeList += ("audio//*"); + } + if (checkmimetext) { + mimeTypeList += ("text//*"); + } + if (checkmimeaudio) { + mimeTypeList += ("video//*"); + } + if (checkmimeaudio) { + mimeTypeList += ("image//*"); + } + } void MediumMountGui::startGui() { QPixmap image = Resource::loadPixmap( "HelpBrowser"); Text_2 = new QLabel( this ); Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); Text_2->setPixmap( image ); Text = new QLabel( this, "Text" ); Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); // media box GroupBox1 = new QGroupBox( this, "GroupBox1" ); @@ -144,23 +163,28 @@ void MediumMountGui::startGui() { quit_2 = new QPushButton( this ); quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); quit_2->setText( tr( "No" ) ); QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); } void MediumMountGui::yesPressed() { writeConfig(); // and do something } + +QStringList MediumMountGui::mimeTypes(){ + return mimeTypeList; +} + void MediumMountGui::noPressed() { close(); } MediumMountGui::~MediumMountGui(){ } diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h index 700a922..a7f3701 100644 --- a/core/launcher/mediummountgui.h +++ b/core/launcher/mediummountgui.h @@ -25,39 +25,40 @@ protected: QPushButton* quit_2; QLabel* DirSelectText_2; QLineEdit* LineEdit1; QPushButton* PushButton3; QLabel* DirSelectText; QLabel* Text_2; QLabel* Text; QGroupBox* GroupBox1; QCheckBox* CheckBoxAudio; QCheckBox* CheckBoxImage; QCheckBox* CheckBoxText; QCheckBox* CheckBoxVideo; QCheckBox* AskBox; public: bool check(); - + QStringList mimeTypes(); + QStringList dirs(); private: void startGui(); void readConfig(); void writeConfig(); private slots: void yesPressed(); void noPressed(); private: QString mediumPath; bool checkagain; bool checkmimeaudio; bool checkmimeimage; bool checkmimetext; bool checkmimevideo; QString limittodirs; - +QStringList mimeTypeList; }; #endif
\ No newline at end of file |