-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 | |||
@@ -5,2 +5,4 @@ | |||
5 | 5 | ||
6 | #include <opie2/odebug.h> | ||
7 | |||
6 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
@@ -65,4 +67,4 @@ TabManager::~TabManager(){ | |||
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; |
@@ -91,3 +93,3 @@ void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | |||
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. |
@@ -131,3 +133,3 @@ void TabManager::newFolder(){ | |||
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"; |
@@ -135,3 +137,3 @@ void TabManager::newFolder(){ | |||
135 | itemList.insert(newItem, homeLocation ); | 137 | itemList.insert(newItem, homeLocation ); |
136 | 138 | ||
137 | // We have changed something. | 139 | // We have changed something. |
@@ -150,4 +152,4 @@ void TabManager::newApplication(){ | |||
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; |
@@ -157,5 +159,5 @@ void TabManager::newApplication(){ | |||
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 |
@@ -163,3 +165,3 @@ void TabManager::newApplication(){ | |||
163 | itemList.insert(newItem, homeLocation ); | 165 | itemList.insert(newItem, homeLocation ); |
164 | 166 | ||
165 | // We have changed something. | 167 | // We have changed something. |
@@ -174,3 +176,3 @@ void TabManager::newApplication(){ | |||
174 | * Remove from installer if need too. | 176 | * Remove from installer if need too. |
175 | */ | 177 | */ |
176 | void TabManager::removeItem(){ | 178 | void TabManager::removeItem(){ |
@@ -182,5 +184,5 @@ void TabManager::removeItem(){ | |||
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. |
@@ -189,3 +191,3 @@ void TabManager::removeItem(){ | |||
189 | return; | 191 | return; |
190 | 192 | ||
191 | bool removeSuccessful = true; | 193 | bool removeSuccessful = true; |
@@ -195,3 +197,3 @@ void TabManager::removeItem(){ | |||
195 | removeSuccessful = false; | 197 | removeSuccessful = false; |
196 | 198 | ||
197 | // Remove directory | 199 | // Remove directory |
@@ -206,6 +208,6 @@ void TabManager::removeItem(){ | |||
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") ); |
@@ -213,6 +215,6 @@ void TabManager::removeItem(){ | |||
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. |
@@ -222,3 +224,3 @@ void TabManager::removeItem(){ | |||
222 | delete item; | 224 | delete item; |
223 | 225 | ||
224 | // We have changed something. | 226 | // We have changed something. |
@@ -237,5 +239,5 @@ void TabManager::editCurrentItem(){ | |||
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){ |
@@ -243,9 +245,9 @@ void TabManager::editItem( QListViewItem * 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 |
@@ -257,3 +259,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
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/"); |
@@ -273,5 +275,5 @@ void TabManager::editItem( QListViewItem * item){ | |||
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; |
@@ -299,6 +301,6 @@ void TabManager::editItem( QListViewItem * item){ | |||
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()); |
@@ -306,3 +308,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
306 | application->commentLineEdit->setText(app.comment()); | 308 | application->commentLineEdit->setText(app.comment()); |
307 | 309 | ||
308 | if(item->parent() == NULL){ | 310 | if(item->parent() == NULL){ |
@@ -317,3 +319,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
317 | } | 319 | } |
318 | 320 | ||
319 | // Only do somthing if they hit OK | 321 | // Only do somthing if they hit OK |
@@ -340,3 +342,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
340 | } | 342 | } |
341 | 343 | ||
342 | // Update the gui icon and name | 344 | // Update the gui icon and name |
@@ -344,6 +346,6 @@ void TabManager::editItem( QListViewItem * item){ | |||
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 |
@@ -373,3 +375,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
373 | } | 375 | } |
374 | 376 | ||
375 | /** | 377 | /** |
@@ -379,3 +381,3 @@ void TabManager::editItem( QListViewItem * item){ | |||
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){ |
@@ -383,3 +385,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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) |
@@ -387,3 +389,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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]; |
@@ -392,3 +394,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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]; |
@@ -402,7 +404,7 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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 |
@@ -411,3 +413,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
411 | newGroup->setOpen(true); | 413 | newGroup->setOpen(true); |
412 | 414 | ||
413 | // Move file in the installer | 415 | // Move file in the installer |
@@ -417,5 +419,5 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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); |
@@ -423,3 +425,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
423 | app.writeLink(); | 425 | app.writeLink(); |
424 | 426 | ||
425 | // Move in our internal list | 427 | // Move in our internal list |
@@ -427,3 +429,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
427 | itemList.insert(item, newFolder); | 429 | itemList.insert(item, newFolder); |
428 | 430 | ||
429 | // We have changed something. | 431 | // We have changed something. |
@@ -439,5 +441,5 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | |||
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; |
@@ -466,3 +468,3 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe | |||
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 |
@@ -475,3 +477,3 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe | |||
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 |
@@ -481,6 +483,6 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto | |||
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 |
@@ -498,3 +500,3 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto | |||
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; |
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 | |||
@@ -6,3 +6,3 @@ 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 |