author | tille <tille> | 2002-06-29 22:44:44 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-29 22:44:44 (UTC) |
commit | eb02223de534d315bfdcb0d521719c2d2e9a7235 (patch) (side-by-side diff) | |
tree | 9b71cc4f3819ee2f9ea6ccfa760d7d0133fa2dae | |
parent | 472a178f71b7d16616b82ddf6b95123179cfffac (diff) | |
download | opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.zip opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.gz opie-eb02223de534d315bfdcb0d521719c2d2e9a7235.tar.bz2 |
saving
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/confedit/listviewitemconfigentry.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/confedit/listviewitemconfigentry.h | 3 | ||||
-rw-r--r-- | noncore/apps/confedit/mainwindow.cpp | 24 |
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 @@ -94,4 +94,11 @@ void ListViewItemConfFile::save() back.close(); - + + if (!conf.open(IO_WriteOnly)) return; + QTextStream *t = new QTextStream( &conf ); + for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) + { + ((ListViewItemConfigEntry*)it)->save(t); + } + conf.close(); qDebug("no saveing yet..."); 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 @@ -12,2 +12,3 @@ #include "listviewitemconffile.h" +#include <qtextstream.h> @@ -106,2 +107,22 @@ void ListViewItemConfigEntry::changed() _fileItem->changed(); +} + +void ListViewItemConfigEntry::save(QTextStream *t) +{ + QString s; + if (isGroup()) + { + s += "["+_group+"]"; + _type = Group; + }else{ + s += _key+" = "+_value; + _type = Key; + } + s += "\n"; + (*t) << s; + _changed = false; + for (QListViewItem *it = firstChild(); it!=0;it = it->nextSibling()) + { + ((ListViewItemConfigEntry*)it)->save(t); + } }
\ 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 @@ -18,2 +18,4 @@ +class QTextStream; + class ListViewItemConfigEntry : public ListViewItemConf { @@ -34,2 +36,3 @@ public: virtual void changed(); + void save(QTextStream*); private: 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 @@ -57,16 +57,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : - connect (settingList, SIGNAL( currentChanged(QListViewItem*) ), + connect(settingList, SIGNAL( pressed(QListViewItem*) ), this, SLOT(setCurrent(QListViewItem*))); - connect( popupTimer, SIGNAL(timeout()), - this, SLOT(showPopup()) ); - connect( this, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( stopTimer( QListViewItem* ) ) ); - - connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), - SLOT( groupChanged(const QString&) ) ); - connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), - SLOT( keyChanged(const QString&) ) ); - connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), - SLOT( valueChanged(const QString&) ) ); + connect( popupTimer, SIGNAL(timeout()), + this, SLOT(showPopup()) ); + connect( settingList, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( stopTimer( QListViewItem* ) ) ); + + connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), + SLOT( groupChanged(const QString&) ) ); + connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ), + SLOT( keyChanged(const QString&) ) ); + connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), + SLOT( valueChanged(const QString&) ) ); makeMenu(); |