summaryrefslogtreecommitdiff
authortille <tille>2002-06-29 22:44:44 (UTC)
committer tille <tille>2002-06-29 22:44:44 (UTC)
commiteb02223de534d315bfdcb0d521719c2d2e9a7235 (patch) (unidiff)
tree9b71cc4f3819ee2f9ea6ccfa760d7d0133fa2dae
parent472a178f71b7d16616b82ddf6b95123179cfffac (diff)
downloadopie-eb02223de534d315bfdcb0d521719c2d2e9a7235.zip
opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.gz
opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.bz2
saving
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp9
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.cpp21
-rw-r--r--noncore/apps/confedit/listviewitemconfigentry.h3
-rw-r--r--noncore/apps/confedit/mainwindow.cpp24
4 files changed, 44 insertions, 13 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index a8fd770..858726d 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -89,11 +89,18 @@ void ListViewItemConfFile::save()
89 89
90 #define SIZE 124 90 #define SIZE 124
91 char buf[SIZE]; 91 char buf[SIZE];
92 while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c); 92 while (int c = conf.readBlock(buf, SIZE) ) back.writeBlock(buf,c);
93 conf.close(); 93 conf.close();
94 back.close(); 94 back.close();
95
96 95
96
97 if (!conf.open(IO_WriteOnly)) return;
98 QTextStream *t = new QTextStream( &conf );
99 for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling())
100 {
101 ((ListViewItemConfigEntry*)it)->save(t);
102 }
103 conf.close();
97 qDebug("no saveing yet..."); 104 qDebug("no saveing yet...");
98 unchanged(); 105 unchanged();
99} 106}
diff --git a/noncore/apps/confedit/listviewitemconfigentry.cpp b/noncore/apps/confedit/listviewitemconfigentry.cpp
index 16be46e..77ce17d 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.cpp
+++ b/noncore/apps/confedit/listviewitemconfigentry.cpp
@@ -7,12 +7,13 @@
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> 9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
10 10
11#include "listviewitemconfigentry.h" 11#include "listviewitemconfigentry.h"
12#include "listviewitemconffile.h" 12#include "listviewitemconffile.h"
13#include <qtextstream.h>
13 14
14ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key) 15ListViewItemConfigEntry::ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key)
15 : ListViewItemConf(parent) 16 : ListViewItemConf(parent)
16{ 17{
17 _fileItem = parent; 18 _fileItem = parent;
18 _file = parent->fileName(); 19 _file = parent->fileName();
@@ -101,7 +102,27 @@ void ListViewItemConfigEntry::displayText()
101 102
102void ListViewItemConfigEntry::changed() 103void ListViewItemConfigEntry::changed()
103{ 104{
104 _changed=true; 105 _changed=true;
105 displayText(); 106 displayText();
106 _fileItem->changed(); 107 _fileItem->changed();
108}
109
110void ListViewItemConfigEntry::save(QTextStream *t)
111{
112 QString s;
113 if (isGroup())
114 {
115 s += "["+_group+"]";
116 _type = Group;
117 }else{
118 s += _key+" = "+_value;
119 _type = Key;
120 }
121 s += "\n";
122 (*t) << s;
123 _changed = false;
124 for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling())
125 {
126 ((ListViewItemConfigEntry*)it)->save(t);
127 }
107} \ No newline at end of file 128} \ No newline at end of file
diff --git a/noncore/apps/confedit/listviewitemconfigentry.h b/noncore/apps/confedit/listviewitemconfigentry.h
index d2b331f..1ff0491 100644
--- a/noncore/apps/confedit/listviewitemconfigentry.h
+++ b/noncore/apps/confedit/listviewitemconfigentry.h
@@ -13,12 +13,14 @@
13 13
14#include <qwidget.h> 14#include <qwidget.h>
15#include <qlistview.h> 15#include <qlistview.h>
16#include "listviewitemconffile.h" 16#include "listviewitemconffile.h"
17#include "listviewitemconf.h" 17#include "listviewitemconf.h"
18 18
19class QTextStream;
20
19class ListViewItemConfigEntry : public ListViewItemConf { 21class ListViewItemConfigEntry : public ListViewItemConf {
20public: 22public:
21 ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key=""); 23 ListViewItemConfigEntry(ListViewItemConfFile *parent, QString group, QString key="");
22 ~ListViewItemConfigEntry(); 24 ~ListViewItemConfigEntry();
23 bool isGroup(); 25 bool isGroup();
24 bool isKey(); 26 bool isKey();
@@ -29,12 +31,13 @@ public:
29 QString getKey(); 31 QString getKey();
30 QString getValue(); 32 QString getValue();
31 void keyChanged(QString); 33 void keyChanged(QString);
32 void valueChanged(QString); 34 void valueChanged(QString);
33 virtual void displayText(); 35 virtual void displayText();
34 virtual void changed(); 36 virtual void changed();
37 void save(QTextStream*);
35private: 38private:
36 QString _file; 39 QString _file;
37 QString _group; 40 QString _group;
38 QString _key; 41 QString _key;
39 QString _value; 42 QString _value;
40 ListViewItemConfFile *_fileItem; 43 ListViewItemConfFile *_fileItem;
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 30dfdf7..47d9518 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -52,26 +52,26 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
52 settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist"); 52 settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist");
53 mainLayout->addWidget( settingList, 0, 0 ); 53 mainLayout->addWidget( settingList, 0, 0 );
54 54
55 editor = new EditWidget(this); 55 editor = new EditWidget(this);
56 mainLayout->addWidget( editor, 1, 0 ); 56 mainLayout->addWidget( editor, 1, 0 );
57 57
58 connect (settingList, SIGNAL( currentChanged(QListViewItem*) ), 58 connect(settingList, SIGNAL( pressed(QListViewItem*) ),
59 this, SLOT(setCurrent(QListViewItem*))); 59 this, SLOT(setCurrent(QListViewItem*)));
60 60
61 connect( popupTimer, SIGNAL(timeout()), 61 connect( popupTimer, SIGNAL(timeout()),
62 this, SLOT(showPopup()) ); 62 this, SLOT(showPopup()) );
63 connect( this, SIGNAL( clicked( QListViewItem* ) ), 63 connect( settingList, SIGNAL( clicked( QListViewItem* ) ),
64 this, SLOT( stopTimer( QListViewItem* ) ) ); 64 this, SLOT( stopTimer( QListViewItem* ) ) );
65 65
66 connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), 66 connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ),
67 SLOT( groupChanged(const QString&) ) ); 67 SLOT( groupChanged(const QString&) ) );
68 connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), 68 connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ),
69 SLOT( keyChanged(const QString&) ) ); 69 SLOT( keyChanged(const QString&) ) );
70 connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), 70 connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ),
71 SLOT( valueChanged(const QString&) ) ); 71 SLOT( valueChanged(const QString&) ) );
72 makeMenu(); 72 makeMenu();
73} 73}
74 74
75void MainWindow::makeMenu() 75void MainWindow::makeMenu()
76{ 76{
77 77