author | tille <tille> | 2003-09-03 15:49:42 (UTC) |
---|---|---|
committer | tille <tille> | 2003-09-03 15:49:42 (UTC) |
commit | 577cdc4f2ce81eaceb132af08d8ab6fe12b4eadc (patch) (unidiff) | |
tree | 56416720d3c76eb8be931fbc27a82a7a7c5c5967 | |
parent | 9bcca67b731d0cf3c10092ec31234d5d03cef5cd (diff) | |
download | opie-577cdc4f2ce81eaceb132af08d8ab6fe12b4eadc.zip opie-577cdc4f2ce81eaceb132af08d8ab6fe12b4eadc.tar.gz opie-577cdc4f2ce81eaceb132af08d8ab6fe12b4eadc.tar.bz2 |
libopie2fied
it was always a test app ;)
-rw-r--r-- | noncore/apps/confedit/confedit.pro | 14 | ||||
-rw-r--r-- | noncore/apps/confedit/listviewitemconf.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/confedit/main.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/confedit/mainwindow.cpp | 13 |
4 files changed, 27 insertions, 14 deletions
diff --git a/noncore/apps/confedit/confedit.pro b/noncore/apps/confedit/confedit.pro index f6227f7..d2629de 100644 --- a/noncore/apps/confedit/confedit.pro +++ b/noncore/apps/confedit/confedit.pro | |||
@@ -1,33 +1,43 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | CONFIG = qt warn_on debug | 4 | CONFIG = qt warn_on debug |
5 | HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h | 5 | HEADERS = mainwindow.h listviewconfdir.h listviewitemconffile.h listviewitemconfigentry.h editwidget.h listviewitemconf.h |
6 | SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp | 6 | SOURCES = main.cpp mainwindow.cpp listviewconfdir.cpp listviewitemconffile.cpp listviewitemconfigentry.cpp editwidget.cpp listviewitemconf.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/ioclude | 8 | DEPENDPATH+= $(OPIEDIR)/ioclude |
9 | LIBS += -lqpe | ||
10 | INTERFACES= | 9 | INTERFACES= |
10 | LIBS += -lopiecore2 -lopieui2 | ||
11 | TARGET = confedit | 11 | TARGET = confedit |
12 | 12 | ||
13 | TRANSLATIONS = ../../../i18n/de/confedit.ts \ | 13 | TRANSLATIONS = ../../../i18n/de/confedit.ts \ |
14 | ../../../i18n/nl/confedit.ts \ | 14 | ../../../i18n/nl/confedit.ts \ |
15 | ../../../i18n/da/confedit.ts \ | 15 | ../../../i18n/da/confedit.ts \ |
16 | ../../../i18n/xx/confedit.ts \ | 16 | ../../../i18n/xx/confedit.ts \ |
17 | ../../../i18n/en/confedit.ts \ | 17 | ../../../i18n/en/confedit.ts \ |
18 | ../../../i18n/es/confedit.ts \ | 18 | ../../../i18n/es/confedit.ts \ |
19 | ../../../i18n/fr/confedit.ts \ | 19 | ../../../i18n/fr/confedit.ts \ |
20 | ../../../i18n/hu/confedit.ts \ | 20 | ../../../i18n/hu/confedit.ts \ |
21 | ../../../i18n/ja/confedit.ts \ | 21 | ../../../i18n/ja/confedit.ts \ |
22 | ../../../i18n/ko/confedit.ts \ | 22 | ../../../i18n/ko/confedit.ts \ |
23 | ../../../i18n/no/confedit.ts \ | 23 | ../../../i18n/no/confedit.ts \ |
24 | ../../../i18n/pl/confedit.ts \ | 24 | ../../../i18n/pl/confedit.ts \ |
25 | ../../../i18n/pt/confedit.ts \ | 25 | ../../../i18n/pt/confedit.ts \ |
26 | ../../../i18n/pt_BR/confedit.ts \ | 26 | ../../../i18n/pt_BR/confedit.ts \ |
27 | ../../../i18n/sl/confedit.ts \ | 27 | ../../../i18n/sl/confedit.ts \ |
28 | ../../../i18n/zh_CN/confedit.ts \ | 28 | ../../../i18n/zh_CN/confedit.ts \ |
29 | ../../../i18n/zh_TW/confedit.ts | 29 | ../../../i18n/zh_TW/confedit.ts |
30 | 30 | ||
31 | 31 | ||
32 | !contains( platform, x11 ) { | ||
33 | |||
34 | include ( $(OPIEDIR)/include.pro ) | ||
35 | LIBS += -lqpe | ||
36 | } | ||
37 | |||
38 | contains( platform, x11 ) { | ||
39 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
40 | } | ||
41 | |||
42 | |||
32 | 43 | ||
33 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/apps/confedit/listviewitemconf.cpp b/noncore/apps/confedit/listviewitemconf.cpp index 91edca2..61bd7ea 100644 --- a/noncore/apps/confedit/listviewitemconf.cpp +++ b/noncore/apps/confedit/listviewitemconf.cpp | |||
@@ -1,51 +1,54 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | #include "listviewitemconf.h" | 10 | #include "listviewitemconf.h" |
11 | 11 | ||
12 | ListViewItemConf::ListViewItemConf(ListViewItemConf *parent) | 12 | ListViewItemConf::ListViewItemConf(ListViewItemConf *parent) |
13 | : QListViewItem(parent), _changed(false) | 13 | : QListViewItem(parent), _changed(false) |
14 | { | 14 | { |
15 | } | 15 | } |
16 | 16 | ||
17 | ListViewItemConf::ListViewItemConf(QListView *parent) | 17 | ListViewItemConf::ListViewItemConf(QListView *parent) |
18 | : QListViewItem(parent), _changed(false) | 18 | : QListViewItem(parent), _changed(false) |
19 | { | 19 | { |
20 | _type = File; | 20 | _type = File; |
21 | } | 21 | } |
22 | 22 | ||
23 | ListViewItemConf::~ListViewItemConf() | 23 | ListViewItemConf::~ListViewItemConf() |
24 | { | 24 | { |
25 | } | 25 | } |
26 | 26 | ||
27 | int ListViewItemConf::getType() | 27 | int ListViewItemConf::getType() |
28 | { | 28 | { |
29 | return _type; | 29 | return _type; |
30 | } | 30 | } |
31 | 31 | ||
32 | void ListViewItemConf::changed() | 32 | void ListViewItemConf::changed() |
33 | { | 33 | { |
34 | _changed=true; | 34 | _changed=true; |
35 | displayText(); | 35 | displayText(); |
36 | } | 36 | } |
37 | 37 | ||
38 | void ListViewItemConf::unchanged() | 38 | void ListViewItemConf::unchanged() |
39 | { | 39 | { |
40 | _changed=false; | 40 | _changed=false; |
41 | for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) | 41 | for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) |
42 | { | 42 | { |
43 | ((ListViewItemConf*)it)->unchanged(); | 43 | ((ListViewItemConf*)it)->unchanged(); |
44 | } | 44 | } |
45 | displayText(); | 45 | displayText(); |
46 | } | 46 | } |
47 | 47 | ||
48 | bool ListViewItemConf::revertable() | 48 | bool ListViewItemConf::revertable() |
49 | { | 49 | { |
50 | return _changed; | 50 | return _changed; |
51 | } \ No newline at end of file | 51 | } |
52 | |||
53 | |||
54 | |||
diff --git a/noncore/apps/confedit/main.cpp b/noncore/apps/confedit/main.cpp index 6c18adb..7e7f064 100644 --- a/noncore/apps/confedit/main.cpp +++ b/noncore/apps/confedit/main.cpp | |||
@@ -1,14 +1,13 @@ | |||
1 | 1 | ||
2 | #include "mainwindow.h" | 2 | #include "mainwindow.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | #include <opie2/oapplication.h> |
5 | 5 | ||
6 | int main( int argc, char ** argv ) | 6 | int main( int argc, char ** argv ) |
7 | { | 7 | { |
8 | 8 | OApplication a( argc, argv, "confedit" ); | |
9 | QPEApplication a( argc, argv ); | ||
10 | MainWindow mw; | 9 | MainWindow mw; |
11 | mw.showMaximized(); | 10 | mw.showMaximized(); |
12 | a.showMainDocumentWidget( &mw ); | 11 | a.showMainDocumentWidget( &mw ); |
13 | return a.exec(); | 12 | return a.exec(); |
14 | } | 13 | } |
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index 8e36980..58538af 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp | |||
@@ -1,158 +1,159 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
11 | 11 | ||
12 | 12 | ||
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | 14 | ||
15 | #include <qpe/qpemenubar.h> | 15 | #include <opie2/omenubar.h> |
16 | #include <qpe/qpemessagebox.h> | 16 | #include <opie2/omessagebox.h> |
17 | #include <qpe/resource.h> | 17 | #include <opie2/oresource.h> |
18 | #include <qpe/config.h> | 18 | #include <opie2/oconfig.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <opie2/otoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <opie2/oapplication.h> |
21 | #include <qaction.h> | 21 | #include <qaction.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qcursor.h> | ||
31 | 32 | ||
32 | #include "listviewconfdir.h" | 33 | #include "listviewconfdir.h" |
33 | #include "listviewitemconf.h" | 34 | #include "listviewitemconf.h" |
34 | #include "listviewitemconfigentry.h" | 35 | #include "listviewitemconfigentry.h" |
35 | 36 | ||
36 | 37 | ||
37 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 38 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
38 | QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) | 39 | QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) |
39 | { | 40 | { |
40 | setCaption( tr("Conf File Editor") ); | 41 | setCaption( tr("Conf File Editor") ); |
41 | 42 | ||
42 | //setBaseSize( qApp->globalStrut() ); | 43 | //setBaseSize( qApp->globalStrut() ); |
43 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); | 44 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
44 | 45 | ||
45 | mainLayout = new QVBoxLayout( this ); | 46 | mainLayout = new QVBoxLayout( this ); |
46 | mainLayout->setSpacing( 0 ); | 47 | mainLayout->setSpacing( 0 ); |
47 | mainLayout->setMargin( 0 ); | 48 | mainLayout->setMargin( 0 ); |
48 | 49 | ||
49 | 50 | ||
50 | qDebug("creating settingList"); | 51 | qDebug("creating settingList"); |
51 | settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); | 52 | settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist"); |
52 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); | 53 | settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); |
53 | mainLayout->addWidget( settingList, 0); | 54 | mainLayout->addWidget( settingList, 0); |
54 | 55 | ||
55 | qDebug("creating editor"); | 56 | qDebug("creating editor"); |
56 | editor = new EditWidget(this); | 57 | editor = new EditWidget(this); |
57 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); | 58 | editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); |
58 | mainLayout->addWidget( editor, 1 ); | 59 | mainLayout->addWidget( editor, 1 ); |
59 | editor->layoutType( ListViewItemConf::File ); | 60 | editor->layoutType( ListViewItemConf::File ); |
60 | 61 | ||
61 | makeMenu(); | 62 | makeMenu(); |
62 | 63 | ||
63 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), | 64 | connect(settingList, SIGNAL( pressed(QListViewItem*) ), |
64 | this, SLOT(setCurrent(QListViewItem*))); | 65 | this, SLOT(setCurrent(QListViewItem*))); |
65 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), | 66 | connect( settingList, SIGNAL( clicked( QListViewItem* ) ), |
66 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 67 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
67 | 68 | ||
68 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), | 69 | connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), |
69 | SLOT( groupChanged(const QString&) ) ); | 70 | SLOT( groupChanged(const QString&) ) ); |
70 | connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), | 71 | connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), |
71 | SLOT( keyChanged(const QString&) ) ); | 72 | SLOT( keyChanged(const QString&) ) ); |
72 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), | 73 | connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), |
73 | SLOT( valueChanged(const QString&) ) ); | 74 | SLOT( valueChanged(const QString&) ) ); |
74 | 75 | ||
75 | setCurrent(0); | 76 | setCurrent(0); |
76 | editor->layoutType(EditWidget::File); | 77 | editor->layoutType(EditWidget::File); |
77 | } | 78 | } |
78 | 79 | ||
79 | void MainWindow::makeMenu() | 80 | void MainWindow::makeMenu() |
80 | { | 81 | { |
81 | popupTimer = new QTimer(this); | 82 | popupTimer = new QTimer(this); |
82 | popupMenuFile = new QPopupMenu(this); | 83 | popupMenuFile = new QPopupMenu(this); |
83 | popupMenuEntry = new QPopupMenu(this); | 84 | popupMenuEntry = new QPopupMenu(this); |
84 | 85 | ||
85 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); | 86 | popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); |
86 | popupActionSave->addTo( popupMenuFile ); | 87 | popupActionSave->addTo( popupMenuFile ); |
87 | // popupActionSave->addTo( popupMenuEntry ); | 88 | // popupActionSave->addTo( popupMenuEntry ); |
88 | connect( popupActionSave, SIGNAL( activated() ), | 89 | connect( popupActionSave, SIGNAL( activated() ), |
89 | this , SLOT( saveConfFile() ) ); | 90 | this , SLOT( saveConfFile() ) ); |
90 | 91 | ||
91 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); | 92 | popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); |
92 | popupActionRevert->addTo( popupMenuFile ); | 93 | popupActionRevert->addTo( popupMenuFile ); |
93 | popupActionRevert->addTo( popupMenuEntry ); | 94 | popupActionRevert->addTo( popupMenuEntry ); |
94 | connect( popupActionRevert, SIGNAL( activated() ), | 95 | connect( popupActionRevert, SIGNAL( activated() ), |
95 | this , SLOT( revertConfFile() ) ); | 96 | this , SLOT( revertConfFile() ) ); |
96 | 97 | ||
97 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); | 98 | popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); |
98 | popupActionDelete->addTo( popupMenuFile ); | 99 | popupActionDelete->addTo( popupMenuFile ); |
99 | popupActionDelete->addTo( popupMenuEntry ); | 100 | popupActionDelete->addTo( popupMenuEntry ); |
100 | connect( popupActionDelete, SIGNAL( activated() ), | 101 | connect( popupActionDelete, SIGNAL( activated() ), |
101 | this , SLOT( removeConfFile() ) ); | 102 | this , SLOT( removeConfFile() ) ); |
102 | 103 | ||
103 | connect( popupTimer, SIGNAL(timeout()), | 104 | connect( popupTimer, SIGNAL(timeout()), |
104 | this, SLOT(showPopup()) ); | 105 | this, SLOT(showPopup()) ); |
105 | } | 106 | } |
106 | 107 | ||
107 | MainWindow::~MainWindow() | 108 | MainWindow::~MainWindow() |
108 | { | 109 | { |
109 | } | 110 | } |
110 | 111 | ||
111 | 112 | ||
112 | 113 | ||
113 | void MainWindow::setCurrent(QListViewItem *item) | 114 | void MainWindow::setCurrent(QListViewItem *item) |
114 | { | 115 | { |
115 | //qDebug("MainWindow::setCurrent"); | 116 | //qDebug("MainWindow::setCurrent"); |
116 | if (!item) return; | 117 | if (!item) return; |
117 | _item = (ListViewItemConf*) item; | 118 | _item = (ListViewItemConf*) item; |
118 | if (!_item) return; | 119 | if (!_item) return; |
119 | popupTimer->start( 750, true ); | 120 | popupTimer->start( 750, true ); |
120 | if (_item->getType() == ListViewItemConf::File) | 121 | if (_item->getType() == ListViewItemConf::File) |
121 | { | 122 | { |
122 | editor->layoutType(EditWidget::File); | 123 | editor->layoutType(EditWidget::File); |
123 | _currentItem=0; | 124 | _currentItem=0; |
124 | _fileItem = (ListViewItemConfFile*)item; | 125 | _fileItem = (ListViewItemConfFile*)item; |
125 | return; | 126 | return; |
126 | } | 127 | } |
127 | _fileItem = 0; | 128 | _fileItem = 0; |
128 | _currentItem = (ListViewItemConfigEntry*)item; | 129 | _currentItem = (ListViewItemConfigEntry*)item; |
129 | if (!_currentItem) return; | 130 | if (!_currentItem) return; |
130 | QString file = _currentItem->getFile(); | 131 | QString file = _currentItem->getFile(); |
131 | QString group = _currentItem->getGroup(); | 132 | QString group = _currentItem->getGroup(); |
132 | QString key = _currentItem->getKey(); | 133 | QString key = _currentItem->getKey(); |
133 | QString val = _currentItem->getValue(); | 134 | QString val = _currentItem->getValue(); |
134 | editor->TextFileName->setText(file); | 135 | editor->TextFileName->setText(file); |
135 | editor->LineEditGroup->setText(group); | 136 | editor->LineEditGroup->setText(group); |
136 | if (!key.isEmpty()) | 137 | if (!key.isEmpty()) |
137 | { | 138 | { |
138 | editor->layoutType(EditWidget::Entry); | 139 | editor->layoutType(EditWidget::Entry); |
139 | editor->LineEditKey->setText(key); | 140 | editor->LineEditKey->setText(key); |
140 | editor->LineEditValue->setText(val); | 141 | editor->LineEditValue->setText(val); |
141 | }else{ | 142 | }else{ |
142 | editor->layoutType(EditWidget::Group); | 143 | editor->layoutType(EditWidget::Group); |
143 | } | 144 | } |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
147 | void MainWindow::groupChanged(const QString &g) | 148 | void MainWindow::groupChanged(const QString &g) |
148 | { | 149 | { |
149 | if (!_currentItem) return; | 150 | if (!_currentItem) return; |
150 | _currentItem->setGroup(g); | 151 | _currentItem->setGroup(g); |
151 | } | 152 | } |
152 | 153 | ||
153 | void MainWindow::keyChanged(const QString &k) | 154 | void MainWindow::keyChanged(const QString &k) |
154 | { | 155 | { |
155 | if (!_currentItem) return; | 156 | if (!_currentItem) return; |
156 | _currentItem->keyChanged(k); | 157 | _currentItem->keyChanged(k); |
157 | } | 158 | } |
158 | 159 | ||