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
@@ -1,99 +1,106 @@
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// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10 10
11#include "listviewitemconffile.h" 11#include "listviewitemconffile.h"
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qtextstream.h> 13#include <qtextstream.h>
14#include <qstring.h> 14#include <qstring.h>
15#include "listviewitemconfigentry.h" 15#include "listviewitemconfigentry.h"
16 16
17#define tr QObject::tr 17#define tr QObject::tr
18 18
19ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) 19ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent)
20 : ListViewItemConf(parent), _valid(false) 20 : ListViewItemConf(parent), _valid(false)
21{ 21{
22 confFileInfo = file; 22 confFileInfo = file;
23 parseFile(); 23 parseFile();
24 displayText(); 24 displayText();
25} 25}
26 26
27ListViewItemConfFile::~ListViewItemConfFile() 27ListViewItemConfFile::~ListViewItemConfFile()
28{ 28{
29} 29}
30 30
31 31
32void ListViewItemConfFile::displayText() 32void ListViewItemConfFile::displayText()
33{ 33{
34 setText(0,(_changed?"*":"")+confFileInfo->fileName()); 34 setText(0,(_changed?"*":"")+confFileInfo->fileName());
35} 35}
36 36
37QString ListViewItemConfFile::fileName() 37QString ListViewItemConfFile::fileName()
38{ 38{
39 return confFileInfo->fileName(); 39 return confFileInfo->fileName();
40} 40}
41 41
42void ListViewItemConfFile::parseFile() 42void ListViewItemConfFile::parseFile()
43{ 43{
44 QFile confFile(confFileInfo->absFilePath()); 44 QFile confFile(confFileInfo->absFilePath());
45 if(! confFile.open(IO_ReadOnly)) 45 if(! confFile.open(IO_ReadOnly))
46 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); 46 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0);
47 QTextStream t( &confFile ); 47 QTextStream t( &confFile );
48 QString s; 48 QString s;
49 QString group; 49 QString group;
50 ListViewItemConfigEntry *groupItem; 50 ListViewItemConfigEntry *groupItem;
51 ListViewItemConfigEntry *item; 51 ListViewItemConfigEntry *item;
52 while ( !t.atEnd() ) 52 while ( !t.atEnd() )
53 { 53 {
54 s = t.readLine().stripWhiteSpace(); 54 s = t.readLine().stripWhiteSpace();
55 //qDebug( "line: >%s<\n", s.latin1() ); 55 //qDebug( "line: >%s<\n", s.latin1() );
56 if (s.contains("<?xml")) 56 if (s.contains("<?xml"))
57 { 57 {
58 _valid = false; 58 _valid = false;
59 break; 59 break;
60 }else 60 }else
61 if ( s[0] == '[' && s[s.length()-1] == ']' ) 61 if ( s[0] == '[' && s[s.length()-1] == ']' )
62 { 62 {
63 // qDebug("got group"+s); 63 // qDebug("got group"+s);
64 group = s.mid(1,s.length()-2); 64 group = s.mid(1,s.length()-2);
65 groupItem = new ListViewItemConfigEntry(this, group ); 65 groupItem = new ListViewItemConfigEntry(this, group );
66 insertItem( groupItem ); 66 insertItem( groupItem );
67 } else 67 } else
68 if ( int pos = s.find('=') ) 68 if ( int pos = s.find('=') )
69 { 69 {
70 // qDebug("got key"+s); 70 // qDebug("got key"+s);
71 item = new ListViewItemConfigEntry(this, group, s ); 71 item = new ListViewItemConfigEntry(this, group, s );
72 groupItem->insertItem( item ); 72 groupItem->insertItem( item );
73 } 73 }
74 } 74 }
75 confFile.close(); 75 confFile.close();
76 setExpandable( _valid ); 76 setExpandable( _valid );
77} 77}
78 78
79void ListViewItemConfFile::save() 79void ListViewItemConfFile::save()
80{ 80{
81 if (!_changed) return; 81 if (!_changed) return;
82 QString backup = confFileInfo->absFilePath()+"~"; 82 QString backup = confFileInfo->absFilePath()+"~";
83 qDebug("make backup to "+backup); 83 qDebug("make backup to "+backup);
84 QFile conf(confFileInfo->absFilePath()); 84 QFile conf(confFileInfo->absFilePath());
85 QFile back(backup); 85 QFile back(backup);
86 86
87 if (!conf.open(IO_ReadOnly)) return; 87 if (!conf.open(IO_ReadOnly)) return;
88 if (!back.open(IO_WriteOnly)) return; 88 if (!back.open(IO_WriteOnly)) return;
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
@@ -1,107 +1,128 @@
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 // (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();
19 _group = group; 20 _group = group;
20 setKey(key); 21 setKey(key);
21 _fileItem->unchanged(); 22 _fileItem->unchanged();
22} 23}
23 24
24ListViewItemConfigEntry::~ListViewItemConfigEntry() 25ListViewItemConfigEntry::~ListViewItemConfigEntry()
25{ 26{
26} 27}
27 28
28bool ListViewItemConfigEntry::isGroup() 29bool ListViewItemConfigEntry::isGroup()
29{ 30{
30 return _key.isEmpty(); 31 return _key.isEmpty();
31} 32}
32 33
33bool ListViewItemConfigEntry::isKey() 34bool ListViewItemConfigEntry::isKey()
34{ 35{
35 return !_key.isEmpty(); 36 return !_key.isEmpty();
36} 37}
37 38
38QString ListViewItemConfigEntry::getFile() 39QString ListViewItemConfigEntry::getFile()
39{ 40{
40 return _file; 41 return _file;
41} 42}
42 43
43void ListViewItemConfigEntry::setGroup(QString g) 44void ListViewItemConfigEntry::setGroup(QString g)
44{ 45{
45 if (g==_group) return; 46 if (g==_group) return;
46 _group = g; 47 _group = g;
47 changed(); 48 changed();
48} 49}
49 50
50QString ListViewItemConfigEntry::getGroup() 51QString ListViewItemConfigEntry::getGroup()
51{ 52{
52 return _group; 53 return _group;
53} 54}
54 55
55void ListViewItemConfigEntry::setKey(QString key) 56void ListViewItemConfigEntry::setKey(QString key)
56{ 57{
57 int pos = key.find("="); 58 int pos = key.find("=");
58 _key = key.left(pos).stripWhiteSpace(); 59 _key = key.left(pos).stripWhiteSpace();
59 _value = key.right(key.length() - pos - 1).stripWhiteSpace(); 60 _value = key.right(key.length() - pos - 1).stripWhiteSpace();
60 displayText(); 61 displayText();
61} 62}
62 63
63QString ListViewItemConfigEntry::getKey() 64QString ListViewItemConfigEntry::getKey()
64{ 65{
65 return _key; 66 return _key;
66} 67}
67 68
68QString ListViewItemConfigEntry::getValue() 69QString ListViewItemConfigEntry::getValue()
69{ 70{
70 return _value; 71 return _value;
71} 72}
72 73
73void ListViewItemConfigEntry::keyChanged(QString k) 74void ListViewItemConfigEntry::keyChanged(QString k)
74{ 75{
75 if (k==_key) return; 76 if (k==_key) return;
76 _key = k; 77 _key = k;
77 changed(); 78 changed();
78} 79}
79 80
80void ListViewItemConfigEntry::valueChanged(QString v) 81void ListViewItemConfigEntry::valueChanged(QString v)
81{ 82{
82 if (v==_value) return; 83 if (v==_value) return;
83 _value = v; 84 _value = v;
84 changed(); 85 changed();
85} 86}
86 87
87void ListViewItemConfigEntry::displayText() 88void ListViewItemConfigEntry::displayText()
88{ 89{
89 QString s; 90 QString s;
90 if (_changed) s="*"; 91 if (_changed) s="*";
91 if (isGroup()) 92 if (isGroup())
92 { 93 {
93 s += "["+_group+"]"; 94 s += "["+_group+"]";
94 _type = Group; 95 _type = Group;
95 }else{ 96 }else{
96 s += _key+" = "+_value; 97 s += _key+" = "+_value;
97 _type = Key; 98 _type = Key;
98 } 99 }
99 setText(0,s); 100 setText(0,s);
100} 101}
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
@@ -1,43 +1,46 @@
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 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> 9 // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
10 10
11#ifndef LISTVIEWITEMCONFIGENTRY_H 11#ifndef LISTVIEWITEMCONFIGENTRY_H
12#define LISTVIEWITEMCONFIGENTRY_H 12#define LISTVIEWITEMCONFIGENTRY_H
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();
25 QString getFile(); 27 QString getFile();
26 void setGroup(QString); 28 void setGroup(QString);
27 QString getGroup(); 29 QString getGroup();
28 void setKey(QString); 30 void setKey(QString);
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;
41}; 44};
42 45
43#endif 46#endif
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
@@ -1,168 +1,168 @@
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 <qpe/qpemenubar.h>
16#include <qpe/qpemessagebox.h> 16#include <qpe/qpemessagebox.h>
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qpe/qpetoolbar.h> 19#include <qpe/qpetoolbar.h>
20#include <qaction.h> 20#include <qaction.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qpopupmenu.h> 22#include <qpopupmenu.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qfile.h> 26#include <qfile.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30 30
31#include "listviewconfdir.h" 31#include "listviewconfdir.h"
32#include "listviewitemconf.h" 32#include "listviewitemconf.h"
33#include "listviewitemconfigentry.h" 33#include "listviewitemconfigentry.h"
34 34
35 35
36MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 36MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
37 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) 37 QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
38 { 38 {
39 setCaption( tr("Conf File Editor") ); 39 setCaption( tr("Conf File Editor") );
40 40
41 popupTimer = new QTimer(this); 41 popupTimer = new QTimer(this);
42 popupMenu = new QPopupMenu(this); 42 popupMenu = new QPopupMenu(this);
43 43
44 QWidget *mainWidget = new QWidget(this); 44 QWidget *mainWidget = new QWidget(this);
45 setCentralWidget( mainWidget); 45 setCentralWidget( mainWidget);
46 46
47 QGridLayout *mainLayout = new QGridLayout( mainWidget ); 47 QGridLayout *mainLayout = new QGridLayout( mainWidget );
48 mainLayout->setSpacing( 3 ); 48 mainLayout->setSpacing( 3 );
49 mainLayout->setMargin( 3 ); 49 mainLayout->setMargin( 3 );
50 50
51 51
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
78 78
79} 79}
80 80
81MainWindow::~MainWindow() 81MainWindow::~MainWindow()
82{ 82{
83} 83}
84 84
85 85
86 86
87void MainWindow::setCurrent(QListViewItem *item) 87void MainWindow::setCurrent(QListViewItem *item)
88{ 88{
89 if (!item) return; 89 if (!item) return;
90 ListViewItemConf *i = (ListViewItemConf*) item; 90 ListViewItemConf *i = (ListViewItemConf*) item;
91 if (!i) return; 91 if (!i) return;
92 if (i->getType() == ListViewItemConf::File) 92 if (i->getType() == ListViewItemConf::File)
93 { 93 {
94 qDebug("start timer"); 94 qDebug("start timer");
95 popupTimer->start( 750, true ); 95 popupTimer->start( 750, true );
96 editor->hide(); 96 editor->hide();
97 updateGeometry(); 97 updateGeometry();
98 _currentItem=0; 98 _currentItem=0;
99 _fileItem = (ListViewItemConfFile*)item; 99 _fileItem = (ListViewItemConfFile*)item;
100 return; 100 return;
101 }else editor->show(); 101 }else editor->show();
102 _fileItem = 0; 102 _fileItem = 0;
103 _currentItem = (ListViewItemConfigEntry*)item; 103 _currentItem = (ListViewItemConfigEntry*)item;
104 if (!_currentItem) return; 104 if (!_currentItem) return;
105 QString file = _currentItem->getFile(); 105 QString file = _currentItem->getFile();
106 QString group = _currentItem->getGroup(); 106 QString group = _currentItem->getGroup();
107 QString key = _currentItem->getKey(); 107 QString key = _currentItem->getKey();
108 QString val = _currentItem->getValue(); 108 QString val = _currentItem->getValue();
109 editor->TextFileName->setText(file); 109 editor->TextFileName->setText(file);
110 editor->LineEditGroup->setText(group); 110 editor->LineEditGroup->setText(group);
111 if (!key.isEmpty()) 111 if (!key.isEmpty())
112 { 112 {
113 editor->isKey(true); 113 editor->isKey(true);
114 editor->LineEditKey->setText(key); 114 editor->LineEditKey->setText(key);
115 editor->LineEditValue->setText(val); 115 editor->LineEditValue->setText(val);
116 }else{ 116 }else{
117 editor->isKey(false); 117 editor->isKey(false);
118 } 118 }
119 updateGeometry(); 119 updateGeometry();
120} 120}
121 121
122 122
123void MainWindow::groupChanged(const QString &g) 123void MainWindow::groupChanged(const QString &g)
124{ 124{
125 if (!_currentItem) return; 125 if (!_currentItem) return;
126 _currentItem->setGroup(g); 126 _currentItem->setGroup(g);
127} 127}
128 128
129void MainWindow::keyChanged(const QString &k) 129void MainWindow::keyChanged(const QString &k)
130{ 130{
131 if (!_currentItem) return; 131 if (!_currentItem) return;
132 _currentItem->keyChanged(k); 132 _currentItem->keyChanged(k);
133} 133}
134 134
135void MainWindow::valueChanged(const QString &v) 135void MainWindow::valueChanged(const QString &v)
136{ 136{
137 if (!_currentItem) return; 137 if (!_currentItem) return;
138 _currentItem->valueChanged(v); 138 _currentItem->valueChanged(v);
139} 139}
140 140
141 141
142void MainWindow::stopTimer( QListViewItem* ) 142void MainWindow::stopTimer( QListViewItem* )
143{ 143{
144 qDebug("stopTimer"); 144 qDebug("stopTimer");
145 popupTimer->stop(); 145 popupTimer->stop();
146} 146}
147 147
148void MainWindow::saveConfFile() 148void MainWindow::saveConfFile()
149{ 149{
150 if (!_fileItem) return; 150 if (!_fileItem) return;
151 _fileItem->save(); 151 _fileItem->save();
152} 152}
153 153
154void MainWindow::showPopup() 154void MainWindow::showPopup()
155{ 155{
156 qDebug("showPopup"); 156 qDebug("showPopup");
157 if (!_fileItem) return; 157 if (!_fileItem) return;
158 popupMenu->clear(); 158 popupMenu->clear();
159 159
160 QAction *popupAction; 160 QAction *popupAction;
161 popupAction = new QAction( tr("Save"),QString::null, 0, this, 0 ); 161 popupAction = new QAction( tr("Save"),QString::null, 0, this, 0 );
162 popupAction->addTo( popupMenu ); 162 popupAction->addTo( popupMenu );
163 connect( popupAction, SIGNAL( activated() ), 163 connect( popupAction, SIGNAL( activated() ),
164 this , SLOT( saveConfFile() ) ); 164 this , SLOT( saveConfFile() ) );
165 165
166 166
167 popupMenu->popup( QCursor::pos() ); 167 popupMenu->popup( QCursor::pos() );
168} 168}