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