author | tille <tille> | 2002-07-07 17:18:50 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-07 17:18:50 (UTC) |
commit | 04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d (patch) (unidiff) | |
tree | 91ed01ce29ec4dfd478f75239f874a22d1672a14 /noncore/apps/confedit/listviewitemconffile.cpp | |
parent | a72877e867e70784e3c865fa2948ac40f72b5c39 (diff) | |
download | opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.zip opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.tar.gz opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.tar.bz2 |
better layout
Diffstat (limited to 'noncore/apps/confedit/listviewitemconffile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp index 228421b..1f85095 100644 --- a/noncore/apps/confedit/listviewitemconffile.cpp +++ b/noncore/apps/confedit/listviewitemconffile.cpp | |||
@@ -20,7 +20,7 @@ ListViewItemConfFile::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 | ||
@@ -41,6 +41,7 @@ QString ListViewItemConfFile::fileName() | |||
41 | 41 | ||
42 | void ListViewItemConfFile::parseFile() | 42 | void ListViewItemConfFile::parseFile() |
43 | { | 43 | { |
44 | //qDebug("ListViewItemConfFile::parseFile BEGIN"); | ||
44 | QFile confFile(confFileInfo->absFilePath()); | 45 | QFile confFile(confFileInfo->absFilePath()); |
45 | if(! confFile.open(IO_ReadOnly)) | 46 | 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); | 47 | QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); |
@@ -52,7 +53,7 @@ void ListViewItemConfFile::parseFile() | |||
52 | while ( !t.atEnd() ) | 53 | while ( !t.atEnd() ) |
53 | { | 54 | { |
54 | s = t.readLine().stripWhiteSpace(); | 55 | s = t.readLine().stripWhiteSpace(); |
55 | //qDebug( "line: >%s<\n", s.latin1() ); | 56 | //qDebug( "line: >%s<\n", s.latin1() ); |
56 | if (s.contains("<?xml")) | 57 | if (s.contains("<?xml")) |
57 | { | 58 | { |
58 | _valid = false; | 59 | _valid = false; |
@@ -62,19 +63,21 @@ void ListViewItemConfFile::parseFile() | |||
62 | { | 63 | { |
63 | // qDebug("got group"+s); | 64 | // qDebug("got group"+s); |
64 | group = s.mid(1,s.length()-2); | 65 | group = s.mid(1,s.length()-2); |
66 | if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); | ||
65 | groupItem = new ListViewItemConfigEntry(this, group ); | 67 | groupItem = new ListViewItemConfigEntry(this, group ); |
66 | insertItem( groupItem ); | 68 | insertItem( groupItem ); |
67 | } else | 69 | } else |
68 | if ( int pos = s.find('=') ) | 70 | if ( int pos = s.find('=') ) |
69 | { | 71 | { |
70 | // qDebug("got key"+s); | 72 | // qDebug("got key"+s); |
73 | if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1()); | ||
71 | item = new ListViewItemConfigEntry(this, group, s ); | 74 | item = new ListViewItemConfigEntry(this, group, s ); |
72 | groupItem->insertItem( item ); | 75 | groupItem->insertItem( item ); |
73 | } | 76 | } |
74 | } | 77 | } |
75 | confFile.close(); | 78 | confFile.close(); |
76 | unchanged(); | ||
77 | setExpandable( _valid ); | 79 | setExpandable( _valid ); |
80 | //qDebug("ListViewItemConfFile::parseFile END"); | ||
78 | } | 81 | } |
79 | 82 | ||
80 | 83 | ||
@@ -140,3 +143,9 @@ QString ListViewItemConfFile::backupFileName() | |||
140 | { | 143 | { |
141 | return confFileInfo->absFilePath()+"~"; | 144 | return confFileInfo->absFilePath()+"~"; |
142 | } | 145 | } |
146 | |||
147 | |||
148 | void ListViewItemConfFile::expand() | ||
149 | { | ||
150 | parseFile(); | ||
151 | } | ||