summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mediummountgui.cpp26
-rw-r--r--core/launcher/mediummountgui.h5
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
@@ -26,79 +26,98 @@ MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const cha
26 26
27 QWidget *d = QApplication::desktop(); 27 QWidget *d = QApplication::desktop();
28 int w=d->width(); 28 int w=d->width();
29 int h=d->height(); 29 int h=d->height();
30 resize( w , h ); 30 resize( w , h );
31 setCaption( tr( "Medium inserted" ) ); 31 setCaption( tr( "Medium inserted" ) );
32 32
33 mediumPath = path; 33 mediumPath = path;
34 readConfig(); 34 readConfig();
35 startGui(); 35 startGui();
36} 36}
37 37
38void MediumMountGui::readConfig(){ 38void MediumMountGui::readConfig(){
39 39
40 OConfig cfg (mediumPath +"/.opiestorage.cf"); 40 OConfig cfg (mediumPath +"/.opiestorage.cf");
41 cfg.setGroup("main"); 41 cfg.setGroup("main");
42 checkagain = cfg.readBoolEntry("check", false); 42 checkagain = cfg.readBoolEntry("check", false);
43 43
44 cfg.setGroup("mimetypes"); 44 cfg.setGroup("mimetypes");
45 checkmimeaudio = cfg.readBoolEntry("audio", false); 45 checkmimeaudio = cfg.readBoolEntry("audio", false);
46 checkmimeimage = cfg.readBoolEntry("image", true); 46 checkmimeimage = cfg.readBoolEntry("image", true);
47 checkmimetext = cfg.readBoolEntry("text", true); 47 checkmimetext = cfg.readBoolEntry("text", true);
48 checkmimevideo = cfg.readBoolEntry("video", true); 48 checkmimevideo = cfg.readBoolEntry("video", true);
49 49
50 cfg.setGroup("dirs"); 50 cfg.setGroup("dirs");
51 limittodirs = cfg.readEntry("dirs", "/"); 51 limittodirs = cfg.readEntry("dirs", "/");
52} 52}
53 53
54bool MediumMountGui::check() { 54bool MediumMountGui::check() {
55 return checkagain; 55 return checkagain;
56} 56}
57 57
58QStringList MediumMountGui::dirs() {
59 QStringList list = QStringList::split(",", limittodirs );
60 return list;
61}
58 62
59void MediumMountGui::writeConfig() { 63void MediumMountGui::writeConfig() {
60 64
61 OConfig cfg (mediumPath +"/.opiestorage.cf"); 65 OConfig cfg (mediumPath +"/.opiestorage.cf");
62 cfg.setGroup("main"); 66 cfg.setGroup("main");
63 cfg.writeEntry("check", AskBox->isChecked() ); 67 cfg.writeEntry("check", AskBox->isChecked() );
64 68
65 cfg.setGroup("mimetypes"); 69 cfg.setGroup("mimetypes");
66 cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); 70 cfg.writeEntry("audio", CheckBoxAudio->isChecked() );
67 cfg.writeEntry("image",CheckBoxImage->isChecked() ); 71 cfg.writeEntry("image",CheckBoxImage->isChecked() );
68 cfg.writeEntry("text",CheckBoxImage->isChecked() ); 72 cfg.writeEntry("text",CheckBoxImage->isChecked() );
69 cfg.writeEntry("video",CheckBoxVideo->isChecked() ); 73 cfg.writeEntry("video",CheckBoxVideo->isChecked() );
70 74
71 cfg.setGroup("dirs"); 75 cfg.setGroup("dirs");
72 cfg.writeEntry("dirs", "/"); 76 cfg.writeEntry("dirs", "/");
77
78
79 if (checkmimeaudio) {
80 mimeTypeList += ("audio//*");
81 }
82 if (checkmimetext) {
83 mimeTypeList += ("text//*");
84 }
85 if (checkmimeaudio) {
86 mimeTypeList += ("video//*");
87 }
88 if (checkmimeaudio) {
89 mimeTypeList += ("image//*");
90 }
91
73} 92}
74 93
75void MediumMountGui::startGui() { 94void MediumMountGui::startGui() {
76 95
77 QPixmap image = Resource::loadPixmap( "HelpBrowser"); 96 QPixmap image = Resource::loadPixmap( "HelpBrowser");
78 97
79 Text_2 = new QLabel( this ); 98 Text_2 = new QLabel( this );
80 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); 99 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
81 Text_2->setPixmap( image ); 100 Text_2->setPixmap( image );
82 101
83 Text = new QLabel( this, "Text" ); 102 Text = new QLabel( this, "Text" );
84 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); 103 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
85 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); 104 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
86 105
87 // media box 106 // media box
88 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 107 GroupBox1 = new QGroupBox( this, "GroupBox1" );
89 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 60 ) ); 108 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 60 ) );
90 GroupBox1->setTitle( tr( "Which media files" ) ); 109 GroupBox1->setTitle( tr( "Which media files" ) );
91 110
92 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); 111 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
93 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); 112 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
94 CheckBoxAudio->setText( tr( "Audio" ) ); 113 CheckBoxAudio->setText( tr( "Audio" ) );
95 114
96 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); 115 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
97 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); 116 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
98 CheckBoxImage->setText( tr( "Image" ) ); 117 CheckBoxImage->setText( tr( "Image" ) );
99 118
100 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); 119 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
101 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); 120 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
102 CheckBoxText->setText( tr( "Text" ) ); 121 CheckBoxText->setText( tr( "Text" ) );
103 122
104 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); 123 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
@@ -128,39 +147,44 @@ void MediumMountGui::startGui() {
128 AskBox = new QCheckBox( this ); 147 AskBox = new QCheckBox( this );
129 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); 148 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
130 AskBox->setText( tr( "Do not ask again for this medium" ) ); 149 AskBox->setText( tr( "Do not ask again for this medium" ) );
131 150
132 151
133 AskBox->setChecked(checkagain); 152 AskBox->setChecked(checkagain);
134 CheckBoxAudio->setChecked(checkmimeaudio); 153 CheckBoxAudio->setChecked(checkmimeaudio);
135 CheckBoxImage->setChecked(checkmimeimage); 154 CheckBoxImage->setChecked(checkmimeimage);
136 CheckBoxText->setChecked(checkmimetext); 155 CheckBoxText->setChecked(checkmimetext);
137 CheckBoxVideo->setChecked(checkmimevideo); 156 CheckBoxVideo->setChecked(checkmimevideo);
138 157
139 // buttons 158 // buttons
140 quit = new QPushButton( this ); 159 quit = new QPushButton( this );
141 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); 160 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
142 quit->setFocus(); 161 quit->setFocus();
143 quit->setText( tr( "Yes" ) ); 162 quit->setText( tr( "Yes" ) );
144 163
145 quit_2 = new QPushButton( this ); 164 quit_2 = new QPushButton( this );
146 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); 165 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
147 quit_2->setText( tr( "No" ) ); 166 quit_2->setText( tr( "No" ) );
148 167
149 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); 168 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
150 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); 169 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
151 170
152 171
153} 172}
154 173
155void MediumMountGui::yesPressed() { 174void MediumMountGui::yesPressed() {
156 writeConfig(); 175 writeConfig();
157 // and do something 176 // and do something
158} 177}
159 178
179
180QStringList MediumMountGui::mimeTypes(){
181 return mimeTypeList;
182}
183
160void MediumMountGui::noPressed() { 184void MediumMountGui::noPressed() {
161 close(); 185 close();
162} 186}
163 187
164MediumMountGui::~MediumMountGui(){ 188MediumMountGui::~MediumMountGui(){
165} 189}
166 190
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
@@ -9,55 +9,56 @@ class QGridLayout;
9class QCheckBox; 9class QCheckBox;
10class QGroupBox; 10class QGroupBox;
11class QLabel; 11class QLabel;
12class QLineEdit; 12class QLineEdit;
13class QPushButton; 13class QPushButton;
14 14
15class MediumMountGui : public QDialog 15class MediumMountGui : public QDialog
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 MediumMountGui( const QString &path = "/tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); 20 MediumMountGui( const QString &path = "/tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 );
21 ~MediumMountGui(); 21 ~MediumMountGui();
22 22
23protected: 23protected:
24 QPushButton* quit; 24 QPushButton* quit;
25 QPushButton* quit_2; 25 QPushButton* quit_2;
26 QLabel* DirSelectText_2; 26 QLabel* DirSelectText_2;
27 QLineEdit* LineEdit1; 27 QLineEdit* LineEdit1;
28 QPushButton* PushButton3; 28 QPushButton* PushButton3;
29 QLabel* DirSelectText; 29 QLabel* DirSelectText;
30 QLabel* Text_2; 30 QLabel* Text_2;
31 QLabel* Text; 31 QLabel* Text;
32 QGroupBox* GroupBox1; 32 QGroupBox* GroupBox1;
33 QCheckBox* CheckBoxAudio; 33 QCheckBox* CheckBoxAudio;
34 QCheckBox* CheckBoxImage; 34 QCheckBox* CheckBoxImage;
35 QCheckBox* CheckBoxText; 35 QCheckBox* CheckBoxText;
36 QCheckBox* CheckBoxVideo; 36 QCheckBox* CheckBoxVideo;
37 QCheckBox* AskBox; 37 QCheckBox* AskBox;
38 38
39public: 39public:
40 bool check(); 40 bool check();
41 41 QStringList mimeTypes();
42 QStringList dirs();
42private: 43private:
43 void startGui(); 44 void startGui();
44 void readConfig(); 45 void readConfig();
45 void writeConfig(); 46 void writeConfig();
46 47
47private slots: 48private slots:
48 void yesPressed(); 49 void yesPressed();
49 void noPressed(); 50 void noPressed();
50private: 51private:
51 QString mediumPath; 52 QString mediumPath;
52 53
53 bool checkagain; 54 bool checkagain;
54 bool checkmimeaudio; 55 bool checkmimeaudio;
55 bool checkmimeimage; 56 bool checkmimeimage;
56 bool checkmimetext; 57 bool checkmimetext;
57 bool checkmimevideo; 58 bool checkmimevideo;
58QString limittodirs; 59QString limittodirs;
59 60QStringList mimeTypeList;
60 61
61}; 62};
62 63
63#endif \ No newline at end of file 64#endif \ No newline at end of file