author | zecke <zecke> | 2004-04-04 22:35:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-04 22:35:57 (UTC) |
commit | ae71ba19e1e7a207e2e1720a13eec4aaddf4e2c2 (patch) (unidiff) | |
tree | bb20dd20b3a5d7e2c0ed0ca98f83530dfee1ed51 /noncore/settings/tabmanager | |
parent | fad3886132f81ff5f1f84c09e9a0b3048d91296d (diff) | |
download | opie-ae71ba19e1e7a207e2e1720a13eec4aaddf4e2c2.zip opie-ae71ba19e1e7a207e2e1720a13eec4aaddf4e2c2.tar.gz opie-ae71ba19e1e7a207e2e1720a13eec4aaddf4e2c2.tar.bz2 |
fix with odebug
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.cpp | 122 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.pro | 2 |
2 files changed, 63 insertions, 61 deletions
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 4274203..3eae424 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -4,4 +4,6 @@ | |||
4 | #include "tabapplnk.h" | 4 | #include "tabapplnk.h" |
5 | 5 | ||
6 | #include <opie2/odebug.h> | ||
7 | |||
6 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
7 | #include <qdir.h> | 9 | #include <qdir.h> |
@@ -64,6 +66,6 @@ TabManager::~TabManager(){ | |||
64 | */ | 66 | */ |
65 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | 67 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ |
66 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; | 68 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
67 | 69 | ||
68 | QDir d; | 70 | QDir d; |
69 | d.setPath(directory); | 71 | d.setPath(directory); |
@@ -90,5 +92,5 @@ void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | |||
90 | else{ | 92 | else{ |
91 | // it is a file, if not a .directory add to parent. | 93 | // it is a file, if not a .directory add to parent. |
92 | 94 | ||
93 | // Change parents name and icon to reflect icon. | 95 | // Change parents name and icon to reflect icon. |
94 | if(fi->fileName() == ".directory"){ | 96 | if(fi->fileName() == ".directory"){ |
@@ -130,9 +132,9 @@ void TabManager::newFolder(){ | |||
130 | system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); | 132 | system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); |
131 | system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); | 133 | system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); |
132 | 134 | ||
133 | QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory"; | 135 | QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory"; |
134 | QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER); | 136 | QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER); |
135 | itemList.insert(newItem, homeLocation ); | 137 | itemList.insert(newItem, homeLocation ); |
136 | 138 | ||
137 | // We have changed something. | 139 | // We have changed something. |
138 | changed = true; | 140 | changed = true; |
@@ -149,6 +151,6 @@ void TabManager::newApplication(){ | |||
149 | if(!item || item->parent()) | 151 | if(!item || item->parent()) |
150 | return; | 152 | return; |
151 | 153 | ||
152 | QString parentDir = itemList[item].mid(0,itemList[item].length()-11); | 154 | QString parentDir = itemList[item].mid(0,itemList[item].length()-11); |
153 | QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION; | 155 | QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION; |
154 | system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1()); | 156 | system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1()); |
@@ -156,11 +158,11 @@ void TabManager::newApplication(){ | |||
156 | int slash = parentDir.findRev('/', -1); | 158 | int slash = parentDir.findRev('/', -1); |
157 | QString folderName = parentDir.mid(slash+1, parentDir.length()); | 159 | QString folderName = parentDir.mid(slash+1, parentDir.length()); |
158 | 160 | ||
159 | system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1()); | 161 | system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1()); |
160 | 162 | ||
161 | // Insert into the tree | 163 | // Insert into the tree |
162 | QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION); | 164 | QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION); |
163 | itemList.insert(newItem, homeLocation ); | 165 | itemList.insert(newItem, homeLocation ); |
164 | 166 | ||
165 | // We have changed something. | 167 | // We have changed something. |
166 | changed = true; | 168 | changed = true; |
@@ -173,5 +175,5 @@ void TabManager::newApplication(){ | |||
173 | * Delete physical file (Dir, remove .dir, then dir. File, remove file) | 175 | * Delete physical file (Dir, remove .dir, then dir. File, remove file) |
174 | * Remove from installer if need too. | 176 | * Remove from installer if need too. |
175 | */ | 177 | */ |
176 | void TabManager::removeItem(){ | 178 | void TabManager::removeItem(){ |
177 | // Make sure we can delete | 179 | // Make sure we can delete |
@@ -181,12 +183,12 @@ void TabManager::removeItem(){ | |||
181 | if(item->childCount() > 0){ | 183 | if(item->childCount() > 0){ |
182 | QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); | 184 | QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); |
183 | return; | 185 | return; |
184 | } | 186 | } |
185 | 187 | ||
186 | // Prompt. | 188 | // Prompt. |
187 | int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 ); | 189 | int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 ); |
188 | if (answer) | 190 | if (answer) |
189 | return; | 191 | return; |
190 | 192 | ||
191 | bool removeSuccessful = true; | 193 | bool removeSuccessful = true; |
192 | QString location = itemList[item]; | 194 | QString location = itemList[item]; |
@@ -194,5 +196,5 @@ void TabManager::removeItem(){ | |||
194 | if(!QFile::remove(location)) | 196 | if(!QFile::remove(location)) |
195 | removeSuccessful = false; | 197 | removeSuccessful = false; |
196 | 198 | ||
197 | // Remove directory | 199 | // Remove directory |
198 | if(item->parent() == NULL){ | 200 | if(item->parent() == NULL){ |
@@ -205,15 +207,15 @@ void TabManager::removeItem(){ | |||
205 | removeSuccessful = true; | 207 | removeSuccessful = true; |
206 | } | 208 | } |
207 | 209 | ||
208 | // If removing failed. | 210 | // If removing failed. |
209 | if(!removeSuccessful){ | 211 | if(!removeSuccessful){ |
210 | odebug << (QString("removeItem: ") + location).latin1() << oendl; | 212 | odebug << (QString("removeItem: ") + location).latin1() << oendl; |
211 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); | 213 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); |
212 | return; | 214 | return; |
213 | } | 215 | } |
214 | 216 | ||
215 | // Remove from the installer so it wont fail. | 217 | // Remove from the installer so it wont fail. |
216 | // Don't need to do this sense the current install uses rm -f so no error | 218 | // Don't need to do this sense the current install uses rm -f so no error |
217 | 219 | ||
218 | // Remove from the gui list. | 220 | // Remove from the gui list. |
219 | itemList.remove(item); | 221 | itemList.remove(item); |
@@ -221,5 +223,5 @@ void TabManager::removeItem(){ | |||
221 | item->parent()->takeItem(item); | 223 | item->parent()->takeItem(item); |
222 | delete item; | 224 | delete item; |
223 | 225 | ||
224 | // We have changed something. | 226 | // We have changed something. |
225 | changed = true; | 227 | changed = true; |
@@ -236,17 +238,17 @@ void TabManager::editCurrentItem(){ | |||
236 | /** | 238 | /** |
237 | * Edit the item that is passed in. | 239 | * Edit the item that is passed in. |
238 | * Show application dialog and if anything changed | 240 | * Show application dialog and if anything changed |
239 | * @param item the item to edit. | 241 | * @param item the item to edit. |
240 | */ | 242 | */ |
241 | void TabManager::editItem( QListViewItem * item){ | 243 | void TabManager::editItem( QListViewItem * item){ |
242 | if(!item) | 244 | if(!item) |
243 | return; | 245 | return; |
244 | 246 | ||
245 | TabAppLnk app(itemList[item]); | 247 | TabAppLnk app(itemList[item]); |
246 | if(!app.isValid()){ | 248 | if(!app.isValid()){ |
247 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; | 249 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; |
248 | return; | 250 | return; |
249 | } | 251 | } |
250 | 252 | ||
251 | // Fill with all of the icons | 253 | // Fill with all of the icons |
252 | if(!application){ | 254 | if(!application){ |
@@ -256,5 +258,5 @@ void TabManager::editItem( QListViewItem * item){ | |||
256 | qApp->processEvents(); | 258 | qApp->processEvents(); |
257 | application = new AppEdit(this, "Application edit", true); | 259 | application = new AppEdit(this, "Application edit", true); |
258 | 260 | ||
259 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 261 | QDir d(QPEApplication::qpeDir() + "/pics/"); |
260 | d.setFilter( QDir::Files); | 262 | d.setFilter( QDir::Files); |
@@ -272,7 +274,7 @@ void TabManager::editItem( QListViewItem * item){ | |||
272 | foo = foo.smoothScale(16,16); | 274 | foo = foo.smoothScale(16,16); |
273 | imageOfFile.convertFromImage(foo); | 275 | imageOfFile.convertFromImage(foo); |
274 | application->iconLineEdit->insertItem(imageOfFile,fileName); | 276 | application->iconLineEdit->insertItem(imageOfFile,fileName); |
275 | } | 277 | } |
276 | //odebug << fi->fileName().latin1() << oendl; | 278 | //odebug << fi->fileName().latin1() << oendl; |
277 | ++it; | 279 | ++it; |
278 | } | 280 | } |
@@ -298,12 +300,12 @@ void TabManager::editItem( QListViewItem * item){ | |||
298 | foo = foo.smoothScale(16,16); | 300 | foo = foo.smoothScale(16,16); |
299 | imageOfFile.convertFromImage(foo); | 301 | imageOfFile.convertFromImage(foo); |
300 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); | 302 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); |
301 | application->iconLineEdit->setCurrentItem(0); | 303 | application->iconLineEdit->setCurrentItem(0); |
302 | } | 304 | } |
303 | 305 | ||
304 | application->nameLineEdit->setText(app.name()); | 306 | application->nameLineEdit->setText(app.name()); |
305 | application->execLineEdit->setText(app.exec()); | 307 | application->execLineEdit->setText(app.exec()); |
306 | application->commentLineEdit->setText(app.comment()); | 308 | application->commentLineEdit->setText(app.comment()); |
307 | 309 | ||
308 | if(item->parent() == NULL){ | 310 | if(item->parent() == NULL){ |
309 | application->execLineEdit->setEnabled(false); | 311 | application->execLineEdit->setEnabled(false); |
@@ -316,5 +318,5 @@ void TabManager::editItem( QListViewItem * item){ | |||
316 | application->setCaption(tr("Application")); | 318 | application->setCaption(tr("Application")); |
317 | } | 319 | } |
318 | 320 | ||
319 | // Only do somthing if they hit OK | 321 | // Only do somthing if they hit OK |
320 | application->showMaximized(); | 322 | application->showMaximized(); |
@@ -339,12 +341,12 @@ void TabManager::editItem( QListViewItem * item){ | |||
339 | return; | 341 | return; |
340 | } | 342 | } |
341 | 343 | ||
342 | // Update the gui icon and name | 344 | // Update the gui icon and name |
343 | item->setText(0,app.name()); | 345 | item->setText(0,app.name()); |
344 | item->setPixmap(0,app.pixmap()); | 346 | item->setPixmap(0,app.pixmap()); |
345 | 347 | ||
346 | // We have changed something. | 348 | // We have changed something. |
347 | changed = true; | 349 | changed = true; |
348 | 350 | ||
349 | // If we were dealing with a new folder or new application change | 351 | // If we were dealing with a new folder or new application change |
350 | // the file names. Also change the item location in itemList | 352 | // the file names. Also change the item location in itemList |
@@ -372,5 +374,5 @@ void TabManager::editItem( QListViewItem * item){ | |||
372 | } | 374 | } |
373 | } | 375 | } |
374 | 376 | ||
375 | /** | 377 | /** |
376 | * Move an application from one directory to another. | 378 | * Move an application from one directory to another. |
@@ -378,18 +380,18 @@ void TabManager::editItem( QListViewItem * item){ | |||
378 | * @param item the application to move | 380 | * @param item the application to move |
379 | * @pearam newGroup the new parent of this application | 381 | * @pearam newGroup the new parent of this application |
380 | */ | 382 | */ |
381 | void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | 383 | void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ |
382 | // Can we even move it? | 384 | // Can we even move it? |
383 | if(!item || !item->parent() || newGroup->parent()) | 385 | if(!item || !item->parent() || newGroup->parent()) |
384 | return; | 386 | return; |
385 | if(item->parent() == newGroup) | 387 | if(item->parent() == newGroup) |
386 | return; | 388 | return; |
387 | 389 | ||
388 | // Get the new folder, new file name, | 390 | // Get the new folder, new file name, |
389 | QString newFolder = itemList[newGroup]; | 391 | QString newFolder = itemList[newGroup]; |
390 | newFolder = newFolder.mid(0,newFolder.length()-11); | 392 | newFolder = newFolder.mid(0,newFolder.length()-11); |
391 | int slash = newFolder.findRev('/', -1); | 393 | int slash = newFolder.findRev('/', -1); |
392 | QString folderName = newFolder.mid(slash+1, newFolder.length()); | 394 | QString folderName = newFolder.mid(slash+1, newFolder.length()); |
393 | 395 | ||
394 | QString desktopFile = itemList[item]; | 396 | QString desktopFile = itemList[item]; |
395 | slash = desktopFile.findRev('/', -1); | 397 | slash = desktopFile.findRev('/', -1); |
@@ -401,14 +403,14 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
401 | if(!r.rename(itemList[item], newFolder)){ | 403 | if(!r.rename(itemList[item], newFolder)){ |
402 | QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); | 404 | QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); |
403 | return; | 405 | return; |
404 | } | 406 | } |
405 | //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; | 407 | //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; |
406 | //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; | 408 | //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; |
407 | 409 | ||
408 | // Move in the gui | 410 | // Move in the gui |
409 | item->parent()->takeItem(item); | 411 | item->parent()->takeItem(item); |
410 | newGroup->insertItem(item); | 412 | newGroup->insertItem(item); |
411 | newGroup->setOpen(true); | 413 | newGroup->setOpen(true); |
412 | 414 | ||
413 | // Move file in the installer | 415 | // Move file in the installer |
414 | QString installedAppFile; | 416 | QString installedAppFile; |
@@ -416,15 +418,15 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
416 | swapInstalledLocation(installedAppFile, desktopFile, newFolder); | 418 | swapInstalledLocation(installedAppFile, desktopFile, newFolder); |
417 | else | 419 | else |
418 | odebug << "moveApplication: No installed app found for dekstop file" << oendl; | 420 | odebug << "moveApplication: No installed app found for dekstop file" << oendl; |
419 | 421 | ||
420 | // Move application type | 422 | // Move application type |
421 | AppLnk app(newFolder); | 423 | AppLnk app(newFolder); |
422 | app.setType(folderName); | 424 | app.setType(folderName); |
423 | app.writeLink(); | 425 | app.writeLink(); |
424 | 426 | ||
425 | // Move in our internal list | 427 | // Move in our internal list |
426 | itemList.remove(item); | 428 | itemList.remove(item); |
427 | itemList.insert(item, newFolder); | 429 | itemList.insert(item, newFolder); |
428 | 430 | ||
429 | // We have changed something. | 431 | // We have changed something. |
430 | changed = true; | 432 | changed = true; |
@@ -438,7 +440,7 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
438 | * @param installedAppFile - location of the app install list | 440 | * @param installedAppFile - location of the app install list |
439 | * @return true if successful, false if file not found. | 441 | * @return true if successful, false if file not found. |
440 | */ | 442 | */ |
441 | bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){ | 443 | bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){ |
442 | 444 | ||
443 | QDir d; | 445 | QDir d; |
444 | d.setPath(HOME_APP_INSTALL_DIR); | 446 | d.setPath(HOME_APP_INSTALL_DIR); |
@@ -465,5 +467,5 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe | |||
465 | } | 467 | } |
466 | else | 468 | else |
467 | odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; | 469 | odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; |
468 | ++it; // goto next list element | 470 | ++it; // goto next list element |
469 | } | 471 | } |
@@ -474,5 +476,5 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe | |||
474 | * Open a file and replace a file containing the old desktop file with the new. | 476 | * Open a file and replace a file containing the old desktop file with the new. |
475 | * @param installedAppFile application installed list | 477 | * @param installedAppFile application installed list |
476 | * @param desktopFile old .desktop file | 478 | * @param desktopFile old .desktop file |
477 | * @param newLocation new .desktop file | 479 | * @param newLocation new .desktop file |
478 | */ | 480 | */ |
@@ -480,8 +482,8 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto | |||
480 | QFile file(installedAppFile); | 482 | QFile file(installedAppFile); |
481 | if ( !file.open(IO_ReadOnly) ){ | 483 | if ( !file.open(IO_ReadOnly) ){ |
482 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; | 484 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; |
483 | return; | 485 | return; |
484 | } | 486 | } |
485 | 487 | ||
486 | QTextStream stream( &file ); // use a text stream | 488 | QTextStream stream( &file ); // use a text stream |
487 | QString allLines; | 489 | QString allLines; |
@@ -497,5 +499,5 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto | |||
497 | 499 | ||
498 | if ( !file.open(IO_ReadWrite) ){ | 500 | if ( !file.open(IO_ReadWrite) ){ |
499 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; | 501 | odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; |
500 | return; | 502 | return; |
501 | } | 503 | } |
diff --git a/noncore/settings/tabmanager/tabmanager.pro b/noncore/settings/tabmanager/tabmanager.pro index dbc81a3..d4aac43 100644 --- a/noncore/settings/tabmanager/tabmanager.pro +++ b/noncore/settings/tabmanager/tabmanager.pro | |||
@@ -5,5 +5,5 @@ SOURCES = main.cpp tabmanager.cpp tabmanagerbase.cpp | |||
5 | INCLUDEPATH+= $(OPIEDIR)/include | 5 | INCLUDEPATH+= $(OPIEDIR)/include |
6 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
7 | LIBS += -lqpe | 7 | LIBS += -lqpe -lopiecore2 |
8 | INTERFACES= app.ui wait.ui | 8 | INTERFACES= app.ui wait.ui |
9 | TARGET = tabmanager | 9 | TARGET = tabmanager |