summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-04 20:06:58 (UTC)
committer harlekin <harlekin>2002-11-04 20:06:58 (UTC)
commit222d1d8b75494d520b5373fbaf64518afcdfcf89 (patch) (unidiff)
tree77faff83517567d4a8ce562a644f8582b57e8737
parent3c2605811571b5c8ccfbe2bdb1a03ec7a9c9f1c1 (diff)
downloadopie-222d1d8b75494d520b5373fbaf64518afcdfcf89.zip
opie-222d1d8b75494d520b5373fbaf64518afcdfcf89.tar.gz
opie-222d1d8b75494d520b5373fbaf64518afcdfcf89.tar.bz2
removed extra buttons - why double when they are in the titelbar
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mediummountgui.cpp24
-rw-r--r--core/launcher/mediummountgui.h10
2 files changed, 10 insertions, 24 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index 6d60ce4..b0a1b10 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -1,217 +1,207 @@
1 1
2#include "mediummountgui.h" 2#include "mediummountgui.h"
3 3
4#include <qcheckbox.h> 4#include <qcheckbox.h>
5#include <qgroupbox.h> 5#include <qgroupbox.h>
6#include <qlabel.h> 6#include <qlabel.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qpushbutton.h> 8#include <qpushbutton.h>
9#include <qlayout.h> 9#include <qlayout.h>
10#include <qimage.h> 10#include <qimage.h>
11#include <qpixmap.h> 11#include <qpixmap.h>
12#include <qvbox.h> 12#include <qvbox.h>
13#include <qhbox.h> 13#include <qhbox.h>
14 14
15#include <qpe/resource.h> 15#include <qpe/resource.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17 17
18 18
19MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags ) 19MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags )
20 : QDialog( parent, name, true ) { 20 : QDialog( parent, name, true ) {
21 21
22 m_cfg = cfg; 22 m_cfg = cfg;
23 setCaption( tr( "Medium inserted" ) ); 23 setCaption( tr( "Medium inserted" ) );
24 24
25 mediumPath = path; 25 mediumPath = path;
26 readConfig(); 26 readConfig();
27 startGui(); 27 startGui();
28 showMaximized(); 28 showMaximized();
29} 29}
30 30
31void MediumMountGui::readConfig() { 31void MediumMountGui::readConfig() {
32 32
33 //OConfig cfg (mediumPath +"/.opiestorage.cf"); 33 //OConfig cfg (mediumPath +"/.opiestorage.cf");
34 m_cfg->setGroup( "main" ); 34 m_cfg->setGroup( "main" );
35 checkagain = m_cfg->readBoolEntry( "check", false ); 35 checkagain = m_cfg->readBoolEntry( "check", false );
36 36
37 m_cfg->setGroup( "mimetypes" ); 37 m_cfg->setGroup( "mimetypes" );
38 checkmimeaudio = m_cfg->readBoolEntry( "audio", true ); 38 checkmimeaudio = m_cfg->readBoolEntry( "audio", true );
39 checkmimeimage = m_cfg->readBoolEntry( "image", true ); 39 checkmimeimage = m_cfg->readBoolEntry( "image", true );
40 checkmimetext = m_cfg->readBoolEntry( "text" , true ); 40 checkmimetext = m_cfg->readBoolEntry( "text" , true );
41 checkmimevideo = m_cfg->readBoolEntry( "video", true ); 41 checkmimevideo = m_cfg->readBoolEntry( "video", true );
42 checkmimeall = m_cfg->readBoolEntry( "all" , false ); 42 checkmimeall = m_cfg->readBoolEntry( "all" , false );
43 43
44 m_cfg->setGroup( "dirs" ); 44 m_cfg->setGroup( "dirs" );
45 limittodirs = m_cfg->readEntry( "dirs", "" ); 45 limittodirs = m_cfg->readEntry( "dirs", "" );
46} 46}
47 47
48bool MediumMountGui::check() { 48bool MediumMountGui::check() {
49 return !checkagain; 49 return !checkagain;
50} 50}
51 51
52QStringList MediumMountGui::dirs() { 52QStringList MediumMountGui::dirs() {
53 return QStringList::split( ",", limittodirs ); 53 return QStringList::split( ",", limittodirs );
54} 54}
55 55
56void MediumMountGui::writeConfig( bool autocheck ) { 56void MediumMountGui::writeConfig( bool autocheck ) {
57 57
58 //OConfig cfg (mediumPath +"/.opiestorage.cf"); 58 //OConfig cfg (mediumPath +"/.opiestorage.cf");
59 m_cfg->setGroup( "main" ); 59 m_cfg->setGroup( "main" );
60 m_cfg->writeEntry( "check", AskBox->isChecked() ); 60 m_cfg->writeEntry( "check", AskBox->isChecked() );
61 m_cfg->writeEntry( "autocheck", autocheck ); 61 m_cfg->writeEntry( "autocheck", autocheck );
62 62
63 m_cfg->setGroup( "mimetypes" ); 63 m_cfg->setGroup( "mimetypes" );
64 64
65 m_cfg->writeEntry( "audio", CheckBoxAudio->isChecked() ); 65 m_cfg->writeEntry( "audio", CheckBoxAudio->isChecked() );
66 m_cfg->writeEntry( "image", CheckBoxImage->isChecked() ); 66 m_cfg->writeEntry( "image", CheckBoxImage->isChecked() );
67 m_cfg->writeEntry( "text", CheckBoxImage->isChecked() ); 67 m_cfg->writeEntry( "text", CheckBoxImage->isChecked() );
68 m_cfg->writeEntry( "video", CheckBoxVideo->isChecked() ); 68 m_cfg->writeEntry( "video", CheckBoxVideo->isChecked() );
69 m_cfg->writeEntry( "all", CheckBoxAll->isChecked() ); 69 m_cfg->writeEntry( "all", CheckBoxAll->isChecked() );
70 70
71 m_cfg->setGroup( "dirs" ); 71 m_cfg->setGroup( "dirs" );
72 m_cfg->writeEntry( "dirs", "" ); 72 m_cfg->writeEntry( "dirs", "" );
73 73
74 // if all is checked then add only "QString::null" to the list. 74 // if all is checked then add only "QString::null" to the list.
75 if ( checkmimeall ) { 75 if ( checkmimeall ) {
76 mimeTypeList.clear(); 76 mimeTypeList.clear();
77 mimeTypeList += QString::null; 77 mimeTypeList += QString::null;
78 } else { 78 } else {
79 if ( checkmimeaudio ) { 79 if ( checkmimeaudio ) {
80 mimeTypeList += ( "audio/*" ); 80 mimeTypeList += ( "audio/*" );
81 } 81 }
82 if ( checkmimetext ) { 82 if ( checkmimetext ) {
83 mimeTypeList += ( "text/*" ); 83 mimeTypeList += ( "text/*" );
84 } 84 }
85 if ( checkmimevideo ) { 85 if ( checkmimevideo ) {
86 mimeTypeList += ( "video/*" ); 86 mimeTypeList += ( "video/*" );
87 } 87 }
88 if ( checkmimeimage ) { 88 if ( checkmimeimage ) {
89 mimeTypeList += ( "image/*" ); 89 mimeTypeList += ( "image/*" );
90 } 90 }
91 } 91 }
92 m_cfg->write(); // not really needed here but just to be sure 92 m_cfg->write(); // not really needed here but just to be sure
93} 93}
94 94
95void MediumMountGui::startGui() { 95void MediumMountGui::startGui() {
96 96
97 QVBoxLayout* mainLayout = new QVBoxLayout( this ); 97 QVBoxLayout* mainLayout = new QVBoxLayout( this );
98 98
99 QHBoxLayout * titelBox = new QHBoxLayout( mainLayout ); 99 QHBoxLayout * titelBox = new QHBoxLayout( mainLayout );
100 Text_2 = new QLabel( this ); 100 Text_2 = new QLabel( this );
101 // FIXME needs an image 101 // FIXME needs an image
102 Text_2->setPixmap( Resource::loadPixmap( "mediummount/mediummount" ) ); 102 Text_2->setPixmap( Resource::loadPixmap( "mediummount/mediummount" ) );
103 103
104 Text = new QLabel( this, "Text" ); 104 Text = new QLabel( this, "Text" );
105 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); 105 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
106 titelBox->addWidget( Text_2 ); 106 titelBox->addWidget( Text_2 );
107 titelBox->setStretchFactor( Text_2, 2 ); 107 titelBox->setStretchFactor( Text_2, 2 );
108 titelBox->addWidget( Text ); 108 titelBox->addWidget( Text );
109 titelBox->setStretchFactor( Text, 8 ); 109 titelBox->setStretchFactor( Text, 8 );
110 110
111 // media box 111 // media box
112 GroupBox1 = new QGroupBox( this, "GroupBox1" ); 112 GroupBox1 = new QGroupBox( this, "GroupBox1" );
113 GroupBox1->setTitle( tr( "Which media files" ) ); 113 GroupBox1->setTitle( tr( "Which media files" ) );
114 114
115 QGridLayout *mimeLayout = new QGridLayout( GroupBox1, 3, 2, 10 ); 115 QGridLayout *mimeLayout = new QGridLayout( GroupBox1, 3, 2, 10 );
116 116
117 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); 117 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
118 CheckBoxAudio->setText( tr( "Audio" ) ); 118 CheckBoxAudio->setText( tr( "Audio" ) );
119 119
120 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); 120 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
121 CheckBoxImage->setText( tr( "Image" ) ); 121 CheckBoxImage->setText( tr( "Image" ) );
122 122
123 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); 123 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
124 CheckBoxText->setText( tr( "Text" ) ); 124 CheckBoxText->setText( tr( "Text" ) );
125 125
126 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); 126 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
127 CheckBoxVideo->setText( tr( "Video" ) ); 127 CheckBoxVideo->setText( tr( "Video" ) );
128 128
129 CheckBoxAll = new QCheckBox ( GroupBox1 ); 129 CheckBoxAll = new QCheckBox ( GroupBox1 );
130 CheckBoxAll->setText( tr( "All" ) ); 130 CheckBoxAll->setText( tr( "All" ) );
131 131
132 CheckBoxLink = new QCheckBox ( GroupBox1 ); 132 CheckBoxLink = new QCheckBox ( GroupBox1 );
133 CheckBoxLink->setText( tr( "Link apps" ) ); 133 CheckBoxLink->setText( tr( "Link apps" ) );
134 // as long as the feature is not supported 134 // as long as the feature is not supported
135 CheckBoxLink->setEnabled( false ); 135 CheckBoxLink->setEnabled( false );
136 136
137 mimeLayout->addWidget( CheckBoxAudio, 0, 0 ); 137 mimeLayout->addWidget( CheckBoxAudio, 0, 0 );
138 mimeLayout->addWidget( CheckBoxImage, 0, 1 ); 138 mimeLayout->addWidget( CheckBoxImage, 0, 1 );
139 mimeLayout->addWidget( CheckBoxText , 1, 0 ); 139 mimeLayout->addWidget( CheckBoxText , 1, 0 );
140 mimeLayout->addWidget( CheckBoxVideo, 1, 1 ); 140 mimeLayout->addWidget( CheckBoxVideo, 1, 1 );
141 mimeLayout->addWidget( CheckBoxAll, 2, 0 ); 141 mimeLayout->addWidget( CheckBoxAll, 2, 0 );
142 mimeLayout->addWidget( CheckBoxLink, 2, 1 ); 142 mimeLayout->addWidget( CheckBoxLink, 2, 1 );
143 143
144 connect( CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers() ) ); 144 connect( CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers() ) );
145 145
146 QVBox* dirBox = new QVBox( this ); 146 QVBox* dirBox = new QVBox( this );
147 dirBox->setMargin( 4 ); 147 dirBox->setMargin( 5 );
148 148
149 // select dirs 149 // select dirs
150 DirSelectText = new QLabel( dirBox, "DirSelectText" ); 150 DirSelectText = new QLabel( dirBox, "DirSelectText" );
151 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); 151 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
152 152
153 QHBox* dirLineBox = new QHBox( dirBox ); 153 QHBox* dirLineBox = new QHBox( dirBox );
154 LineEdit1 = new QLineEdit( dirLineBox ); 154 LineEdit1 = new QLineEdit( dirLineBox );
155 PushButton3 = new QPushButton( dirLineBox ); 155 PushButton3 = new QPushButton( dirLineBox );
156 PushButton3->setText( tr( "Add" ) ); 156 PushButton3->setText( tr( "Add" ) );
157 PushButton3->setFocus();
157 158
158 // decision 159 // decision
159 DirSelectText_2 = new QLabel( dirBox ); 160 DirSelectText_2 = new QLabel( dirBox );
160 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); 161 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
161 162
162 // ask again 163 // ask again
163 AskBox = new QCheckBox( dirBox ); 164 AskBox = new QCheckBox( dirBox );
164 AskBox->setText( tr( "Do not ask again for this medium" ) ); 165 AskBox->setText( tr( "Do not ask again for this medium" ) );
165 166
166 AskBox->setChecked( checkagain ); 167 AskBox->setChecked( checkagain );
167 CheckBoxAudio->setChecked( checkmimeaudio ); 168 CheckBoxAudio->setChecked( checkmimeaudio );
168 CheckBoxImage->setChecked( checkmimeimage ); 169 CheckBoxImage->setChecked( checkmimeimage );
169 CheckBoxText->setChecked( checkmimetext ); 170 CheckBoxText->setChecked( checkmimetext );
170 CheckBoxVideo->setChecked( checkmimevideo ); 171 CheckBoxVideo->setChecked( checkmimevideo );
171 CheckBoxAll->setChecked( checkmimeall ); 172 CheckBoxAll->setChecked( checkmimeall );
172 deactivateOthers(); 173 deactivateOthers();
173 174
174 QHBox* buttonBox = new QHBox( this );
175 // buttons
176 quit = new QPushButton( buttonBox );
177 quit->setFocus();
178 quit->setText( tr( "Yes" ) );
179 quit_2 = new QPushButton( buttonBox );
180 quit_2->setText( tr( "No" ) );
181
182 mainLayout->addWidget( GroupBox1 ); 175 mainLayout->addWidget( GroupBox1 );
183 mainLayout->addWidget( dirBox ); 176 mainLayout->addWidget( dirBox );
184 mainLayout->addWidget( buttonBox ); 177 mainLayout->addStretch( 0 );
185
186 connect( quit, SIGNAL( clicked() ), this, SLOT( yesPressed() ) );
187 connect( quit_2, SIGNAL( clicked() ), this, SLOT( noPressed() ) );
188} 178}
189 179
190 180
191void MediumMountGui::deactivateOthers() { 181void MediumMountGui::deactivateOthers() {
192 bool mod = !( CheckBoxAll->isChecked() ); 182 bool mod = !( CheckBoxAll->isChecked() );
193 CheckBoxVideo->setEnabled( mod ); 183 CheckBoxVideo->setEnabled( mod );
194 CheckBoxAudio->setEnabled( mod ); 184 CheckBoxAudio->setEnabled( mod );
195 CheckBoxText->setEnabled( mod ); 185 CheckBoxText->setEnabled( mod );
196 CheckBoxImage->setEnabled( mod ); 186 CheckBoxImage->setEnabled( mod );
197} 187}
198 188
199void MediumMountGui::yesPressed() { 189void MediumMountGui::accept() {
200 writeConfig( true ); 190 writeConfig( true );
201 // and do something 191 // and do something
202 accept(); 192 QDialog::accept();
203} 193}
204 194
205 195
206QStringList MediumMountGui::mimeTypes() { 196QStringList MediumMountGui::mimeTypes() {
207 return mimeTypeList; 197 return mimeTypeList;
208} 198}
209 199
210void MediumMountGui::noPressed() { 200void MediumMountGui::reject() {
211 writeConfig( false ); 201 writeConfig( false );
212 reject(); 202 QDialog::reject();
213} 203}
214 204
215MediumMountGui::~MediumMountGui() { 205MediumMountGui::~MediumMountGui() {
216} 206}
217 207
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h
index 39f9a52..d5c0fe7 100644
--- a/core/launcher/mediummountgui.h
+++ b/core/launcher/mediummountgui.h
@@ -1,71 +1,67 @@
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>
6 6
7class QVBoxLayout; 7class QVBoxLayout;
8class QHBoxLayout; 8class QHBoxLayout;
9class QGridLayout; 9class QGridLayout;
10class QCheckBox; 10class QCheckBox;
11class QGroupBox; 11class QGroupBox;
12class QLabel; 12class QLabel;
13class QLineEdit; 13class QLineEdit;
14class QPushButton; 14class QPushButton;
15class Config; 15class Config;
16 16
17class MediumMountGui : public QDialog { 17class MediumMountGui : public QDialog {
18 Q_OBJECT 18 Q_OBJECT
19 19
20public: 20public:
21 MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 ); 21 MediumMountGui( Config *cfg, const QString &path = "tmp/", QWidget* parent = 0, const char* name = 0, bool modal = FALSE ,WFlags fl = 0 );
22 ~MediumMountGui(); 22 ~MediumMountGui();
23 23
24protected: 24protected:
25 QPushButton* quit;
26 QPushButton* quit_2;
27 QLabel* DirSelectText_2; 25 QLabel* DirSelectText_2;
28 QLineEdit* LineEdit1; 26 QLineEdit* LineEdit1;
29 QPushButton* PushButton3; 27 QPushButton* PushButton3;
30 QLabel* DirSelectText; 28 QLabel* DirSelectText;
31 QLabel* Text_2; 29 QLabel* Text_2;
32 QLabel* Text; 30 QLabel* Text;
33 QGroupBox* GroupBox1; 31 QGroupBox* GroupBox1;
34 QCheckBox* CheckBoxAudio; 32 QCheckBox* CheckBoxAudio;
35 QCheckBox* CheckBoxImage; 33 QCheckBox* CheckBoxImage;
36 QCheckBox* CheckBoxText; 34 QCheckBox* CheckBoxText;
37 QCheckBox* CheckBoxVideo; 35 QCheckBox* CheckBoxVideo;
38 QCheckBox* CheckBoxAll; 36 QCheckBox* CheckBoxAll;
39 QCheckBox* CheckBoxLink; 37 QCheckBox* CheckBoxLink;
40 QCheckBox* AskBox; 38 QCheckBox* AskBox;
41 39
42
43public: 40public:
44 bool check(); 41 bool check();
45 QStringList mimeTypes(); 42 QStringList mimeTypes();
46 QStringList dirs(); 43 QStringList dirs();
47private: 44private:
48 void startGui(); 45 void startGui();
49 void readConfig(); 46 void readConfig();
50 void writeConfig( bool checkagain ); 47 void writeConfig( bool checkagain );
51 48
52private slots: 49private slots:
53 void yesPressed(); 50 void accept();
54 void noPressed(); 51 void reject();
55 void deactivateOthers(); 52 void deactivateOthers();
56 private: 53 private:
57 QString mediumPath; 54 QString mediumPath;
58
59 bool checkagain:1; 55 bool checkagain:1;
60 bool checkmimeaudio:1; 56 bool checkmimeaudio:1;
61 bool checkmimeimage:1; 57 bool checkmimeimage:1;
62 bool checkmimetext:1; 58 bool checkmimetext:1;
63 bool checkmimevideo:1; 59 bool checkmimevideo:1;
64 bool checkmimeall:1; 60 bool checkmimeall:1;
65 QString limittodirs; 61 QString limittodirs;
66 QStringList mimeTypeList; 62 QStringList mimeTypeList;
67 Config *m_cfg; 63 Config *m_cfg;
68 64
69}; 65};
70 66
71#endif 67#endif