-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 @@ +#include <opie2/odebug.h> + #include <qpe/applnk.h> @@ -65,4 +67,4 @@ TabManager::~TabManager(){ void TabManager::rescanFolder(QString directory, QListViewItem* parent){ - //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; - + //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; + QDir d; @@ -91,3 +93,3 @@ void TabManager::rescanFolder(QString directory, QListViewItem* parent){ // it is a file, if not a .directory add to parent. - + // Change parents name and icon to reflect icon. @@ -131,3 +133,3 @@ void TabManager::newFolder(){ system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); - + QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory"; @@ -135,3 +137,3 @@ void TabManager::newFolder(){ itemList.insert(newItem, homeLocation ); - + // We have changed something. @@ -150,4 +152,4 @@ void TabManager::newApplication(){ return; - - QString parentDir = itemList[item].mid(0,itemList[item].length()-11); + + QString parentDir = itemList[item].mid(0,itemList[item].length()-11); QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION; @@ -157,5 +159,5 @@ void TabManager::newApplication(){ QString folderName = parentDir.mid(slash+1, parentDir.length()); - + system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1()); - + // Insert into the tree @@ -163,3 +165,3 @@ void TabManager::newApplication(){ itemList.insert(newItem, homeLocation ); - + // We have changed something. @@ -174,3 +176,3 @@ void TabManager::newApplication(){ * Remove from installer if need too. - */ + */ void TabManager::removeItem(){ @@ -182,5 +184,5 @@ void TabManager::removeItem(){ QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); - return; + return; } - + // Prompt. @@ -189,3 +191,3 @@ void TabManager::removeItem(){ return; - + bool removeSuccessful = true; @@ -195,3 +197,3 @@ void TabManager::removeItem(){ removeSuccessful = false; - + // Remove directory @@ -206,6 +208,6 @@ void TabManager::removeItem(){ } - - // If removing failed. + + // If removing failed. if(!removeSuccessful){ - odebug << (QString("removeItem: ") + location).latin1() << oendl; + odebug << (QString("removeItem: ") + location).latin1() << oendl; QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); @@ -213,6 +215,6 @@ void TabManager::removeItem(){ } - + // Remove from the installer so it wont fail. // Don't need to do this sense the current install uses rm -f so no error - + // Remove from the gui list. @@ -222,3 +224,3 @@ void TabManager::removeItem(){ delete item; - + // We have changed something. @@ -237,5 +239,5 @@ void TabManager::editCurrentItem(){ * Edit the item that is passed in. - * Show application dialog and if anything changed + * Show application dialog and if anything changed * @param item the item to edit. - */ + */ void TabManager::editItem( QListViewItem * item){ @@ -243,9 +245,9 @@ void TabManager::editItem( QListViewItem * item){ return; - + TabAppLnk app(itemList[item]); if(!app.isValid()){ - odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; - return; - } - + odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; + return; + } + // Fill with all of the icons @@ -257,3 +259,3 @@ void TabManager::editItem( QListViewItem * item){ application = new AppEdit(this, "Application edit", true); - + QDir d(QPEApplication::qpeDir() + "/pics/"); @@ -273,5 +275,5 @@ void TabManager::editItem( QListViewItem * item){ imageOfFile.convertFromImage(foo); - application->iconLineEdit->insertItem(imageOfFile,fileName); + application->iconLineEdit->insertItem(imageOfFile,fileName); } - //odebug << fi->fileName().latin1() << oendl; + //odebug << fi->fileName().latin1() << oendl; ++it; @@ -299,6 +301,6 @@ void TabManager::editItem( QListViewItem * item){ imageOfFile.convertFromImage(foo); - application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); + application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); application->iconLineEdit->setCurrentItem(0); } - + application->nameLineEdit->setText(app.name()); @@ -306,3 +308,3 @@ void TabManager::editItem( QListViewItem * item){ application->commentLineEdit->setText(app.comment()); - + if(item->parent() == NULL){ @@ -317,3 +319,3 @@ void TabManager::editItem( QListViewItem * item){ } - + // Only do somthing if they hit OK @@ -340,3 +342,3 @@ void TabManager::editItem( QListViewItem * item){ } - + // Update the gui icon and name @@ -344,6 +346,6 @@ void TabManager::editItem( QListViewItem * item){ item->setPixmap(0,app.pixmap()); - + // We have changed something. changed = true; - + // If we were dealing with a new folder or new application change @@ -373,3 +375,3 @@ void TabManager::editItem( QListViewItem * item){ } - + /** @@ -379,3 +381,3 @@ void TabManager::editItem( QListViewItem * item){ * @pearam newGroup the new parent of this application - */ + */ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ @@ -383,3 +385,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ if(!item || !item->parent() || newGroup->parent()) - return; + return; if(item->parent() == newGroup) @@ -387,3 +389,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ - // Get the new folder, new file name, + // Get the new folder, new file name, QString newFolder = itemList[newGroup]; @@ -392,3 +394,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ QString folderName = newFolder.mid(slash+1, newFolder.length()); - + QString desktopFile = itemList[item]; @@ -402,7 +404,7 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ QMessageBox::critical(this, tr("Message"), "Can't move application.", tr("Ok") ); - return; + return; } - //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; - //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; - + //odebug << (QString("moveApplication: ") + itemList[item]).latin1() << oendl; + //odebug << (QString("moveApplication: ") + newFolder).latin1() << oendl; + // Move in the gui @@ -411,3 +413,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ newGroup->setOpen(true); - + // Move file in the installer @@ -417,5 +419,5 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ else - odebug << "moveApplication: No installed app found for dekstop file" << oendl; - - // Move application type + odebug << "moveApplication: No installed app found for dekstop file" << oendl; + + // Move application type AppLnk app(newFolder); @@ -423,3 +425,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ app.writeLink(); - + // Move in our internal list @@ -427,3 +429,3 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ itemList.insert(item, newFolder); - + // We have changed something. @@ -439,5 +441,5 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ * @return true if successful, false if file not found. - */ + */ bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){ - + QDir d; @@ -466,3 +468,3 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe else - odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; + odebug << (QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1() << oendl; ++it; // goto next list element @@ -475,3 +477,3 @@ bool TabManager::findInstalledApplication(QString desktopFile, QString &installe * @param installedAppFile application installed list - * @param desktopFile old .desktop file + * @param desktopFile old .desktop file * @param newLocation new .desktop file @@ -481,6 +483,6 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto if ( !file.open(IO_ReadOnly) ){ - odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; + odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; return; } - + QTextStream stream( &file ); // use a text stream @@ -498,3 +500,3 @@ void TabManager::swapInstalledLocation( QString installedAppFile, QString deskto if ( !file.open(IO_ReadWrite) ){ - odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; + odebug << QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1() << oendl; 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 DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 INTERFACES = app.ui wait.ui |