-rw-r--r-- | noncore/settings/tabmanager/app.cpp | 111 | ||||
-rw-r--r-- | noncore/settings/tabmanager/app.h | 69 | ||||
-rw-r--r-- | noncore/settings/tabmanager/main.cpp | 40 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabapplnk.h | 46 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tablistview.h | 93 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmainwindow.h | 63 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.control | 9 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.cpp | 473 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.h | 67 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanager.pro | 11 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanagerbase.cpp | 48 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanagerbase.h | 35 | ||||
-rw-r--r-- | noncore/settings/tabmanager/tabmanagerbase.ui | 75 |
13 files changed, 1140 insertions, 0 deletions
diff --git a/noncore/settings/tabmanager/app.cpp b/noncore/settings/tabmanager/app.cpp new file mode 100644 index 0000000..aa17bfe --- a/dev/null +++ b/noncore/settings/tabmanager/app.cpp | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | /**************************************************************************** | ||
30 | ** Form implementation generated from reading ui file 'app.ui' | ||
31 | ** | ||
32 | ** Created: Fri May 3 14:38:15 2002 | ||
33 | ** by: The User Interface Compiler (uic) | ||
34 | ** | ||
35 | ** WARNING! All changes made in this file will be lost! | ||
36 | ****************************************************************************/ | ||
37 | #include "app.h" | ||
38 | |||
39 | #include <qlabel.h> | ||
40 | #include <qlineedit.h> | ||
41 | #include <qpushbutton.h> | ||
42 | #include <qlayout.h> | ||
43 | #include <qvariant.h> | ||
44 | #include <qtooltip.h> | ||
45 | #include <qwhatsthis.h> | ||
46 | |||
47 | /* | ||
48 | * Constructs a AppEdit which is a child of 'parent', with the | ||
49 | * name 'name' and widget flags set to 'f' | ||
50 | * | ||
51 | * The dialog will by default be modeless, unless you set 'modal' to | ||
52 | * TRUE to construct a modal dialog. | ||
53 | */ | ||
54 | AppEdit::AppEdit( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
55 | : QDialog( parent, name, modal, fl ) | ||
56 | { | ||
57 | if ( !name ) | ||
58 | setName( "AppEdit" ); | ||
59 | resize( 211, 241 ); | ||
60 | setCaption( tr( "Application" ) ); | ||
61 | AppEditLayout = new QGridLayout( this ); | ||
62 | AppEditLayout->setSpacing( 6 ); | ||
63 | AppEditLayout->setMargin( 11 ); | ||
64 | |||
65 | TextLabel3 = new QLabel( this, "TextLabel3" ); | ||
66 | TextLabel3->setText( tr( "Exec" ) ); | ||
67 | |||
68 | AppEditLayout->addWidget( TextLabel3, 2, 0 ); | ||
69 | |||
70 | TextLabel4 = new QLabel( this, "TextLabel4" ); | ||
71 | TextLabel4->setText( tr( "Comment" ) ); | ||
72 | |||
73 | AppEditLayout->addWidget( TextLabel4, 3, 0 ); | ||
74 | |||
75 | TextLabel2 = new QLabel( this, "TextLabel2" ); | ||
76 | TextLabel2->setText( tr( "Icon" ) ); | ||
77 | |||
78 | AppEditLayout->addWidget( TextLabel2, 1, 0 ); | ||
79 | |||
80 | TextLabel1 = new QLabel( this, "TextLabel1" ); | ||
81 | TextLabel1->setText( tr( "Name" ) ); | ||
82 | |||
83 | AppEditLayout->addWidget( TextLabel1, 0, 0 ); | ||
84 | |||
85 | iconLineEdit = new QLineEdit( this, "iconLineEdit" ); | ||
86 | |||
87 | AppEditLayout->addWidget( iconLineEdit, 1, 1 ); | ||
88 | |||
89 | nameLineEdit = new QLineEdit( this, "nameLineEdit" ); | ||
90 | |||
91 | AppEditLayout->addWidget( nameLineEdit, 0, 1 ); | ||
92 | |||
93 | commentLineEdit = new QLineEdit( this, "commentLineEdit" ); | ||
94 | |||
95 | AppEditLayout->addWidget( commentLineEdit, 3, 1 ); | ||
96 | |||
97 | execLineEdit = new QLineEdit( this, "execLineEdit" ); | ||
98 | |||
99 | AppEditLayout->addWidget( execLineEdit, 2, 1 ); | ||
100 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
101 | AppEditLayout->addItem( spacer, 4, 1 ); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Destroys the object and frees any allocated resources | ||
106 | */ | ||
107 | AppEdit::~AppEdit() | ||
108 | { | ||
109 | // no need to delete child widgets, Qt does it all for us | ||
110 | } | ||
111 | |||
diff --git a/noncore/settings/tabmanager/app.h b/noncore/settings/tabmanager/app.h new file mode 100644 index 0000000..89afb28 --- a/dev/null +++ b/noncore/settings/tabmanager/app.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | /**************************************************************************** | ||
30 | ** Form interface generated from reading ui file 'app.ui' | ||
31 | ** | ||
32 | ** Created: Fri May 3 14:38:09 2002 | ||
33 | ** by: The User Interface Compiler (uic) | ||
34 | ** | ||
35 | ** WARNING! All changes made in this file will be lost! | ||
36 | ****************************************************************************/ | ||
37 | #ifndef APPEDIT_H | ||
38 | #define APPEDIT_H | ||
39 | |||
40 | #include <qvariant.h> | ||
41 | #include <qdialog.h> | ||
42 | class QVBoxLayout; | ||
43 | class QHBoxLayout; | ||
44 | class QGridLayout; | ||
45 | class QLabel; | ||
46 | class QLineEdit; | ||
47 | |||
48 | class AppEdit : public QDialog | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | public: | ||
53 | AppEdit( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
54 | ~AppEdit(); | ||
55 | |||
56 | QLabel* TextLabel3; | ||
57 | QLabel* TextLabel4; | ||
58 | QLabel* TextLabel2; | ||
59 | QLabel* TextLabel1; | ||
60 | QLineEdit* iconLineEdit; | ||
61 | QLineEdit* nameLineEdit; | ||
62 | QLineEdit* commentLineEdit; | ||
63 | QLineEdit* execLineEdit; | ||
64 | |||
65 | protected: | ||
66 | QGridLayout* AppEditLayout; | ||
67 | }; | ||
68 | |||
69 | #endif // APPEDIT_H | ||
diff --git a/noncore/settings/tabmanager/main.cpp b/noncore/settings/tabmanager/main.cpp new file mode 100644 index 0000000..a96d768 --- a/dev/null +++ b/noncore/settings/tabmanager/main.cpp | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | #include "tabmainwindow.h" | ||
30 | #include <qpe/qpeapplication.h> | ||
31 | |||
32 | int main( int argc, char **argv ){ | ||
33 | QPEApplication application( argc, argv ); | ||
34 | TabMainWindow mainWindow; | ||
35 | application.showMainWidget(&mainWindow); | ||
36 | return application.exec(); | ||
37 | } | ||
38 | |||
39 | //main.cpp | ||
40 | |||
diff --git a/noncore/settings/tabmanager/tabapplnk.h b/noncore/settings/tabmanager/tabapplnk.h new file mode 100644 index 0000000..6669144 --- a/dev/null +++ b/noncore/settings/tabmanager/tabapplnk.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | #ifndef TABAPPLNK_H | ||
30 | #define TABAPPLNK_H | ||
31 | |||
32 | #include <qpe/applnk.h> | ||
33 | |||
34 | class TabAppLnk : public AppLnk { | ||
35 | |||
36 | public: | ||
37 | TabAppLnk( const QString & file) :AppLnk(file){ }; | ||
38 | |||
39 | QString pixmapString() { return mIconFile; }; | ||
40 | |||
41 | }; | ||
42 | |||
43 | #endif | ||
44 | |||
45 | // tabapplnk.h | ||
46 | |||
diff --git a/noncore/settings/tabmanager/tablistview.h b/noncore/settings/tabmanager/tablistview.h new file mode 100644 index 0000000..545ee38 --- a/dev/null +++ b/noncore/settings/tabmanager/tablistview.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | #ifndef TABLISTVIEW_H | ||
30 | #define TABLISTVIEW_H | ||
31 | |||
32 | #include <qlistview.h> | ||
33 | #include <qcursor.h> | ||
34 | #include <qapplication.h> | ||
35 | |||
36 | class TabListView : public QListView { | ||
37 | Q_OBJECT | ||
38 | |||
39 | signals: | ||
40 | void moveItem(QListViewItem *item, QListViewItem *newFolder); | ||
41 | |||
42 | public: | ||
43 | TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL; | ||
44 | connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *))); | ||
45 | internalCursor.setShape(0); | ||
46 | }; | ||
47 | |||
48 | protected: | ||
49 | void contentsMouseReleaseEvent(QMouseEvent* ){ | ||
50 | QListViewItem *newGroup = this->currentItem(); | ||
51 | // Make sure they are both real. | ||
52 | if (currentSelectedItem == NULL || newGroup == NULL) | ||
53 | return; | ||
54 | // Make sure they are not the same | ||
55 | if(this->isSelected(currentSelectedItem) == true) | ||
56 | return; | ||
57 | |||
58 | // Ok we have two valid items. | ||
59 | if(newGroup->parent()) | ||
60 | newGroup = newGroup->parent(); | ||
61 | |||
62 | // Just in case the parent was null | ||
63 | if(newGroup == NULL) | ||
64 | return; | ||
65 | |||
66 | // If the new folder and buddies current parent are the same don't do anything. | ||
67 | if (newGroup != currentSelectedItem->parent()) | ||
68 | moveItem(currentSelectedItem, newGroup); | ||
69 | currentSelectedItem = NULL; | ||
70 | qApp->restoreOverrideCursor(); | ||
71 | }; | ||
72 | |||
73 | private slots: | ||
74 | void itemPressed(QListViewItem *item){ | ||
75 | if(item == NULL || !item->parent()){ | ||
76 | if(item == NULL) | ||
77 | qDebug("Item is NULL"); | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | currentSelectedItem = item; | ||
82 | internalCursor.setShape(13); | ||
83 | qApp->setOverrideCursor(internalCursor); | ||
84 | }; | ||
85 | |||
86 | |||
87 | private: | ||
88 | QListViewItem *currentSelectedItem; | ||
89 | QCursor internalCursor; | ||
90 | }; | ||
91 | |||
92 | #endif | ||
93 | |||
diff --git a/noncore/settings/tabmanager/tabmainwindow.h b/noncore/settings/tabmanager/tabmainwindow.h new file mode 100644 index 0000000..2116f5a --- a/dev/null +++ b/noncore/settings/tabmanager/tabmainwindow.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | #ifndef TABMAINWINDOW_H | ||
30 | #define TABMAINWINDOW_H | ||
31 | |||
32 | #include "tabmanager.h" | ||
33 | #include <qmainwindow.h> | ||
34 | #include <qtoolbar.h> | ||
35 | #include <qtoolbutton.h> | ||
36 | #include <qpe/resource.h> | ||
37 | |||
38 | class TabMainWindow : public QMainWindow { | ||
39 | |||
40 | public: | ||
41 | TabMainWindow( QWidget* parent = 0, const char* name = 0) : QMainWindow(parent, name){ | ||
42 | tabManager = new TabManager(this, "TabManger"); | ||
43 | setCaption("Tab Manager"); | ||
44 | this->setCentralWidget(tabManager); | ||
45 | QToolBar *newToolBar = new QToolBar("toolbar", this); | ||
46 | |||
47 | // Insert all of the buttons. | ||
48 | QToolButton *newFolder = new QToolButton(Resource::loadPixmap("fileopen"), "New Folder", 0, tabManager, SLOT(newFolder()), newToolBar); | ||
49 | QToolButton *newFile = new QToolButton(Resource::loadPixmap("new"), "New Folder", 0, tabManager, SLOT(newApplication()), newToolBar); | ||
50 | QToolButton *editItem = new QToolButton(Resource::loadPixmap("edit"), "Edit", 0, tabManager, SLOT(editCurrentItem()), newToolBar); | ||
51 | QToolButton *deleteItem = new QToolButton(Resource::loadPixmap("reset"), "Deelete", 0, tabManager, SLOT(removeItem()), newToolBar); | ||
52 | |||
53 | }; | ||
54 | |||
55 | protected: | ||
56 | TabManager *tabManager; | ||
57 | |||
58 | }; | ||
59 | |||
60 | #endif | ||
61 | |||
62 | // tabmainwindow.h | ||
63 | |||
diff --git a/noncore/settings/tabmanager/tabmanager.control b/noncore/settings/tabmanager/tabmanager.control new file mode 100644 index 0000000..51dd93c --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanager.control | |||
@@ -0,0 +1,9 @@ | |||
1 | File: bin/tabmanager apps/Settings/tabmanager.desktop pics/tabmanager/tabmanager.png | ||
2 | Package: tabmanager | ||
3 | Priority: optional | ||
4 | Version: 1.0 | ||
5 | Architecture: arm | ||
6 | Maintainer: Benjamin Meyer <meyerb@sharpsec.com> | ||
7 | Section: Settings | ||
8 | Description: Tab Manager | ||
9 | Helps to manage the Applications tab | ||
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp new file mode 100644 index 0000000..db65d26 --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -0,0 +1,473 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
30 | #include "tabmanager.h" | ||
31 | #include "app.h" | ||
32 | #include "tabapplnk.h" | ||
33 | |||
34 | #include <qpe/applnk.h> | ||
35 | #include <qpe/qpeapplication.h> | ||
36 | #include <qdir.h> | ||
37 | #include <qfile.h> | ||
38 | #include <qtextstream.h> | ||
39 | #include <qlistview.h> | ||
40 | #include <qheader.h> | ||
41 | #include <qlineedit.h> | ||
42 | #include <qlabel.h> | ||
43 | #include <qmessagebox.h> | ||
44 | #include <stdlib.h> | ||
45 | #include <qpe/qcopenvelope_qws.h> | ||
46 | |||
47 | #define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" // <-- made this a little more flexible | ||
48 | #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" | ||
49 | #define NEW_FOLDER "EmptyTab" | ||
50 | #define NEW_APPLICATION "NewApp" | ||
51 | #define APPLICATION_EXTENSION ".desktop" | ||
52 | #define APPLICATION_EXTENSION_LENGTH 8 | ||
53 | |||
54 | /** | ||
55 | * Constructor. Sets up signals. Performs initial scan of applications | ||
56 | * and tabs | ||
57 | */ | ||
58 | TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false){ | ||
59 | rescanFolder(HOME_APP_DIR); | ||
60 | |||
61 | // Connect the signals and slots | ||
62 | connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*))); | ||
63 | (tabList->header())->hide(); | ||
64 | connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *))); | ||
65 | } | ||
66 | |||
67 | /** | ||
68 | * If anything in the tab's have been changed then update the system or alert | ||
69 | * the user. | ||
70 | */ | ||
71 | TabManager::~TabManager(){ | ||
72 | if(changed){ | ||
73 | //QMessageBox::critical(this, "Message", "Please restart Qtopia to see all new changes.",QString("Ok") ); | ||
74 | //filename = fn; | ||
75 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
76 | //e << description << filename << mimetype; | ||
77 | QString link; //we'll just send an empty string | ||
78 | e << link; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Scans root directory for any tabs or applications. Will recursivly go down, | ||
84 | * but will not follow symlinks. | ||
85 | * @param directory - the directory to look in. | ||
86 | * @param parent - the parent to place any new tabs or apps into. If parent is | ||
87 | * NULL then the item is a tab and should be placed as a child of the window. | ||
88 | */ | ||
89 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | ||
90 | //qDebug(QString("rescanFolder: ") + directory.latin1()); | ||
91 | |||
92 | QDir d; | ||
93 | d.setPath(directory); | ||
94 | // Show hidden files for .directories | ||
95 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | ||
96 | |||
97 | const QFileInfoList *list = d.entryInfoList(); | ||
98 | QFileInfoListIterator it( *list ); // create list iterator | ||
99 | QFileInfo *fi; // pointer for traversing | ||
100 | |||
101 | while ( (fi=it.current()) ) { // for each file... | ||
102 | // If it is a dir and not .. or . then add it as a tab and go down. | ||
103 | if(fi->isDir()){ | ||
104 | if(fi->fileName() != ".." && fi->fileName() != ".") { | ||
105 | QListViewItem* newItem; | ||
106 | if(!parent) | ||
107 | newItem = new QListViewItem(tabList, fi->fileName()); | ||
108 | else | ||
109 | newItem = new QListViewItem(parent, fi->fileName()); | ||
110 | itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" ); | ||
111 | rescanFolder(directory + "/" + fi->fileName(), newItem); | ||
112 | } | ||
113 | } | ||
114 | else{ | ||
115 | // it is a file, if not a .directory add to parent. | ||
116 | |||
117 | // Change parents name and icon to reflect icon. | ||
118 | if(fi->fileName() == ".directory"){ | ||
119 | AppLnk app(directory + "/" + fi->fileName()); | ||
120 | if(parent){ | ||
121 | parent->setPixmap(0,app.pixmap()); | ||
122 | parent->setText(0, app.name()); | ||
123 | } | ||
124 | } | ||
125 | else{ | ||
126 | // Add any desktop files found. | ||
127 | QListViewItem* newItem; | ||
128 | if(directory != HOME_APP_DIR){ | ||
129 | if(!parent) | ||
130 | newItem = new QListViewItem(tabList, fi->fileName()); | ||
131 | else | ||
132 | newItem = new QListViewItem(parent, fi->fileName()); | ||
133 | if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){ | ||
134 | AppLnk app(directory + "/" + fi->fileName()); | ||
135 | newItem->setPixmap(0,app.pixmap()); | ||
136 | newItem->setText(0, app.name()); | ||
137 | itemList.insert(newItem, directory + "/" + fi->fileName()); | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | ++it; // goto next list element | ||
143 | } | ||
144 | } | ||
145 | |||
146 | /** | ||
147 | * Create a new blank Tab. | ||
148 | * Create a physical folder with .directory file | ||
149 | * Create a item on the list | ||
150 | */ | ||
151 | void TabManager::newFolder(){ | ||
152 | QDir r; | ||
153 | r.mkdir(QString(HOME_APP_DIR) + "/" + NEW_FOLDER); | ||
154 | system((QString("echo [Desktop Entry] | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); | ||
155 | system((QString("echo Name=" NEW_FOLDER " | cat >> ") + HOME_APP_DIR + "/" + NEW_FOLDER "/.directory").latin1()); | ||
156 | |||
157 | QString homeLocation = QString(HOME_APP_DIR) + "/" + NEW_FOLDER + "/.directory"; | ||
158 | QListViewItem *newItem = new QListViewItem(tabList, NEW_FOLDER); | ||
159 | itemList.insert(newItem, homeLocation ); | ||
160 | |||
161 | // We have changed something. | ||
162 | changed = true; | ||
163 | } | ||
164 | |||
165 | /** | ||
166 | * Create a new blank application | ||
167 | * Make sure a tab is selected | ||
168 | * create physical file | ||
169 | * fill file with default information (entry, name, type). | ||
170 | */ | ||
171 | void TabManager::newApplication(){ | ||
172 | QListViewItem *item = tabList->currentItem(); | ||
173 | if(!item || item->parent()) | ||
174 | return; | ||
175 | |||
176 | QString parentDir = itemList[item].mid(0,itemList[item].length()-11); | ||
177 | QString homeLocation = parentDir + "/" NEW_APPLICATION APPLICATION_EXTENSION; | ||
178 | system((QString("echo [Desktop Entry] | cat >> ") + homeLocation).latin1()); | ||
179 | system((QString("echo Name=" NEW_APPLICATION " | cat >> ") + homeLocation).latin1()); | ||
180 | int slash = parentDir.findRev('/', -1); | ||
181 | QString folderName = parentDir.mid(slash+1, parentDir.length()); | ||
182 | |||
183 | system((QString("echo Type=") + folderName + " | cat >> " + homeLocation).latin1()); | ||
184 | |||
185 | // Insert into the tree | ||
186 | QListViewItem *newItem = new QListViewItem(item, NEW_APPLICATION); | ||
187 | itemList.insert(newItem, homeLocation ); | ||
188 | |||
189 | // We have changed something. | ||
190 | changed = true; | ||
191 | } | ||
192 | |||
193 | /** | ||
194 | * Remove the item. | ||
195 | * Check if we can | ||
196 | * Prompt user | ||
197 | * Delete physical file (Dir, remove .dir, then dir. File, remove file) | ||
198 | * Remove from installer if need too. | ||
199 | */ | ||
200 | void TabManager::removeItem(){ | ||
201 | // Make sure we can delete | ||
202 | QListViewItem *item = tabList->currentItem(); | ||
203 | if(!item) | ||
204 | return; | ||
205 | if(item->childCount() > 0){ | ||
206 | QMessageBox::critical(this, "Message", "Can't remove with applications\nstill in the group.",QString("Ok") ); | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | // Prompt. | ||
211 | int answer = QMessageBox::warning(this, "Message", "Are you sure you want to delete?","Yes", "Cancel", 0, 1 ); | ||
212 | if (answer) | ||
213 | return; | ||
214 | |||
215 | bool removeSuccessfull = true; | ||
216 | QString location = itemList[item]; | ||
217 | // Remove file (.directory in a Directory case) | ||
218 | if(!QFile::remove(location)) | ||
219 | removeSuccessfull = false; | ||
220 | |||
221 | // Remove directory | ||
222 | if(item->parent() == NULL){ | ||
223 | // Remove .directory file string | ||
224 | location = location.mid(0,location.length()-10); | ||
225 | QDir dir; | ||
226 | if(!dir.rmdir(location)) | ||
227 | removeSuccessfull = false; | ||
228 | } | ||
229 | |||
230 | // If removing failed. | ||
231 | if(!removeSuccessfull){ | ||
232 | qDebug((QString("removeItem: ") + location).latin1()); | ||
233 | QMessageBox::critical(this, "Message", "Can't remove.",QString("Ok") ); | ||
234 | return; | ||
235 | } | ||
236 | |||
237 | // Remove from the installer so it wont fail. | ||
238 | // Don't need to do this sense the current install uses rm -f so no error | ||
239 | |||
240 | // Remove from the gui list. | ||
241 | itemList.remove(item); | ||
242 | if(item->parent()) | ||
243 | item->parent()->takeItem(item); | ||
244 | delete item; | ||
245 | |||
246 | // We have changed something. | ||
247 | changed = true; | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * Helper function. Edits the current item. | ||
252 | * calls editItem with the currently selected item. | ||
253 | */ | ||
254 | void TabManager::editCurrentItem(){ | ||
255 | editItem(tabList->currentItem()); | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * Edit the item that is passed in. | ||
260 | * Show application dialog and if anything changed | ||
261 | * @param item the item to edit. | ||
262 | */ | ||
263 | void TabManager::editItem( QListViewItem * item){ | ||
264 | if(!item) | ||
265 | return; | ||
266 | |||
267 | TabAppLnk app(itemList[item]); | ||
268 | if(!app.isValid()){ | ||
269 | qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | AppEdit application(this, "Application edit", true); | ||
274 | application.nameLineEdit->setText(app.name()); | ||
275 | application.iconLineEdit->setText(app.pixmapString()); | ||
276 | application.execLineEdit->setText(app.exec()); | ||
277 | application.commentLineEdit->setText(app.comment()); | ||
278 | |||
279 | if(item->parent() == NULL){ | ||
280 | application.execLineEdit->setEnabled(false); | ||
281 | application.TextLabel3->setEnabled(false); | ||
282 | application.setCaption("Tab"); | ||
283 | } | ||
284 | |||
285 | // Only do somthing if they hit OK | ||
286 | if(application.exec() == 0) | ||
287 | return; | ||
288 | |||
289 | // If nothing has changed exit (hmmm why did they hit ok?) | ||
290 | if(app.name() == application.nameLineEdit->text() && | ||
291 | app.pixmapString() == application.iconLineEdit->text() && | ||
292 | app.comment() == application.commentLineEdit->text() && | ||
293 | app.exec() == application.execLineEdit->text()) | ||
294 | return; | ||
295 | |||
296 | // Change the applnk file | ||
297 | QString oldName = app.name(); | ||
298 | app.setName(application.nameLineEdit->text()); | ||
299 | app.setIcon(application.iconLineEdit->text()); | ||
300 | app.setComment(application.commentLineEdit->text()); | ||
301 | app.setExec(application.execLineEdit->text()); | ||
302 | if(!app.writeLink()){ | ||
303 | QMessageBox::critical(this, "Message", "Can't save.",QString("Ok") ); | ||
304 | return; | ||
305 | } | ||
306 | |||
307 | // Update the gui icon and name | ||
308 | item->setText(0,app.name()); | ||
309 | item->setPixmap(0,app.pixmap()); | ||
310 | |||
311 | // We have changed something. | ||
312 | changed = true; | ||
313 | |||
314 | // If we were dealing with a new folder or new application change | ||
315 | // the file names. Also change the item location in itemList | ||
316 | if(oldName == NEW_FOLDER){ | ||
317 | QDir r; | ||
318 | QString oldName = itemList[item]; | ||
319 | oldName = oldName.mid(0,oldName.length()-11); | ||
320 | QString newName = oldName.mid(0,oldName.length()-9); | ||
321 | newName = newName + "/" + app.name(); | ||
322 | r.rename(oldName, newName); | ||
323 | itemList.remove(item); | ||
324 | itemList.insert(item, newName + "/.directory" ); | ||
325 | } | ||
326 | else if(oldName == NEW_APPLICATION){ | ||
327 | if(!item->parent()) | ||
328 | return; | ||
329 | QString parentDir = itemList[item->parent()]; | ||
330 | QDir r; | ||
331 | QString oldName = itemList[item]; | ||
332 | QString newName = oldName.mid(0, parentDir.length()-10); | ||
333 | newName = newName + app.name() + APPLICATION_EXTENSION; | ||
334 | r.rename(oldName, newName); | ||
335 | itemList.remove(item); | ||
336 | itemList.insert(item, newName); | ||
337 | } | ||
338 | } | ||
339 | |||
340 | /** | ||
341 | * Move an application from one directory to another. | ||
342 | * Move in the gui, move in the applnk file, move in the installer. | ||
343 | * @param item the application to move | ||
344 | * @pearam newGroup the new parent of this application | ||
345 | */ | ||
346 | void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){ | ||
347 | // Can we even move it? | ||
348 | if(!item || !item->parent() || newGroup->parent()) | ||
349 | return; | ||
350 | if(item->parent() == newGroup) | ||
351 | return; | ||
352 | |||
353 | // Get the new folder, new file name, | ||
354 | QString newFolder = itemList[newGroup]; | ||
355 | newFolder = newFolder.mid(0,newFolder.length()-11); | ||
356 | int slash = newFolder.findRev('/', -1); | ||
357 | QString folderName = newFolder.mid(slash+1, newFolder.length()); | ||
358 | |||
359 | QString desktopFile = itemList[item]; | ||
360 | slash = desktopFile.findRev('/', -1); | ||
361 | desktopFile = desktopFile.mid(slash, desktopFile.length()); | ||
362 | newFolder = newFolder + desktopFile; | ||
363 | |||
364 | // Move file | ||
365 | QDir r; | ||
366 | if(!r.rename(itemList[item], newFolder)){ | ||
367 | QMessageBox::critical(this, "Message", "Can't move application.",QString("Ok") ); | ||
368 | return; | ||
369 | } | ||
370 | //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); | ||
371 | //qDebug((QString("moveApplication: ") + newFolder).latin1()); | ||
372 | |||
373 | // Move in the gui | ||
374 | item->parent()->takeItem(item); | ||
375 | newGroup->insertItem(item); | ||
376 | newGroup->setOpen(true); | ||
377 | |||
378 | // Move file in the installer | ||
379 | QString installedAppFile; | ||
380 | if(findInstalledApplication(desktopFile, installedAppFile)) | ||
381 | swapInstalledLocation(installedAppFile, desktopFile, newFolder); | ||
382 | else | ||
383 | qDebug("moveApplication: No installed app found for dekstop file"); | ||
384 | |||
385 | // Move application type | ||
386 | AppLnk app(newFolder); | ||
387 | app.setType(folderName); | ||
388 | app.writeLink(); | ||
389 | |||
390 | // Move in our internal list | ||
391 | itemList.remove(item); | ||
392 | itemList.insert(item, newFolder); | ||
393 | |||
394 | // We have changed something. | ||
395 | changed = true; | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * File the installed application that has this desktop file. | ||
400 | * Go through each file in HOME_APP_INSTALL_DIR and see if it contains desktop | ||
401 | * file | ||
402 | * @param desktopFile - the .desktop file to search for [foo.desktop] | ||
403 | * @param installedAppFile - location of the app install list | ||
404 | * @return true if successfull, false if file not found. | ||
405 | */ | ||
406 | bool TabManager::findInstalledApplication(QString desktopFile, QString &installedAppFile){ | ||
407 | |||
408 | QDir d; | ||
409 | d.setPath(HOME_APP_INSTALL_DIR); | ||
410 | d.setFilter( QDir::Files ); | ||
411 | |||
412 | const QFileInfoList *list = d.entryInfoList(); | ||
413 | QFileInfoListIterator it( *list ); // create list iterator | ||
414 | QFileInfo *fi; // pointer for traversing | ||
415 | |||
416 | while ( (fi=it.current()) ) { // for each file... | ||
417 | QFile file(QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName()); | ||
418 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | ||
419 | QTextStream stream( &file ); // use a text stream | ||
420 | QString line; | ||
421 | while ( !stream.eof() ) { // until end of file... | ||
422 | line = stream.readLine(); // line of text excluding '\n' | ||
423 | if(line.contains(desktopFile)){ | ||
424 | installedAppFile = QString(HOME_APP_INSTALL_DIR) + "/" + fi->fileName(); | ||
425 | file.close(); | ||
426 | return true; | ||
427 | } | ||
428 | } | ||
429 | file.close(); | ||
430 | } | ||
431 | else | ||
432 | qDebug((QString("findInstalledApplication: Can't open file") + HOME_APP_INSTALL_DIR + "/" + fi->fileName()).latin1()); | ||
433 | ++it; // goto next list element | ||
434 | } | ||
435 | return false; | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * Open a file and replace a file containing the old desktop file with the new. | ||
440 | * @param installedAppFile application installed list | ||
441 | * @param desktopFile old .desktop file | ||
442 | * @param newLocation new .desktop file | ||
443 | */ | ||
444 | void TabManager::swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ){ | ||
445 | QFile file(installedAppFile); | ||
446 | if ( !file.open(IO_ReadOnly) ){ | ||
447 | qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); | ||
448 | return; | ||
449 | } | ||
450 | |||
451 | QTextStream stream( &file ); // use a text stream | ||
452 | QString allLines; | ||
453 | while ( !stream.eof() ) { // until end of file... | ||
454 | QString line = stream.readLine(); // line of text excluding '\n' | ||
455 | if(line.contains(desktopFile)) | ||
456 | allLines += newLocation; | ||
457 | else | ||
458 | allLines += line; | ||
459 | allLines += '\n'; | ||
460 | } | ||
461 | file.close(); | ||
462 | |||
463 | if ( !file.open(IO_ReadWrite) ){ | ||
464 | qDebug(QString("swapInstalledLocation: Can't edit file: %1").arg(installedAppFile).latin1()); | ||
465 | return; | ||
466 | } | ||
467 | QTextStream streamOut( &file ); | ||
468 | streamOut << allLines; | ||
469 | file.close(); | ||
470 | } | ||
471 | |||
472 | // tabmanager.cpp | ||
473 | |||
diff --git a/noncore/settings/tabmanager/tabmanager.h b/noncore/settings/tabmanager/tabmanager.h new file mode 100644 index 0000000..2700fe7 --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanager.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | |||
3 | =. This file is part of the OPIE Project | ||
4 | .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | #ifndef TABMANAGER_H | ||
30 | #define TABMANAGER_H | ||
31 | |||
32 | #include "tabmanagerbase.h" | ||
33 | #include <qmap.h> | ||
34 | #include <qevent.h> | ||
35 | |||
36 | class QListViewItem; | ||
37 | |||
38 | class TabManager : public TabManagerBase { | ||
39 | Q_OBJECT | ||
40 | |||
41 | public: | ||
42 | TabManager( QWidget* parent = 0, const char* name = 0); | ||
43 | ~TabManager(); | ||
44 | bool changed; | ||
45 | |||
46 | public slots: | ||
47 | void newFolder(); | ||
48 | void newApplication(); | ||
49 | void removeItem(); | ||
50 | void editCurrentItem(); | ||
51 | |||
52 | private slots: | ||
53 | void moveApplication(QListViewItem *, QListViewItem *); | ||
54 | void editItem(QListViewItem * item); | ||
55 | |||
56 | protected: | ||
57 | void rescanFolder(QString directory, QListViewItem* parent=NULL); | ||
58 | QMap<QListViewItem *, QString> itemList; | ||
59 | bool findInstalledApplication(QString desktopFile, QString &installedAppFile); | ||
60 | void swapInstalledLocation( QString installedAppFile, QString desktopFile, QString newLocation ); | ||
61 | |||
62 | }; | ||
63 | |||
64 | #endif | ||
65 | |||
66 | // tabmanager.h | ||
67 | |||
diff --git a/noncore/settings/tabmanager/tabmanager.pro b/noncore/settings/tabmanager/tabmanager.pro new file mode 100644 index 0000000..3b185dd --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanager.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE= app | ||
2 | #CONFIG = qt warn_on debug | ||
3 | CONFIG = qt warn_on release | ||
4 | HEADERS = tabmanager.h tabmainwindow.h app.h tablistview.h tabmanagerbase.h tabapplnk.h | ||
5 | SOURCES = main.cpp tabmanager.cpp app.cpp tabmanagerbase.cpp | ||
6 | INCLUDEPATH+= $(OPIEDIR)/include | ||
7 | DEPENDPATH+= $(OPIEDIR)/include | ||
8 | LIBS += -lqpe | ||
9 | #INTERFACES= tabmanagerbase.ui | ||
10 | TARGET = tabmanager | ||
11 | DESTDIR = $(OPIEDIR)/bin | ||
diff --git a/noncore/settings/tabmanager/tabmanagerbase.cpp b/noncore/settings/tabmanager/tabmanagerbase.cpp new file mode 100644 index 0000000..a899529 --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanagerbase.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'tabmanagerbase.ui' | ||
3 | ** | ||
4 | ** Created: Fri May 3 14:38:14 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "tabmanagerbase.h" | ||
10 | |||
11 | #include <qheader.h> | ||
12 | #include <qlistview.h> | ||
13 | #include <qpushbutton.h> | ||
14 | #include <qlayout.h> | ||
15 | #include <qvariant.h> | ||
16 | #include <qtooltip.h> | ||
17 | #include <qwhatsthis.h> | ||
18 | |||
19 | /* | ||
20 | * Constructs a TabManagerBase which is a child of 'parent', with the | ||
21 | * name 'name' and widget flags set to 'f' | ||
22 | */ | ||
23 | TabManagerBase::TabManagerBase( QWidget* parent, const char* name, WFlags fl ) | ||
24 | : QWidget( parent, name, fl ) | ||
25 | { | ||
26 | if ( !name ) | ||
27 | setName( "TabManagerBase" ); | ||
28 | resize( 289, 228 ); | ||
29 | setCaption( tr( "Tab Manger" ) ); | ||
30 | TabManagerBaseLayout = new QVBoxLayout( this ); | ||
31 | TabManagerBaseLayout->setSpacing( 6 ); | ||
32 | TabManagerBaseLayout->setMargin( 0 ); | ||
33 | |||
34 | tabList = new TabListView( this, "tabList" ); | ||
35 | tabList->addColumn( tr( "Groups" ) ); | ||
36 | tabList->addColumn( tr( "Applications" ) ); | ||
37 | tabList->setRootIsDecorated( TRUE ); | ||
38 | TabManagerBaseLayout->addWidget( tabList ); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * Destroys the object and frees any allocated resources | ||
43 | */ | ||
44 | TabManagerBase::~TabManagerBase() | ||
45 | { | ||
46 | // no need to delete child widgets, Qt does it all for us | ||
47 | } | ||
48 | |||
diff --git a/noncore/settings/tabmanager/tabmanagerbase.h b/noncore/settings/tabmanager/tabmanagerbase.h new file mode 100644 index 0000000..96e9254 --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanagerbase.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'tabmanagerbase.ui' | ||
3 | ** | ||
4 | ** Created: Fri May 3 14:38:09 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef TABMANAGERBASE_H | ||
10 | #define TABMANAGERBASE_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qwidget.h> | ||
14 | #include "tablistview.h" | ||
15 | class QVBoxLayout; | ||
16 | class QHBoxLayout; | ||
17 | class QGridLayout; | ||
18 | class QListView; | ||
19 | class QListViewItem; | ||
20 | |||
21 | class TabManagerBase : public QWidget | ||
22 | { | ||
23 | Q_OBJECT | ||
24 | |||
25 | public: | ||
26 | TabManagerBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
27 | ~TabManagerBase(); | ||
28 | |||
29 | TabListView* tabList; | ||
30 | |||
31 | protected: | ||
32 | QVBoxLayout* TabManagerBaseLayout; | ||
33 | }; | ||
34 | |||
35 | #endif // TABMANAGERBASE_H | ||
diff --git a/noncore/settings/tabmanager/tabmanagerbase.ui b/noncore/settings/tabmanager/tabmanagerbase.ui new file mode 100644 index 0000000..2fd10dd --- a/dev/null +++ b/noncore/settings/tabmanager/tabmanagerbase.ui | |||
@@ -0,0 +1,75 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>TabManagerBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>TabManagerBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>289</width> | ||
15 | <height>228</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Tab Manger</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <vbox> | ||
26 | <property stdset="1"> | ||
27 | <name>margin</name> | ||
28 | <number>0</number> | ||
29 | </property> | ||
30 | <property stdset="1"> | ||
31 | <name>spacing</name> | ||
32 | <number>6</number> | ||
33 | </property> | ||
34 | <widget> | ||
35 | <class>QListView</class> | ||
36 | <column> | ||
37 | <property> | ||
38 | <name>text</name> | ||
39 | <string>Groups</string> | ||
40 | </property> | ||
41 | <property> | ||
42 | <name>clickable</name> | ||
43 | <bool>true</bool> | ||
44 | </property> | ||
45 | <property> | ||
46 | <name>resizeable</name> | ||
47 | <bool>true</bool> | ||
48 | </property> | ||
49 | </column> | ||
50 | <column> | ||
51 | <property> | ||
52 | <name>text</name> | ||
53 | <string>Applications</string> | ||
54 | </property> | ||
55 | <property> | ||
56 | <name>clickable</name> | ||
57 | <bool>true</bool> | ||
58 | </property> | ||
59 | <property> | ||
60 | <name>resizeable</name> | ||
61 | <bool>true</bool> | ||
62 | </property> | ||
63 | </column> | ||
64 | <property stdset="1"> | ||
65 | <name>name</name> | ||
66 | <cstring>tabList</cstring> | ||
67 | </property> | ||
68 | <property stdset="1"> | ||
69 | <name>rootIsDecorated</name> | ||
70 | <bool>true</bool> | ||
71 | </property> | ||
72 | </widget> | ||
73 | </vbox> | ||
74 | </widget> | ||
75 | </UI> | ||