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