summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mediummountgui.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index 6ad97e1..5225711 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -1,232 +1,232 @@
1 1
2#include "mediummountgui.h" 2#include "mediummountgui.h"
3 3
4#include <qvariant.h> 4#include <qvariant.h>
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 <opie/oconfig.h> 17#include <opie/oconfig.h>
18 18
19 19
20#include <qapplication.h> 20#include <qapplication.h>
21 21
22 22
23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) 23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl )
24 : QDialog( parent, name, true ) { 24 : QDialog( parent, name, true ) {
25 25
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", true); 42 checkagain = cfg.readBoolEntry("check", false);
43 43
44 cfg.setGroup("mimetypes"); 44 cfg.setGroup("mimetypes");
45 checkmimeaudio = cfg.readBoolEntry("audio", true); 45 checkmimeaudio = cfg.readBoolEntry("audio", true);
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 checkmimeall = cfg.readBoolEntry("all", true); 49 checkmimeall = cfg.readBoolEntry("all", true);
50 50
51 cfg.setGroup("dirs"); 51 cfg.setGroup("dirs");
52 limittodirs = cfg.readEntry("dirs", ""); 52 limittodirs = cfg.readEntry("dirs", "");
53} 53}
54 54
55bool MediumMountGui::check() { 55bool MediumMountGui::check() {
56 return checkagain; 56 return !checkagain;
57} 57}
58 58
59QStringList MediumMountGui::dirs() { 59QStringList MediumMountGui::dirs() {
60 QStringList list = QStringList::split(",", limittodirs ); 60 QStringList list = QStringList::split(",", limittodirs );
61 return list; 61 return list;
62} 62}
63 63
64void MediumMountGui::writeConfig(bool autocheck) { 64void MediumMountGui::writeConfig(bool autocheck) {
65 65
66 OConfig cfg (mediumPath +"/.opiestorage.cf"); 66 OConfig cfg (mediumPath +"/.opiestorage.cf");
67 cfg.setGroup("main"); 67 cfg.setGroup("main");
68 cfg.writeEntry("check", AskBox->isChecked() ); 68 cfg.writeEntry("check", AskBox->isChecked() );
69 cfg.writeEntry("autocheck", autocheck ); 69 cfg.writeEntry("autocheck", autocheck );
70 70
71 cfg.setGroup("mimetypes"); 71 cfg.setGroup("mimetypes");
72 72
73 cfg.writeEntry("audio", CheckBoxAudio->isChecked() ); 73 cfg.writeEntry("audio", CheckBoxAudio->isChecked() );
74 cfg.writeEntry("image",CheckBoxImage->isChecked() ); 74 cfg.writeEntry("image",CheckBoxImage->isChecked() );
75 cfg.writeEntry("text",CheckBoxImage->isChecked() ); 75 cfg.writeEntry("text",CheckBoxImage->isChecked() );
76 cfg.writeEntry("video",CheckBoxVideo->isChecked() ); 76 cfg.writeEntry("video",CheckBoxVideo->isChecked() );
77 cfg.writeEntry("all",CheckBoxAll->isChecked() ); 77 cfg.writeEntry("all",CheckBoxAll->isChecked() );
78 78
79 cfg.setGroup("dirs"); 79 cfg.setGroup("dirs");
80 cfg.writeEntry("dirs", ""); 80 cfg.writeEntry("dirs", "");
81 81
82 82
83 // if all is checked then add only "null" to the list. 83 // if all is checked then add only "null" to the list.
84 if (checkmimeall) { 84 if (checkmimeall) {
85 mimeTypeList += ("null"); 85 mimeTypeList += ("null");
86 } else { 86 } else {
87 if (checkmimeaudio) { 87 if (checkmimeaudio) {
88 mimeTypeList += ("audio//*"); 88 mimeTypeList += ("audio//*");
89 } 89 }
90 if (checkmimetext) { 90 if (checkmimetext) {
91 mimeTypeList += ("text//*"); 91 mimeTypeList += ("text//*");
92 } 92 }
93 if (checkmimevideo) { 93 if (checkmimevideo) {
94 mimeTypeList += ("video//*"); 94 mimeTypeList += ("video//*");
95 } 95 }
96 if (checkmimeimage) { 96 if (checkmimeimage) {
97 mimeTypeList += ("image//*"); 97 mimeTypeList += ("image//*");
98 } 98 }
99 if (checkmimeall) { 99 if (checkmimeall) {
100 mimeTypeList << ("null"); 100 mimeTypeList << ("null");
101 } 101 }
102 } 102 }
103} 103}
104 104
105void MediumMountGui::startGui() { 105void MediumMountGui::startGui() {
106 106
107 QPixmap image = Resource::loadPixmap( "HelpBrowser"); 107 QPixmap image = Resource::loadPixmap( "HelpBrowser");
108 108
109 Text_2 = new QLabel( this ); 109 Text_2 = new QLabel( this );
110 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); 110 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
111 Text_2->setPixmap( image ); 111 Text_2->setPixmap( image );
112 112
113 Text = new QLabel( this, "Text" ); 113 Text = new QLabel( this, "Text" );
114 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); 114 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
115 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); 115 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
116 116
117 // media box 117 // media box
118 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 118 GroupBox1 = new QGroupBox( this, "GroupBox1" );
119 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); 119 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) );
120 GroupBox1->setTitle( tr( "Which media files" ) ); 120 GroupBox1->setTitle( tr( "Which media files" ) );
121 121
122 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); 122 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
123 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); 123 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
124 CheckBoxAudio->setText( tr( "Audio" ) ); 124 CheckBoxAudio->setText( tr( "Audio" ) );
125 125
126 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); 126 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
127 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); 127 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
128 CheckBoxImage->setText( tr( "Image" ) ); 128 CheckBoxImage->setText( tr( "Image" ) );
129 129
130 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); 130 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
131 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); 131 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
132 CheckBoxText->setText( tr( "Text" ) ); 132 CheckBoxText->setText( tr( "Text" ) );
133 133
134 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); 134 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
135 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); 135 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) );
136 CheckBoxVideo->setText( tr( "Video" ) ); 136 CheckBoxVideo->setText( tr( "Video" ) );
137 137
138 CheckBoxAll = new QCheckBox ( GroupBox1); 138 CheckBoxAll = new QCheckBox ( GroupBox1);
139 CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) ); 139 CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) );
140 CheckBoxAll->setText( tr( "All" ) ); 140 CheckBoxAll->setText( tr( "All" ) );
141 QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) ); 141 QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) );
142 142
143 143
144 144
145 CheckBoxLink = new QCheckBox ( GroupBox1); 145 CheckBoxLink = new QCheckBox ( GroupBox1);
146 CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) ); 146 CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) );
147 CheckBoxLink->setText( tr( "Link apps" ) ); 147 CheckBoxLink->setText( tr( "Link apps" ) );
148 // as long as the feature is not supported 148 // as long as the feature is not supported
149 CheckBoxLink->setEnabled(false); 149 CheckBoxLink->setEnabled(false);
150 150
151 151
152 // select dirs 152 // select dirs
153 153
154 DirSelectText = new QLabel( this, "DirSelectText" ); 154 DirSelectText = new QLabel( this, "DirSelectText" );
155 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); 155 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) );
156 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); 156 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
157 157
158 LineEdit1 = new QLineEdit( this ); 158 LineEdit1 = new QLineEdit( this );
159 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); 159 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) );
160 160
161 PushButton3 = new QPushButton( this ); 161 PushButton3 = new QPushButton( this );
162 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); 162 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) );
163 PushButton3->setText( tr( "Add" ) ); 163 PushButton3->setText( tr( "Add" ) );
164 164
165 165
166 // decision 166 // decision
167 DirSelectText_2 = new QLabel( this ); 167 DirSelectText_2 = new QLabel( this );
168 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); 168 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) );
169 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); 169 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
170 170
171 // ask again 171 // ask again
172 AskBox = new QCheckBox( this ); 172 AskBox = new QCheckBox( this );
173 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); 173 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
174 AskBox->setText( tr( "Do not ask again for this medium" ) ); 174 AskBox->setText( tr( "Do not ask again for this medium" ) );
175 175
176 176
177 AskBox->setChecked(checkagain); 177 AskBox->setChecked(checkagain);
178 CheckBoxAudio->setChecked(checkmimeaudio); 178 CheckBoxAudio->setChecked(checkmimeaudio);
179 CheckBoxImage->setChecked(checkmimeimage); 179 CheckBoxImage->setChecked(checkmimeimage);
180 CheckBoxText->setChecked(checkmimetext); 180 CheckBoxText->setChecked(checkmimetext);
181 CheckBoxVideo->setChecked(checkmimevideo); 181 CheckBoxVideo->setChecked(checkmimevideo);
182 182
183 // buttons 183 // buttons
184 quit = new QPushButton( this ); 184 quit = new QPushButton( this );
185 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); 185 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
186 quit->setFocus(); 186 quit->setFocus();
187 quit->setText( tr( "Yes" ) ); 187 quit->setText( tr( "Yes" ) );
188 188
189 quit_2 = new QPushButton( this ); 189 quit_2 = new QPushButton( this );
190 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); 190 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
191 quit_2->setText( tr( "No" ) ); 191 quit_2->setText( tr( "No" ) );
192 192
193 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); 193 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
194 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); 194 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
195 195
196 196
197} 197}
198 198
199 199
200void MediumMountGui::deactivateOthers() { 200void MediumMountGui::deactivateOthers() {
201 bool mod = !(CheckBoxAll->isChecked()); 201 bool mod = !(CheckBoxAll->isChecked());
202 202
203 //if (!CheckBoxVideo->isChecked()){ 203 //if (!CheckBoxVideo->isChecked()){
204 // mod = false; 204 // mod = false;
205 //} else { 205 //} else {
206 // mod = true; 206 // mod = true;
207 //} 207 //}
208 CheckBoxVideo->setEnabled(mod); 208 CheckBoxVideo->setEnabled(mod);
209 CheckBoxAudio->setEnabled(mod); 209 CheckBoxAudio->setEnabled(mod);
210 CheckBoxText->setEnabled(mod); 210 CheckBoxText->setEnabled(mod);
211 CheckBoxImage->setEnabled(mod); 211 CheckBoxImage->setEnabled(mod);
212} 212}
213 213
214void MediumMountGui::yesPressed() { 214void MediumMountGui::yesPressed() {
215 writeConfig(true); 215 writeConfig(true);
216 // and do something 216 // and do something
217 accept(); 217 accept();
218} 218}
219 219
220 220
221QStringList MediumMountGui::mimeTypes(){ 221QStringList MediumMountGui::mimeTypes(){
222 return mimeTypeList; 222 return mimeTypeList;
223} 223}
224 224
225void MediumMountGui::noPressed() { 225void MediumMountGui::noPressed() {
226 writeConfig(false); 226 writeConfig(false);
227 reject(); 227 reject();
228} 228}
229 229
230MediumMountGui::~MediumMountGui(){ 230MediumMountGui::~MediumMountGui(){
231} 231}
232 232