author | benmeyer <benmeyer> | 2002-07-26 18:47:13 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-07-26 18:47:13 (UTC) |
commit | 1658b161a890ee69aafac084e04776759932dbce (patch) (unidiff) | |
tree | f4330f580496467a01eb6a487069fe235060a453 | |
parent | 630a8f6e4ff5eddaee0089e383c42cc198c68ced (diff) | |
download | opie-1658b161a890ee69aafac084e04776759932dbce.zip opie-1658b161a890ee69aafac084e04776759932dbce.tar.gz opie-1658b161a890ee69aafac084e04776759932dbce.tar.bz2 |
bug fix
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 5f0899c..c9d7aed 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -244,96 +244,99 @@ void TabManager::editItem( QListViewItem * item){ | |||
244 | 244 | ||
245 | TabAppLnk app(itemList[item]); | 245 | TabAppLnk app(itemList[item]); |
246 | if(!app.isValid()){ | 246 | if(!app.isValid()){ |
247 | qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); | 247 | qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | 250 | ||
251 | // Fill with all of the icons | 251 | // Fill with all of the icons |
252 | if(!application){ | 252 | if(!application){ |
253 | Wait waitDialog(this, "Wait dialog"); | 253 | Wait waitDialog(this, "Wait dialog"); |
254 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 254 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
255 | waitDialog.show(); | 255 | waitDialog.show(); |
256 | qApp->processEvents(); | 256 | qApp->processEvents(); |
257 | application = new AppEdit(this, "Application edit", true); | 257 | application = new AppEdit(this, "Application edit", true); |
258 | 258 | ||
259 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 259 | QDir d(QPEApplication::qpeDir() + "/pics/"); |
260 | d.setFilter( QDir::Files); | 260 | d.setFilter( QDir::Files); |
261 | 261 | ||
262 | const QFileInfoList *list = d.entryInfoList(); | 262 | const QFileInfoList *list = d.entryInfoList(); |
263 | QFileInfoListIterator it( *list ); // create list iterator | 263 | QFileInfoListIterator it( *list ); // create list iterator |
264 | QFileInfo *fi; // pointer for traversing | 264 | QFileInfo *fi; // pointer for traversing |
265 | 265 | ||
266 | while ( (fi=it.current()) ) { // for each file... | 266 | while ( (fi=it.current()) ) { // for each file... |
267 | QString fileName = fi->fileName(); | 267 | QString fileName = fi->fileName(); |
268 | if(fileName.right(4) == ".png"){ | 268 | if(fileName.right(4) == ".png"){ |
269 | fileName = fileName.mid(0,fileName.length()-4); | 269 | fileName = fileName.mid(0,fileName.length()-4); |
270 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 270 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
271 | QImage foo = imageOfFile.convertToImage(); | 271 | QImage foo = imageOfFile.convertToImage(); |
272 | foo = foo.smoothScale(16,16); | 272 | foo = foo.smoothScale(16,16); |
273 | imageOfFile.convertFromImage(foo); | 273 | imageOfFile.convertFromImage(foo); |
274 | application->iconLineEdit->insertItem(imageOfFile,fileName); | 274 | application->iconLineEdit->insertItem(imageOfFile,fileName); |
275 | } | 275 | } |
276 | //qDebug(fi->fileName().latin1()); | 276 | //qDebug(fi->fileName().latin1()); |
277 | ++it; | 277 | ++it; |
278 | } | 278 | } |
279 | waitDialog.hide(); | 279 | waitDialog.hide(); |
280 | } | 280 | } |
281 | int pixmap = -1; | 281 | int pixmap = -1; |
282 | QString pixmapText = app.pixmapString(); | 282 | QString pixmapText = app.pixmapString(); |
283 | QComboBox *f = application->iconLineEdit; | 283 | QComboBox *f = application->iconLineEdit; |
284 | for(int i = 0; i < application->iconLineEdit->count(); i++){ | 284 | for(int i = 0; i < application->iconLineEdit->count(); i++){ |
285 | if(f->text(i) == pixmapText){ | 285 | if(f->text(i) == pixmapText){ |
286 | pixmap = i; | 286 | pixmap = i; |
287 | break; | 287 | break; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | if(pixmap != -1) | 290 | if(pixmap != -1) |
291 | application->iconLineEdit->setCurrentItem(pixmap); | 291 | application->iconLineEdit->setCurrentItem(pixmap); |
292 | else if(pixmapText.isEmpty()){ | ||
293 | application->iconLineEdit->setCurrentItem(0); | ||
294 | } | ||
292 | else{ | 295 | else{ |
293 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); | 296 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); |
294 | QImage foo = imageOfFile.convertToImage(); | 297 | QImage foo = imageOfFile.convertToImage(); |
295 | foo = foo.smoothScale(16,16); | 298 | foo = foo.smoothScale(16,16); |
296 | imageOfFile.convertFromImage(foo); | 299 | imageOfFile.convertFromImage(foo); |
297 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); | 300 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); |
298 | application->iconLineEdit->setCurrentItem(0); | 301 | application->iconLineEdit->setCurrentItem(0); |
299 | } | 302 | } |
300 | 303 | ||
301 | application->nameLineEdit->setText(app.name()); | 304 | application->nameLineEdit->setText(app.name()); |
302 | application->execLineEdit->setText(app.exec()); | 305 | application->execLineEdit->setText(app.exec()); |
303 | application->commentLineEdit->setText(app.comment()); | 306 | application->commentLineEdit->setText(app.comment()); |
304 | 307 | ||
305 | if(item->parent() == NULL){ | 308 | if(item->parent() == NULL){ |
306 | application->execLineEdit->setEnabled(false); | 309 | application->execLineEdit->setEnabled(false); |
307 | application->TextLabel3->setEnabled(false); | 310 | application->TextLabel3->setEnabled(false); |
308 | application->setCaption(tr("Tab")); | 311 | application->setCaption(tr("Tab")); |
309 | } | 312 | } |
310 | else{ | 313 | else{ |
311 | application->execLineEdit->setEnabled(true); | 314 | application->execLineEdit->setEnabled(true); |
312 | application->TextLabel3->setEnabled(true); | 315 | application->TextLabel3->setEnabled(true); |
313 | application->setCaption(tr("Application")); | 316 | application->setCaption(tr("Application")); |
314 | } | 317 | } |
315 | 318 | ||
316 | // Only do somthing if they hit OK | 319 | // Only do somthing if they hit OK |
317 | application->showMaximized(); | 320 | application->showMaximized(); |
318 | if(application->exec() == 0) | 321 | if(application->exec() == 0) |
319 | return; | 322 | return; |
320 | 323 | ||
321 | // If nothing has changed exit (hmmm why did they hit ok?) | 324 | // If nothing has changed exit (hmmm why did they hit ok?) |
322 | if(app.name() == application->nameLineEdit->text() && | 325 | if(app.name() == application->nameLineEdit->text() && |
323 | app.pixmapString() == application->iconLineEdit->currentText() && | 326 | app.pixmapString() == application->iconLineEdit->currentText() && |
324 | app.comment() == application->commentLineEdit->text() && | 327 | app.comment() == application->commentLineEdit->text() && |
325 | app.exec() == application->execLineEdit->text()) | 328 | app.exec() == application->execLineEdit->text()) |
326 | return; | 329 | return; |
327 | 330 | ||
328 | // Change the applnk file | 331 | // Change the applnk file |
329 | QString oldName = app.name(); | 332 | QString oldName = app.name(); |
330 | app.setName(application->nameLineEdit->text()); | 333 | app.setName(application->nameLineEdit->text()); |
331 | app.setIcon(application->iconLineEdit->currentText()); | 334 | app.setIcon(application->iconLineEdit->currentText()); |
332 | app.setComment(application->commentLineEdit->text()); | 335 | app.setComment(application->commentLineEdit->text()); |
333 | app.setExec(application->execLineEdit->text()); | 336 | app.setExec(application->execLineEdit->text()); |
334 | if(!app.writeLink()){ | 337 | if(!app.writeLink()){ |
335 | QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") ); | 338 | QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") ); |
336 | return; | 339 | return; |
337 | } | 340 | } |
338 | 341 | ||
339 | // Update the gui icon and name | 342 | // Update the gui icon and name |