summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-06 20:54:54 (UTC)
committer llornkcor <llornkcor>2002-05-06 20:54:54 (UTC)
commit8622bcb85245937853f3e657498957deb7eb2073 (patch) (side-by-side diff)
tree9c48f2312364b71358288e435e0ce5c39bd63c40
parent24259e7b1446f671861b86ee1abb5d8021b98387 (diff)
downloadopie-8622bcb85245937853f3e657498957deb7eb2073.zip
opie-8622bcb85245937853f3e657498957deb7eb2073.tar.gz
opie-8622bcb85245937853f3e657498957deb7eb2073.tar.bz2
removed license info as per request from benmeyer..... it's still GPL, tho
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/tabmanager/app.cpp30
-rw-r--r--noncore/settings/tabmanager/app.h28
-rw-r--r--noncore/settings/tabmanager/main.cpp28
-rw-r--r--noncore/settings/tabmanager/tabapplnk.h28
-rw-r--r--noncore/settings/tabmanager/tablistview.h30
-rw-r--r--noncore/settings/tabmanager/tabmainwindow.h28
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp29
-rw-r--r--noncore/settings/tabmanager/tabmanager.h28
8 files changed, 2 insertions, 227 deletions
diff --git a/noncore/settings/tabmanager/app.cpp b/noncore/settings/tabmanager/app.cpp
index aa17bfe..30ba9a5 100644
--- a/noncore/settings/tabmanager/app.cpp
+++ b/noncore/settings/tabmanager/app.cpp
@@ -1,111 +1,83 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
/****************************************************************************
** Form implementation generated from reading ui file 'app.ui'
**
** Created: Fri May 3 14:38:15 2002
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "app.h"
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a AppEdit which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
AppEdit::AppEdit( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
- setName( "AppEdit" );
+ setName( "AppEdit" );
resize( 211, 241 );
setCaption( tr( "Application" ) );
AppEditLayout = new QGridLayout( this );
AppEditLayout->setSpacing( 6 );
AppEditLayout->setMargin( 11 );
TextLabel3 = new QLabel( this, "TextLabel3" );
TextLabel3->setText( tr( "Exec" ) );
AppEditLayout->addWidget( TextLabel3, 2, 0 );
TextLabel4 = new QLabel( this, "TextLabel4" );
TextLabel4->setText( tr( "Comment" ) );
AppEditLayout->addWidget( TextLabel4, 3, 0 );
TextLabel2 = new QLabel( this, "TextLabel2" );
TextLabel2->setText( tr( "Icon" ) );
AppEditLayout->addWidget( TextLabel2, 1, 0 );
TextLabel1 = new QLabel( this, "TextLabel1" );
TextLabel1->setText( tr( "Name" ) );
AppEditLayout->addWidget( TextLabel1, 0, 0 );
iconLineEdit = new QLineEdit( this, "iconLineEdit" );
AppEditLayout->addWidget( iconLineEdit, 1, 1 );
nameLineEdit = new QLineEdit( this, "nameLineEdit" );
AppEditLayout->addWidget( nameLineEdit, 0, 1 );
commentLineEdit = new QLineEdit( this, "commentLineEdit" );
AppEditLayout->addWidget( commentLineEdit, 3, 1 );
execLineEdit = new QLineEdit( this, "execLineEdit" );
AppEditLayout->addWidget( execLineEdit, 2, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
AppEditLayout->addItem( spacer, 4, 1 );
}
/*
* Destroys the object and frees any allocated resources
*/
AppEdit::~AppEdit()
{
// no need to delete child widgets, Qt does it all for us
}
diff --git a/noncore/settings/tabmanager/app.h b/noncore/settings/tabmanager/app.h
index 89afb28..ffa6222 100644
--- a/noncore/settings/tabmanager/app.h
+++ b/noncore/settings/tabmanager/app.h
@@ -1,69 +1,41 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
/****************************************************************************
** Form interface generated from reading ui file 'app.ui'
**
** Created: Fri May 3 14:38:09 2002
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef APPEDIT_H
#define APPEDIT_H
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QLabel;
class QLineEdit;
class AppEdit : public QDialog
{
Q_OBJECT
public:
AppEdit( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~AppEdit();
QLabel* TextLabel3;
QLabel* TextLabel4;
QLabel* TextLabel2;
QLabel* TextLabel1;
QLineEdit* iconLineEdit;
QLineEdit* nameLineEdit;
QLineEdit* commentLineEdit;
QLineEdit* execLineEdit;
protected:
QGridLayout* AppEditLayout;
};
#endif // APPEDIT_H
diff --git a/noncore/settings/tabmanager/main.cpp b/noncore/settings/tabmanager/main.cpp
index a96d768..f737de5 100644
--- a/noncore/settings/tabmanager/main.cpp
+++ b/noncore/settings/tabmanager/main.cpp
@@ -1,40 +1,12 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
#include "tabmainwindow.h"
#include <qpe/qpeapplication.h>
int main( int argc, char **argv ){
QPEApplication application( argc, argv );
TabMainWindow mainWindow;
application.showMainWidget(&mainWindow);
return application.exec();
}
//main.cpp
diff --git a/noncore/settings/tabmanager/tabapplnk.h b/noncore/settings/tabmanager/tabapplnk.h
index 6669144..9333e87 100644
--- a/noncore/settings/tabmanager/tabapplnk.h
+++ b/noncore/settings/tabmanager/tabapplnk.h
@@ -1,46 +1,18 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
#ifndef TABAPPLNK_H
#define TABAPPLNK_H
#include <qpe/applnk.h>
class TabAppLnk : public AppLnk {
public:
TabAppLnk( const QString & file) :AppLnk(file){ };
QString pixmapString() { return mIconFile; };
};
#endif
// tabapplnk.h
diff --git a/noncore/settings/tabmanager/tablistview.h b/noncore/settings/tabmanager/tablistview.h
index 545ee38..97f9dec 100644
--- a/noncore/settings/tabmanager/tablistview.h
+++ b/noncore/settings/tabmanager/tablistview.h
@@ -1,93 +1,65 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
#ifndef TABLISTVIEW_H
#define TABLISTVIEW_H
#include <qlistview.h>
#include <qcursor.h>
#include <qapplication.h>
class TabListView : public QListView {
Q_OBJECT
signals:
void moveItem(QListViewItem *item, QListViewItem *newFolder);
public:
TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL;
connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *)));
internalCursor.setShape(0);
};
protected:
void contentsMouseReleaseEvent(QMouseEvent* ){
- QListViewItem *newGroup = this->currentItem();
+ QListViewItem *newGroup = this->currentItem();
// Make sure they are both real.
if (currentSelectedItem == NULL || newGroup == NULL)
return;
// Make sure they are not the same
if(this->isSelected(currentSelectedItem) == true)
return;
// Ok we have two valid items.
if(newGroup->parent())
newGroup = newGroup->parent();
// Just in case the parent was null
if(newGroup == NULL)
return;
// If the new folder and buddies current parent are the same don't do anything.
if (newGroup != currentSelectedItem->parent())
moveItem(currentSelectedItem, newGroup);
currentSelectedItem = NULL;
qApp->restoreOverrideCursor();
};
private slots:
void itemPressed(QListViewItem *item){
if(item == NULL || !item->parent()){
if(item == NULL)
qDebug("Item is NULL");
return;
}
currentSelectedItem = item;
internalCursor.setShape(13);
qApp->setOverrideCursor(internalCursor);
};
private:
QListViewItem *currentSelectedItem;
QCursor internalCursor;
};
#endif
diff --git a/noncore/settings/tabmanager/tabmainwindow.h b/noncore/settings/tabmanager/tabmainwindow.h
index 2116f5a..c76ad9f 100644
--- a/noncore/settings/tabmanager/tabmainwindow.h
+++ b/noncore/settings/tabmanager/tabmainwindow.h
@@ -1,63 +1,35 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
#ifndef TABMAINWINDOW_H
#define TABMAINWINDOW_H
#include "tabmanager.h"
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qpe/resource.h>
class TabMainWindow : public QMainWindow {
public:
TabMainWindow( QWidget* parent = 0, const char* name = 0) : QMainWindow(parent, name){
tabManager = new TabManager(this, "TabManger");
setCaption("Tab Manager");
this->setCentralWidget(tabManager);
QToolBar *newToolBar = new QToolBar("toolbar", this);
// Insert all of the buttons.
QToolButton *newFolder = new QToolButton(Resource::loadPixmap("fileopen"), "New Folder", 0, tabManager, SLOT(newFolder()), newToolBar);
QToolButton *newFile = new QToolButton(Resource::loadPixmap("new"), "New Folder", 0, tabManager, SLOT(newApplication()), newToolBar);
QToolButton *editItem = new QToolButton(Resource::loadPixmap("edit"), "Edit", 0, tabManager, SLOT(editCurrentItem()), newToolBar);
QToolButton *deleteItem = new QToolButton(Resource::loadPixmap("reset"), "Deelete", 0, tabManager, SLOT(removeItem()), newToolBar);
};
protected:
TabManager *tabManager;
};
#endif
// tabmainwindow.h
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index f54c837..13aae81 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -1,285 +1,256 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
-
#include "tabmanager.h"
#include "app.h"
#include "tabapplnk.h"
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qlistview.h>
#include <qheader.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/qcopenvelope_qws.h>
#define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" // <-- made this a little more flexible
#define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info"
#define NEW_FOLDER "EmptyTab"
#define NEW_APPLICATION "NewApp"
#define APPLICATION_EXTENSION ".desktop"
#define APPLICATION_EXTENSION_LENGTH 8
/**
* Constructor. Sets up signals. Performs initial scan of applications
* and tabs
*/
TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false){
rescanFolder(HOME_APP_DIR);
// Connect the signals and slots
connect(tabList, SIGNAL(doubleClicked(QListViewItem *)),
this, SLOT(editItem(QListViewItem*)));
(tabList->header())->hide();
connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)),
this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
}
/**
* If anything in the tab's have been changed then update the system or alert
* the user.
*/
TabManager::~TabManager(){
if(changed){
//QMessageBox::critical(this, tr("Message"), tr("Please restart Qtopia to see all new changes."),tr("Ok") );
//filename = fn;
QCopEnvelope e("QPE/System", "linkChanged(QString)");
//e << description << filename << mimetype;
QString link; //we'll just send an empty string
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
* @param parent - the parent to place any new tabs or apps into. If parent is
* NULL then the item is a tab and should be placed as a child of the window.
*/
void TabManager::rescanFolder(QString directory, QListViewItem* parent){
//qDebug(QString("rescanFolder: ") + directory.latin1());
QDir d;
d.setPath(directory);
// Show hidden files for .directories
d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
// If it is a dir and not .. or . then add it as a tab and go down.
if(fi->isDir()){
if(fi->fileName() != ".." && fi->fileName() != ".") {
QListViewItem* newItem;
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" );
rescanFolder(directory + "/" + fi->fileName(), newItem);
}
}
else{
// it is a file, if not a .directory add to parent.
// Change parents name and icon to reflect icon.
if(fi->fileName() == ".directory"){
AppLnk app(directory + "/" + fi->fileName());
if(parent){
parent->setPixmap(0,app.pixmap());
parent->setText(0, app.name());
}
}
else{
// Add any desktop files found.
QListViewItem* newItem;
if(directory != HOME_APP_DIR){
if(!parent)
newItem = new QListViewItem(tabList, fi->fileName());
else
newItem = new QListViewItem(parent, fi->fileName());
if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){
AppLnk app(directory + "/" + fi->fileName());
newItem->setPixmap(0,app.pixmap());
newItem->setText(0, app.name());
itemList.insert(newItem, directory + "/" + fi->fileName());
}
}
}
}
++it; // goto next list element
}
}
/**
* Create a new blank Tab.
* Create a physical folder with .directory file
* Create a item on the list
*/
void TabManager::newFolder(){
QDir r;
r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER);
system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1());
QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory";
QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER);
itemList.insert(newItem, homeLocation );
// We have changed something.
changed = true;
}
/**
* Create a new blank application
* Make sure a tab is selected
* create physical file
* fill file with default information (entry, name, type).
*/
void TabManager::newApplication(){
QListViewItem *item = tabList->currentItem();
if(!item || item->parent())
return;
QString parentDir = itemList[item].mid(0,itemList[item].length()-11);
QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION;
system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1());
system((QString("echo Name=" NEW_APPLICATION " | cat >> ") + homeLocation).latin1());
int slash = parentDir.findRev('/', -1);
QString folderName = parentDir.mid(slash+1, parentDir.length());
system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1());
// Insert into the tree
QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION);
itemList.insert(newItem, homeLocation );
// We have changed something.
changed = true;
}
/**
* Remove the item.
* Check if we can
* Prompt user
* Delete physical file (Dir, remove .dir, then dir. File, remove file)
* Remove from installer if need too.
*/
void TabManager::removeItem(){
// Make sure we can delete
QListViewItem *item = tabList->currentItem();
if(!item)
return;
if(item->childCount() > 0){
QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."),
tr("Ok") );
return;
}
// Prompt.
int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"),
tr("Yes"), tr("Cancel"), 0, 1 );
if (answer)
return;
bool removeSuccessfull = true;
QString location = itemList[item];
// Remove file (.directory in a Directory case)
if(!QFile::remove(location))
removeSuccessfull = false;
// Remove directory
if(item->parent() == NULL){
// Remove .directory file string
location = location.mid(0,location.length()-10);
QDir dir;
if(!dir.rmdir(location))
removeSuccessfull = false;
else
removeSuccessfull = true;
}
// If removing failed.
if(!removeSuccessfull){
qDebug((QString("removeItem: ") + location).latin1());
QMessageBox::critical(this, tr("Message"), tr("Can't remove."),
tr("Ok") );
return;
}
// 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.
itemList.remove(item);
if(item->parent())
item->parent()->takeItem(item);
delete item;
// We have changed something.
changed = true;
}
/**
* Helper function. Edits the current item.
* calls editItem with the currently selected item.
*/
void TabManager::editCurrentItem(){
editItem(tabList->currentItem());
}
/**
* Edit the item that is passed in.
* Show application dialog and if anything changed
* @param item the item to edit.
*/
void TabManager::editItem( QListViewItem * item){
if(!item)
return;
TabAppLnk app(itemList[item]);
if(!app.isValid()){
qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
return;
}
AppEdit application(this, tr("Application edit"), true);
application.nameLineEdit->setText(app.name());
application.iconLineEdit->setText(app.pixmapString());
application.execLineEdit->setText(app.exec());
application.commentLineEdit->setText(app.comment());
diff --git a/noncore/settings/tabmanager/tabmanager.h b/noncore/settings/tabmanager/tabmanager.h
index 2700fe7..39865b0 100644
--- a/noncore/settings/tabmanager/tabmanager.h
+++ b/noncore/settings/tabmanager/tabmanager.h
@@ -1,67 +1,39 @@
-/*
-
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
-           .>+-=
- _;:,     .>    :=|. This library is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This library is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
-  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
-..}^=.=       =       ; Library General Public License for more
-++=   -.     .`     .: details.
- :     =  ...= . :.=-
- -.   .:....=;==+<; You should have received a copy of the GNU
-  -_. . .   )=.  = Library General Public License along with
-    --        :-=` this library; see the file COPYING.LIB.
- If not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
#ifndef TABMANAGER_H
#define TABMANAGER_H
#include "tabmanagerbase.h"
#include <qmap.h>
#include <qevent.h>
class QListViewItem;
class TabManager : public TabManagerBase {
Q_OBJECT
public:
TabManager( QWidget* parent = 0, const char* name = 0);
~TabManager();
bool changed;
public slots:
void newFolder();
void newApplication();
void removeItem();
void editCurrentItem();
private slots:
void moveApplication(QListViewItem *, QListViewItem *);
void editItem(QListViewItem * item);
protected:
void rescanFolder(QString directory, QListViewItem* parent=NULL);
QMap<QListViewItem *, QString> itemList;
bool findInstalledApplication(QString desktopFile, QString &installedAppFile);
void swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation );
};
#endif
// tabmanager.h