summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2002-06-29 22:44:44 (UTC)
committer tille <tille>2002-06-29 22:44:44 (UTC)
commiteb02223de534d315bfdcb0d521719c2d2e9a7235 (patch) (unidiff)
tree9b71cc4f3819ee2f9ea6ccfa760d7d0133fa2dae /noncore
parent472a178f71b7d16616b82ddf6b95123179cfffac (diff)
downloadopie-eb02223de534d315bfdcb0d521719c2d2e9a7235.zip
opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.gz
opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.bz2
saving
Diffstat (limited to 'noncore') (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
@@ -92,8 +92,15 @@ void ListViewItemConfFile::save()
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
@@ -10,6 +10,7 @@
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)
@@ -104,4 +105,24 @@ void ListViewItemConfigEntry::changed()
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
@@ -16,6 +16,8 @@
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="");
@@ -32,6 +34,7 @@ public:
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;
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
@@ -55,20 +55,20 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
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