-rw-r--r-- | core/launcher/launcher.cpp | 8 | ||||
-rw-r--r-- | core/launcher/mediummountgui.cpp | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 979eee6..d1df4cc 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,487 +1,487 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Holger zecke Freyther | 2 | ** Copyright (c) 2002 Holger zecke Freyther |
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
23 | // have this class. | 23 | // have this class. |
24 | #define QTOPIA_INTERNAL_FSLP | 24 | #define QTOPIA_INTERNAL_FSLP |
25 | 25 | ||
26 | #include <opie/oconfig.h> | 26 | #include <opie/oconfig.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
36 | 36 | ||
37 | #include <qdatetime.h> | 37 | #include <qdatetime.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #include <qtimer.h> | 40 | #include <qtimer.h> |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qvbox.h> | 42 | #include <qvbox.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qstyle.h> | 44 | #include <qstyle.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qtabbar.h> | 46 | #include <qtabbar.h> |
47 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qregexp.h> | 49 | #include <qregexp.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qframe.h> | 51 | #include <qframe.h> |
52 | #include <qpainter.h> | 52 | #include <qpainter.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qtextstream.h> | 54 | #include <qtextstream.h> |
55 | 55 | ||
56 | #include "launcherview.h" | 56 | #include "launcherview.h" |
57 | #include "launcher.h" | 57 | #include "launcher.h" |
58 | #include "syncdialog.h" | 58 | #include "syncdialog.h" |
59 | #include "desktop.h" | 59 | #include "desktop.h" |
60 | #include <qpe/lnkproperties.h> | 60 | #include <qpe/lnkproperties.h> |
61 | #include "mrulist.h" | 61 | #include "mrulist.h" |
62 | #include "qrsync.h" | 62 | #include "qrsync.h" |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <unistd.h> | 64 | #include <unistd.h> |
65 | 65 | ||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <sys/vfs.h> | 68 | #include <sys/vfs.h> |
69 | #include <mntent.h> | 69 | #include <mntent.h> |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #include <qpe/storage.h> | 72 | #include <qpe/storage.h> |
73 | #include "mediummountgui.h" | 73 | #include "mediummountgui.h" |
74 | //#define SHOW_ALL | 74 | //#define SHOW_ALL |
75 | 75 | ||
76 | // uidGen | 76 | // uidGen |
77 | 77 | ||
78 | // uidGen | 78 | // uidGen |
79 | namespace { | 79 | namespace { |
80 | QStringList configToMime( Config *cfg ){ | 80 | QStringList configToMime( Config *cfg ){ |
81 | QStringList mimes; | 81 | QStringList mimes; |
82 | bool tmpMime; | 82 | bool tmpMime; |
83 | cfg->setGroup("mimetypes" ); | 83 | cfg->setGroup("mimetypes" ); |
84 | tmpMime = cfg->readBoolEntry("all" ,false); | 84 | tmpMime = cfg->readBoolEntry("all" ,false); |
85 | if( tmpMime ){ | 85 | if( tmpMime ){ |
86 | mimes << QString::null; | 86 | mimes << QString::null; |
87 | return mimes; | 87 | return mimes; |
88 | }else{ | 88 | }else{ |
89 | tmpMime = cfg->readBoolEntry("audio", true ); | 89 | tmpMime = cfg->readBoolEntry("audio", true ); |
90 | if(tmpMime ) | 90 | if(tmpMime ) |
91 | mimes.append("audio//*" ); | 91 | mimes.append("audio/*" ); |
92 | 92 | ||
93 | tmpMime = cfg->readBoolEntry("image", true ); | 93 | tmpMime = cfg->readBoolEntry("image", true ); |
94 | if(tmpMime ) | 94 | if(tmpMime ) |
95 | mimes.append("image//*" ); | 95 | mimes.append("image/*" ); |
96 | 96 | ||
97 | tmpMime = cfg->readBoolEntry("text", true ); | 97 | tmpMime = cfg->readBoolEntry("text", true ); |
98 | if(tmpMime ) | 98 | if(tmpMime ) |
99 | mimes.append("text//*"); | 99 | mimes.append("text/*"); |
100 | 100 | ||
101 | tmpMime = cfg->readBoolEntry("video", true ); | 101 | tmpMime = cfg->readBoolEntry("video", true ); |
102 | if(tmpMime ) | 102 | if(tmpMime ) |
103 | mimes.append("video//*" ); | 103 | mimes.append("video/*" ); |
104 | } | 104 | } |
105 | return mimes; | 105 | return mimes; |
106 | } | 106 | } |
107 | 107 | ||
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 111 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
112 | QVBox( parent ) | 112 | QVBox( parent ) |
113 | { | 113 | { |
114 | categoryBar = 0; | 114 | categoryBar = 0; |
115 | stack = 0; | 115 | stack = 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | void CategoryTabWidget::prevTab() | 118 | void CategoryTabWidget::prevTab() |
119 | { | 119 | { |
120 | if ( categoryBar ) { | 120 | if ( categoryBar ) { |
121 | int n = categoryBar->count(); | 121 | int n = categoryBar->count(); |
122 | int tab = categoryBar->currentTab(); | 122 | int tab = categoryBar->currentTab(); |
123 | if ( tab >= 0 ) | 123 | if ( tab >= 0 ) |
124 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 124 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void CategoryTabWidget::nextTab() | 128 | void CategoryTabWidget::nextTab() |
129 | { | 129 | { |
130 | if ( categoryBar ) { | 130 | if ( categoryBar ) { |
131 | int n = categoryBar->count(); | 131 | int n = categoryBar->count(); |
132 | int tab = categoryBar->currentTab(); | 132 | int tab = categoryBar->currentTab(); |
133 | categoryBar->setCurrentTab( (tab + 1)%n ); | 133 | categoryBar->setCurrentTab( (tab + 1)%n ); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void CategoryTabWidget::addItem( const QString& linkfile ) | 137 | void CategoryTabWidget::addItem( const QString& linkfile ) |
138 | { | 138 | { |
139 | int i=0; | 139 | int i=0; |
140 | AppLnk *app = new AppLnk(linkfile); | 140 | AppLnk *app = new AppLnk(linkfile); |
141 | if ( !app->isValid() ) { | 141 | if ( !app->isValid() ) { |
142 | delete app; | 142 | delete app; |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | if ( !app->file().isEmpty() ) { | 145 | if ( !app->file().isEmpty() ) { |
146 | // A document | 146 | // A document |
147 | delete app; | 147 | delete app; |
148 | app = new DocLnk(linkfile); | 148 | app = new DocLnk(linkfile); |
149 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 149 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 152 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
153 | if ( !(*it).isEmpty() ) { | 153 | if ( !(*it).isEmpty() ) { |
154 | QRegExp tf(*it,FALSE,TRUE); | 154 | QRegExp tf(*it,FALSE,TRUE); |
155 | if ( tf.match(app->type()) >= 0 ) { | 155 | if ( tf.match(app->type()) >= 0 ) { |
156 | ((LauncherView*)stack->widget(i))->addItem(app); | 156 | ((LauncherView*)stack->widget(i))->addItem(app); |
157 | return; | 157 | return; |
158 | } | 158 | } |
159 | i++; | 159 | i++; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 164 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
165 | AppLnkSet* docFolder, const QList<FileSystem> &fs) | 165 | AppLnkSet* docFolder, const QList<FileSystem> &fs) |
166 | { | 166 | { |
167 | delete categoryBar; | 167 | delete categoryBar; |
168 | categoryBar = new CategoryTabBar( this ); | 168 | categoryBar = new CategoryTabBar( this ); |
169 | QPalette pal = categoryBar->palette(); | 169 | QPalette pal = categoryBar->palette(); |
170 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 170 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
171 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 171 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
172 | categoryBar->setPalette( pal ); | 172 | categoryBar->setPalette( pal ); |
173 | 173 | ||
174 | delete stack; | 174 | delete stack; |
175 | stack = new QWidgetStack(this); | 175 | stack = new QWidgetStack(this); |
176 | tabs=0; | 176 | tabs=0; |
177 | 177 | ||
178 | ids.clear(); | 178 | ids.clear(); |
179 | 179 | ||
180 | QStringList types = rootFolder->types(); | 180 | QStringList types = rootFolder->types(); |
181 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 181 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
182 | if ( !(*it).isEmpty() ) { | 182 | if ( !(*it).isEmpty() ) { |
183 | newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); | 183 | newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | QListIterator<AppLnk> it( rootFolder->children() ); | 186 | QListIterator<AppLnk> it( rootFolder->children() ); |
187 | AppLnk* l; | 187 | AppLnk* l; |
188 | while ( (l=it.current()) ) { | 188 | while ( (l=it.current()) ) { |
189 | if ( l->type() == "Separator" ) { | 189 | if ( l->type() == "Separator" ) { |
190 | rootFolder->remove(l); | 190 | rootFolder->remove(l); |
191 | delete l; | 191 | delete l; |
192 | } else { | 192 | } else { |
193 | int i=0; | 193 | int i=0; |
194 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 194 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
195 | if ( *it == l->type() ) | 195 | if ( *it == l->type() ) |
196 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); | 196 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); |
197 | i++; | 197 | i++; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | ++it; | 200 | ++it; |
201 | } | 201 | } |
202 | rootFolder->detachChildren(); | 202 | rootFolder->detachChildren(); |
203 | for (int i=0; i<tabs; i++) | 203 | for (int i=0; i<tabs; i++) |
204 | ((LauncherView*)stack->widget(i))->sort(); | 204 | ((LauncherView*)stack->widget(i))->sort(); |
205 | 205 | ||
206 | // all documents | 206 | // all documents |
207 | docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents")); | 207 | docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents")); |
208 | docview->populate( docFolder, QString::null ); | 208 | docview->populate( docFolder, QString::null ); |
209 | docFolder->detachChildren(); | 209 | docFolder->detachChildren(); |
210 | docview->setFileSystems(fs); | 210 | docview->setFileSystems(fs); |
211 | docview->setToolsEnabled(TRUE); | 211 | docview->setToolsEnabled(TRUE); |
212 | 212 | ||
213 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 213 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
214 | 214 | ||
215 | ((LauncherView*)stack->widget(0))->setFocus(); | 215 | ((LauncherView*)stack->widget(0))->setFocus(); |
216 | 216 | ||
217 | categoryBar->show(); | 217 | categoryBar->show(); |
218 | stack->show(); | 218 | stack->show(); |
219 | } | 219 | } |
220 | 220 | ||
221 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) | 221 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) |
222 | { | 222 | { |
223 | docview->populate( docFolder, QString::null ); | 223 | docview->populate( docFolder, QString::null ); |
224 | docFolder->detachChildren(); | 224 | docFolder->detachChildren(); |
225 | docview->setFileSystems(fs); | 225 | docview->setFileSystems(fs); |
226 | docview->updateTools(); | 226 | docview->updateTools(); |
227 | } | 227 | } |
228 | 228 | ||
229 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 229 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
230 | { | 230 | { |
231 | LauncherView* view = new LauncherView( stack ); | 231 | LauncherView* view = new LauncherView( stack ); |
232 | connect( view, SIGNAL(clicked(const AppLnk*)), | 232 | connect( view, SIGNAL(clicked(const AppLnk*)), |
233 | this, SIGNAL(clicked(const AppLnk*))); | 233 | this, SIGNAL(clicked(const AppLnk*))); |
234 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 234 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
235 | this, SIGNAL(rightPressed(AppLnk*))); | 235 | this, SIGNAL(rightPressed(AppLnk*))); |
236 | ids.append(id); | 236 | ids.append(id); |
237 | categoryBar->addTab( new QTab( pm, label ) ); | 237 | categoryBar->addTab( new QTab( pm, label ) ); |
238 | stack->addWidget( view, tabs++ ); | 238 | stack->addWidget( view, tabs++ ); |
239 | return view; | 239 | return view; |
240 | } | 240 | } |
241 | 241 | ||
242 | void CategoryTabWidget::updateLink(const QString& linkfile) | 242 | void CategoryTabWidget::updateLink(const QString& linkfile) |
243 | { | 243 | { |
244 | int i=0; | 244 | int i=0; |
245 | LauncherView* view; | 245 | LauncherView* view; |
246 | while ((view = (LauncherView*)stack->widget(i++))) { | 246 | while ((view = (LauncherView*)stack->widget(i++))) { |
247 | if ( view->removeLink(linkfile) ) | 247 | if ( view->removeLink(linkfile) ) |
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | addItem(linkfile); | 250 | addItem(linkfile); |
251 | docview->updateTools(); | 251 | docview->updateTools(); |
252 | } | 252 | } |
253 | 253 | ||
254 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 254 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
255 | { | 255 | { |
256 | QVBox::paletteChange( p ); | 256 | QVBox::paletteChange( p ); |
257 | QPalette pal = palette(); | 257 | QPalette pal = palette(); |
258 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 258 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
259 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 259 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
260 | categoryBar->setPalette( pal ); | 260 | categoryBar->setPalette( pal ); |
261 | categoryBar->update(); | 261 | categoryBar->update(); |
262 | } | 262 | } |
263 | 263 | ||
264 | void CategoryTabWidget::setBusy(bool on) | 264 | void CategoryTabWidget::setBusy(bool on) |
265 | { | 265 | { |
266 | if ( on ) | 266 | if ( on ) |
267 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 267 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
268 | else | 268 | else |
269 | for (int i=0; i<tabs; i++) | 269 | for (int i=0; i<tabs; i++) |
270 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 270 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) | 274 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) |
275 | : QTabBar( parent, name ) | 275 | : QTabBar( parent, name ) |
276 | { | 276 | { |
277 | setFocusPolicy( NoFocus ); | 277 | setFocusPolicy( NoFocus ); |
278 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); | 278 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); |
279 | } | 279 | } |
280 | 280 | ||
281 | CategoryTabBar::~CategoryTabBar() | 281 | CategoryTabBar::~CategoryTabBar() |
282 | { | 282 | { |
283 | } | 283 | } |
284 | 284 | ||
285 | void CategoryTabBar::layoutTabs() | 285 | void CategoryTabBar::layoutTabs() |
286 | { | 286 | { |
287 | if ( !count() ) | 287 | if ( !count() ) |
288 | return; | 288 | return; |
289 | 289 | ||
290 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; | 290 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; |
291 | int hiddenTabWidth = -12; | 291 | int hiddenTabWidth = -12; |
292 | int middleTab = currentTab(); | 292 | int middleTab = currentTab(); |
293 | int hframe, vframe, overlap; | 293 | int hframe, vframe, overlap; |
294 | style().tabbarMetrics( this, hframe, vframe, overlap ); | 294 | style().tabbarMetrics( this, hframe, vframe, overlap ); |
295 | QFontMetrics fm = fontMetrics(); | 295 | QFontMetrics fm = fontMetrics(); |
296 | int x = 0; | 296 | int x = 0; |
297 | QRect r; | 297 | QRect r; |
298 | QTab *t; | 298 | QTab *t; |
299 | int available = width()-1; | 299 | int available = width()-1; |
300 | int required = 0; | 300 | int required = 0; |
301 | for ( int i = 0; i < count(); i++ ) { | 301 | for ( int i = 0; i < count(); i++ ) { |
302 | t = tab(i); | 302 | t = tab(i); |
303 | // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { | 303 | // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { |
304 | if ( i != middleTab ) { | 304 | if ( i != middleTab ) { |
305 | // required += hiddenTabWidth + hframe - overlap; | 305 | // required += hiddenTabWidth + hframe - overlap; |
306 | available -= hiddenTabWidth + hframe - overlap; | 306 | available -= hiddenTabWidth + hframe - overlap; |
307 | if ( t->iconSet() != 0 ) | 307 | if ( t->iconSet() != 0 ) |
308 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 308 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
309 | } else { | 309 | } else { |
310 | required += fm.width( t->text() ) + hframe - overlap; | 310 | required += fm.width( t->text() ) + hframe - overlap; |
311 | if ( t->iconSet() != 0 ) | 311 | if ( t->iconSet() != 0 ) |
312 | required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 312 | required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | for ( int i = 0; i < count(); i++ ) { | 315 | for ( int i = 0; i < count(); i++ ) { |
316 | t = tab(i); | 316 | t = tab(i); |
317 | // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { | 317 | // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) { |
318 | if ( i != middleTab ) { | 318 | if ( i != middleTab ) { |
319 | int w = hiddenTabWidth; | 319 | int w = hiddenTabWidth; |
320 | int ih = 0; | 320 | int ih = 0; |
321 | if ( t->iconSet() != 0 ) { | 321 | if ( t->iconSet() != 0 ) { |
322 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 322 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
323 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 323 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
324 | } | 324 | } |
325 | int h = QMAX( fm.height(), ih ); | 325 | int h = QMAX( fm.height(), ih ); |
326 | h = QMAX( h, QApplication::globalStrut().height() ); | 326 | h = QMAX( h, QApplication::globalStrut().height() ); |
327 | 327 | ||
328 | h += vframe; | 328 | h += vframe; |
329 | w += hframe; | 329 | w += hframe; |
330 | 330 | ||
331 | t->setRect( QRect(x, 0, w, h) ); | 331 | t->setRect( QRect(x, 0, w, h) ); |
332 | x += t->rect().width() - overlap; | 332 | x += t->rect().width() - overlap; |
333 | r = r.unite( t->rect() ); | 333 | r = r.unite( t->rect() ); |
334 | } else { | 334 | } else { |
335 | int w = fm.width( t->text() ); | 335 | int w = fm.width( t->text() ); |
336 | int ih = 0; | 336 | int ih = 0; |
337 | if ( t->iconSet() != 0 ) { | 337 | if ( t->iconSet() != 0 ) { |
338 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 338 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
339 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 339 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
340 | } | 340 | } |
341 | int h = QMAX( fm.height(), ih ); | 341 | int h = QMAX( fm.height(), ih ); |
342 | h = QMAX( h, QApplication::globalStrut().height() ); | 342 | h = QMAX( h, QApplication::globalStrut().height() ); |
343 | 343 | ||
344 | h += vframe; | 344 | h += vframe; |
345 | w += hframe; | 345 | w += hframe; |
346 | 346 | ||
347 | // t->setRect( QRect(x, 0, w * available/required, h) ); | 347 | // t->setRect( QRect(x, 0, w * available/required, h) ); |
348 | t->setRect( QRect(x, 0, available, h) ); | 348 | t->setRect( QRect(x, 0, available, h) ); |
349 | x += t->rect().width() - overlap; | 349 | x += t->rect().width() - overlap; |
350 | r = r.unite( t->rect() ); | 350 | r = r.unite( t->rect() ); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
354 | QRect rr = tab(count()-1)->rect(); | 354 | QRect rr = tab(count()-1)->rect(); |
355 | rr.setRight(width()-1); | 355 | rr.setRight(width()-1); |
356 | tab(count()-1)->setRect( rr ); | 356 | tab(count()-1)->setRect( rr ); |
357 | 357 | ||
358 | for ( t = tabList()->first(); t; t = tabList()->next() ) { | 358 | for ( t = tabList()->first(); t; t = tabList()->next() ) { |
359 | QRect tr = t->rect(); | 359 | QRect tr = t->rect(); |
360 | tr.setHeight( r.height() ); | 360 | tr.setHeight( r.height() ); |
361 | t->setRect( tr ); | 361 | t->setRect( tr ); |
362 | } | 362 | } |
363 | 363 | ||
364 | update(); | 364 | update(); |
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | 368 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const |
369 | { | 369 | { |
370 | #if QT_VERSION >= 300 | 370 | #if QT_VERSION >= 300 |
371 | QStyle::SFlags flags = QStyle::Style_Default; | 371 | QStyle::SFlags flags = QStyle::Style_Default; |
372 | if ( selected ) | 372 | if ( selected ) |
373 | flags |= QStyle::Style_Selected; | 373 | flags |= QStyle::Style_Selected; |
374 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), | 374 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), |
375 | colorGroup(), flags, QStyleOption(t) ); | 375 | colorGroup(), flags, QStyleOption(t) ); |
376 | #else | 376 | #else |
377 | style().drawTab( p, this, t, selected ); | 377 | style().drawTab( p, this, t, selected ); |
378 | #endif | 378 | #endif |
379 | 379 | ||
380 | QRect r( t->rect() ); | 380 | QRect r( t->rect() ); |
381 | QFont f( font() ); | 381 | QFont f( font() ); |
382 | if ( selected ) | 382 | if ( selected ) |
383 | f.setBold( TRUE ); | 383 | f.setBold( TRUE ); |
384 | p->setFont( f ); | 384 | p->setFont( f ); |
385 | 385 | ||
386 | int iw = 0; | 386 | int iw = 0; |
387 | int ih = 0; | 387 | int ih = 0; |
388 | if ( t->iconSet() != 0 ) { | 388 | if ( t->iconSet() != 0 ) { |
389 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; | 389 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; |
390 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 390 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
391 | } | 391 | } |
392 | int w = iw + p->fontMetrics().width( t->text() ) + 4; | 392 | int w = iw + p->fontMetrics().width( t->text() ) + 4; |
393 | int h = QMAX(p->fontMetrics().height() + 4, ih ); | 393 | int h = QMAX(p->fontMetrics().height() + 4, ih ); |
394 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, | 394 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, |
395 | r.top() + (r.height()-h)/2, w, h ), t, | 395 | r.top() + (r.height()-h)/2, w, h ), t, |
396 | #if QT_VERSION >= 300 | 396 | #if QT_VERSION >= 300 |
397 | t->identifier() == keyboardFocusTab() | 397 | t->identifier() == keyboardFocusTab() |
398 | #else | 398 | #else |
399 | t->identitifer() == keyboardFocusTab() | 399 | t->identitifer() == keyboardFocusTab() |
400 | #endif | 400 | #endif |
401 | ); | 401 | ); |
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
405 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | 405 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, |
406 | QTab* t, bool has_focus ) const | 406 | QTab* t, bool has_focus ) const |
407 | { | 407 | { |
408 | QRect r = t->rect(); | 408 | QRect r = t->rect(); |
409 | // if ( t->id != currentTab() ) | 409 | // if ( t->id != currentTab() ) |
410 | //r.moveBy( 1, 1 ); | 410 | //r.moveBy( 1, 1 ); |
411 | // | 411 | // |
412 | if ( t->iconSet() ) { | 412 | if ( t->iconSet() ) { |
413 | // the tab has an iconset, draw it in the right mode | 413 | // the tab has an iconset, draw it in the right mode |
414 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 414 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
415 | if ( mode == QIconSet::Normal && has_focus ) | 415 | if ( mode == QIconSet::Normal && has_focus ) |
416 | mode = QIconSet::Active; | 416 | mode = QIconSet::Active; |
417 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); | 417 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); |
418 | int pixw = pixmap.width(); | 418 | int pixw = pixmap.width(); |
419 | int pixh = pixmap.height(); | 419 | int pixh = pixmap.height(); |
420 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); | 420 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); |
421 | r.setLeft( r.left() + pixw + 5 ); | 421 | r.setLeft( r.left() + pixw + 5 ); |
422 | } | 422 | } |
423 | 423 | ||
424 | QRect tr = r; | 424 | QRect tr = r; |
425 | 425 | ||
426 | if ( r.width() < 20 ) | 426 | if ( r.width() < 20 ) |
427 | return; | 427 | return; |
428 | 428 | ||
429 | if ( t->isEnabled() && isEnabled() ) { | 429 | if ( t->isEnabled() && isEnabled() ) { |
430 | #if defined(_WS_WIN32_) | 430 | #if defined(_WS_WIN32_) |
431 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) | 431 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) |
432 | p->setPen( colorGroup().buttonText() ); | 432 | p->setPen( colorGroup().buttonText() ); |
433 | else | 433 | else |
434 | p->setPen( colorGroup().foreground() ); | 434 | p->setPen( colorGroup().foreground() ); |
435 | #else | 435 | #else |
436 | p->setPen( colorGroup().foreground() ); | 436 | p->setPen( colorGroup().foreground() ); |
437 | #endif | 437 | #endif |
438 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 438 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
439 | } else { | 439 | } else { |
440 | p->setPen( palette().disabled().foreground() ); | 440 | p->setPen( palette().disabled().foreground() ); |
441 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 441 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | //--------------------------------------------------------------------------- | 445 | //--------------------------------------------------------------------------- |
446 | 446 | ||
447 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | 447 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) |
448 | : QMainWindow( parent, name, fl ) | 448 | : QMainWindow( parent, name, fl ) |
449 | { | 449 | { |
450 | setCaption( tr("Launcher") ); | 450 | setCaption( tr("Launcher") ); |
451 | 451 | ||
452 | syncDialog = 0; | 452 | syncDialog = 0; |
453 | 453 | ||
454 | // we have a pretty good idea how big we'll be | 454 | // we have a pretty good idea how big we'll be |
455 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 455 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
456 | 456 | ||
457 | tabs = 0; | 457 | tabs = 0; |
458 | rootFolder = 0; | 458 | rootFolder = 0; |
459 | docsFolder = 0; | 459 | docsFolder = 0; |
460 | int stamp = uidgen.generate(); // this is our timestamp to see which devices we know | 460 | int stamp = uidgen.generate(); // this is our timestamp to see which devices we know |
461 | //uidgen.store( stamp ); | 461 | //uidgen.store( stamp ); |
462 | m_timeStamp = QString::number( stamp ); | 462 | m_timeStamp = QString::number( stamp ); |
463 | 463 | ||
464 | tabs = new CategoryTabWidget( this ); | 464 | tabs = new CategoryTabWidget( this ); |
465 | tabs->setMaximumWidth( qApp->desktop()->width() ); | 465 | tabs->setMaximumWidth( qApp->desktop()->width() ); |
466 | setCentralWidget( tabs ); | 466 | setCentralWidget( tabs ); |
467 | 467 | ||
468 | connect( tabs, SIGNAL(selected(const QString&)), | 468 | connect( tabs, SIGNAL(selected(const QString&)), |
469 | this, SLOT(viewSelected(const QString&)) ); | 469 | this, SLOT(viewSelected(const QString&)) ); |
470 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 470 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
471 | this, SLOT(select(const AppLnk*))); | 471 | this, SLOT(select(const AppLnk*))); |
472 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 472 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
473 | this, SLOT(properties(AppLnk*))); | 473 | this, SLOT(properties(AppLnk*))); |
474 | 474 | ||
475 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 475 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
476 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 476 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
477 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 477 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
478 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 478 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
479 | #endif | 479 | #endif |
480 | 480 | ||
481 | storage = new StorageInfo( this ); | 481 | storage = new StorageInfo( this ); |
482 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); | 482 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); |
483 | 483 | ||
484 | updateTabs(); | 484 | updateTabs(); |
485 | 485 | ||
486 | preloadApps(); | 486 | preloadApps(); |
487 | 487 | ||
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index f0de85b..e0acf4e 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp | |||
@@ -1,235 +1,231 @@ | |||
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 | ||
23 | MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, bool modal, WFlags fl ) | 23 | MediumMountGui::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 | ||
38 | void MediumMountGui::readConfig(){ | 38 | void 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 | 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 | ||
55 | bool MediumMountGui::check() { | 55 | bool MediumMountGui::check() { |
56 | return !checkagain; | 56 | return !checkagain; |
57 | } | 57 | } |
58 | 58 | ||
59 | QStringList MediumMountGui::dirs() { | 59 | QStringList MediumMountGui::dirs() { |
60 | QStringList list = QStringList::split(",", limittodirs ); | 60 | QStringList list = QStringList::split(",", limittodirs ); |
61 | return list; | 61 | return list; |
62 | } | 62 | } |
63 | 63 | ||
64 | void MediumMountGui::writeConfig(bool autocheck) { | 64 | void 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 "QString::null" to the list. | 83 | // if all is checked then add only "QString::null" to the list. |
84 | if (checkmimeall) { | 84 | if (checkmimeall) { |
85 | mimeTypeList.clear(); | 85 | mimeTypeList.clear(); |
86 | mimeTypeList += QString::null; | 86 | mimeTypeList += QString::null; |
87 | } else { | 87 | } else { |
88 | if (checkmimeaudio) { | 88 | if (checkmimeaudio) { |
89 | mimeTypeList += ("audio//*"); | 89 | mimeTypeList += ("audio/*"); |
90 | } | 90 | } |
91 | if (checkmimetext) { | 91 | if (checkmimetext) { |
92 | mimeTypeList += ("text//*"); | 92 | mimeTypeList += ("text/*"); |
93 | } | 93 | } |
94 | if (checkmimevideo) { | 94 | if (checkmimevideo) { |
95 | mimeTypeList += ("video//*"); | 95 | mimeTypeList += ("video/*"); |
96 | } | 96 | } |
97 | if (checkmimeimage) { | 97 | if (checkmimeimage) { |
98 | mimeTypeList += ("image//*"); | 98 | mimeTypeList += ("image/*"); |
99 | } | ||
100 | if (checkmimeall) { | ||
101 | mimeTypeList.clear(); | ||
102 | mimeTypeList << QString::null; | ||
103 | } | 99 | } |
104 | } | 100 | } |
105 | cfg.write(); // not really needed here but just to be sure | 101 | cfg.write(); // not really needed here but just to be sure |
106 | } | 102 | } |
107 | 103 | ||
108 | void MediumMountGui::startGui() { | 104 | void MediumMountGui::startGui() { |
109 | 105 | ||
110 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); | 106 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); |
111 | 107 | ||
112 | Text_2 = new QLabel( this ); | 108 | Text_2 = new QLabel( this ); |
113 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); | 109 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); |
114 | Text_2->setPixmap( image ); | 110 | Text_2->setPixmap( image ); |
115 | 111 | ||
116 | Text = new QLabel( this, "Text" ); | 112 | Text = new QLabel( this, "Text" ); |
117 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); | 113 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); |
118 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); | 114 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); |
119 | 115 | ||
120 | // media box | 116 | // media box |
121 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); | 117 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); |
122 | GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); | 118 | GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); |
123 | GroupBox1->setTitle( tr( "Which media files" ) ); | 119 | GroupBox1->setTitle( tr( "Which media files" ) ); |
124 | 120 | ||
125 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); | 121 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); |
126 | CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); | 122 | CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); |
127 | CheckBoxAudio->setText( tr( "Audio" ) ); | 123 | CheckBoxAudio->setText( tr( "Audio" ) ); |
128 | 124 | ||
129 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); | 125 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); |
130 | CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); | 126 | CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); |
131 | CheckBoxImage->setText( tr( "Image" ) ); | 127 | CheckBoxImage->setText( tr( "Image" ) ); |
132 | 128 | ||
133 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); | 129 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); |
134 | CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); | 130 | CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); |
135 | CheckBoxText->setText( tr( "Text" ) ); | 131 | CheckBoxText->setText( tr( "Text" ) ); |
136 | 132 | ||
137 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); | 133 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); |
138 | CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); | 134 | CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); |
139 | CheckBoxVideo->setText( tr( "Video" ) ); | 135 | CheckBoxVideo->setText( tr( "Video" ) ); |
140 | 136 | ||
141 | CheckBoxAll = new QCheckBox ( GroupBox1); | 137 | CheckBoxAll = new QCheckBox ( GroupBox1); |
142 | CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) ); | 138 | CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) ); |
143 | CheckBoxAll->setText( tr( "All" ) ); | 139 | CheckBoxAll->setText( tr( "All" ) ); |
144 | QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) ); | 140 | QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) ); |
145 | 141 | ||
146 | 142 | ||
147 | 143 | ||
148 | CheckBoxLink = new QCheckBox ( GroupBox1); | 144 | CheckBoxLink = new QCheckBox ( GroupBox1); |
149 | CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) ); | 145 | CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) ); |
150 | CheckBoxLink->setText( tr( "Link apps" ) ); | 146 | CheckBoxLink->setText( tr( "Link apps" ) ); |
151 | // as long as the feature is not supported | 147 | // as long as the feature is not supported |
152 | CheckBoxLink->setEnabled(false); | 148 | CheckBoxLink->setEnabled(false); |
153 | 149 | ||
154 | 150 | ||
155 | // select dirs | 151 | // select dirs |
156 | 152 | ||
157 | DirSelectText = new QLabel( this, "DirSelectText" ); | 153 | DirSelectText = new QLabel( this, "DirSelectText" ); |
158 | DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); | 154 | DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); |
159 | DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); | 155 | DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); |
160 | 156 | ||
161 | LineEdit1 = new QLineEdit( this ); | 157 | LineEdit1 = new QLineEdit( this ); |
162 | LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); | 158 | LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); |
163 | 159 | ||
164 | PushButton3 = new QPushButton( this ); | 160 | PushButton3 = new QPushButton( this ); |
165 | PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); | 161 | PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); |
166 | PushButton3->setText( tr( "Add" ) ); | 162 | PushButton3->setText( tr( "Add" ) ); |
167 | 163 | ||
168 | 164 | ||
169 | // decision | 165 | // decision |
170 | DirSelectText_2 = new QLabel( this ); | 166 | DirSelectText_2 = new QLabel( this ); |
171 | DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); | 167 | DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); |
172 | DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); | 168 | DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); |
173 | 169 | ||
174 | // ask again | 170 | // ask again |
175 | AskBox = new QCheckBox( this ); | 171 | AskBox = new QCheckBox( this ); |
176 | AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); | 172 | AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); |
177 | AskBox->setText( tr( "Do not ask again for this medium" ) ); | 173 | AskBox->setText( tr( "Do not ask again for this medium" ) ); |
178 | 174 | ||
179 | 175 | ||
180 | AskBox->setChecked(checkagain); | 176 | AskBox->setChecked(checkagain); |
181 | CheckBoxAudio->setChecked(checkmimeaudio); | 177 | CheckBoxAudio->setChecked(checkmimeaudio); |
182 | CheckBoxImage->setChecked(checkmimeimage); | 178 | CheckBoxImage->setChecked(checkmimeimage); |
183 | CheckBoxText->setChecked(checkmimetext); | 179 | CheckBoxText->setChecked(checkmimetext); |
184 | CheckBoxVideo->setChecked(checkmimevideo); | 180 | CheckBoxVideo->setChecked(checkmimevideo); |
185 | 181 | ||
186 | // buttons | 182 | // buttons |
187 | quit = new QPushButton( this ); | 183 | quit = new QPushButton( this ); |
188 | quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); | 184 | quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); |
189 | quit->setFocus(); | 185 | quit->setFocus(); |
190 | quit->setText( tr( "Yes" ) ); | 186 | quit->setText( tr( "Yes" ) ); |
191 | 187 | ||
192 | quit_2 = new QPushButton( this ); | 188 | quit_2 = new QPushButton( this ); |
193 | quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); | 189 | quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); |
194 | quit_2->setText( tr( "No" ) ); | 190 | quit_2->setText( tr( "No" ) ); |
195 | 191 | ||
196 | QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); | 192 | QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); |
197 | QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); | 193 | QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); |
198 | 194 | ||
199 | 195 | ||
200 | } | 196 | } |
201 | 197 | ||
202 | 198 | ||
203 | void MediumMountGui::deactivateOthers() { | 199 | void MediumMountGui::deactivateOthers() { |
204 | bool mod = !(CheckBoxAll->isChecked()); | 200 | bool mod = !(CheckBoxAll->isChecked()); |
205 | 201 | ||
206 | //if (!CheckBoxVideo->isChecked()){ | 202 | //if (!CheckBoxVideo->isChecked()){ |
207 | // mod = false; | 203 | // mod = false; |
208 | //} else { | 204 | //} else { |
209 | // mod = true; | 205 | // mod = true; |
210 | //} | 206 | //} |
211 | CheckBoxVideo->setEnabled(mod); | 207 | CheckBoxVideo->setEnabled(mod); |
212 | CheckBoxAudio->setEnabled(mod); | 208 | CheckBoxAudio->setEnabled(mod); |
213 | CheckBoxText->setEnabled(mod); | 209 | CheckBoxText->setEnabled(mod); |
214 | CheckBoxImage->setEnabled(mod); | 210 | CheckBoxImage->setEnabled(mod); |
215 | } | 211 | } |
216 | 212 | ||
217 | void MediumMountGui::yesPressed() { | 213 | void MediumMountGui::yesPressed() { |
218 | writeConfig(true); | 214 | writeConfig(true); |
219 | // and do something | 215 | // and do something |
220 | accept(); | 216 | accept(); |
221 | } | 217 | } |
222 | 218 | ||
223 | 219 | ||
224 | QStringList MediumMountGui::mimeTypes(){ | 220 | QStringList MediumMountGui::mimeTypes(){ |
225 | return mimeTypeList; | 221 | return mimeTypeList; |
226 | } | 222 | } |
227 | 223 | ||
228 | void MediumMountGui::noPressed() { | 224 | void MediumMountGui::noPressed() { |
229 | writeConfig(false); | 225 | writeConfig(false); |
230 | reject(); | 226 | reject(); |
231 | } | 227 | } |
232 | 228 | ||
233 | MediumMountGui::~MediumMountGui(){ | 229 | MediumMountGui::~MediumMountGui(){ |
234 | } | 230 | } |
235 | 231 | ||