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 @@ -15,17 +15,17 @@ #include "listviewitemconfigentry.h" #define tr QObject::tr ListViewItemConfFile::ListViewItemConfFile(QFileInfo *file, QListView *parent) : ListViewItemConf(parent), _valid(false) { confFileInfo = file; - parseFile(); +// parseFile(); displayText(); } ListViewItemConfFile::~ListViewItemConfFile() { } @@ -36,50 +36,53 @@ void ListViewItemConfFile::displayText() QString ListViewItemConfFile::fileName() { return confFileInfo->fileName(); } void ListViewItemConfFile::parseFile() { + //qDebug("ListViewItemConfFile::parseFile BEGIN"); QFile confFile(confFileInfo->absFilePath()); if(! confFile.open(IO_ReadOnly)) QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); QTextStream t( &confFile ); QString s; QString group; ListViewItemConfigEntry *groupItem; ListViewItemConfigEntry *item; while ( !t.atEnd() ) { s = t.readLine().stripWhiteSpace(); - // qDebug( "line: >%s<\n", s.latin1() ); + //qDebug( "line: >%s<\n", s.latin1() ); if (s.contains("<?xml")) { _valid = false; break; }else if ( s[0] == '[' && s[s.length()-1] == ']' ) { // qDebug("got group"+s); group = s.mid(1,s.length()-2); + if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); groupItem = new ListViewItemConfigEntry(this, group ); insertItem( groupItem ); } else if ( int pos = s.find('=') ) { - // qDebug("got key"+s); +// qDebug("got key"+s); + if (!groupItem) qDebug("PANIK NO GROUP! >%s<",group.latin1()); item = new ListViewItemConfigEntry(this, group, s ); groupItem->insertItem( item ); } } confFile.close(); - unchanged(); setExpandable( _valid ); +// qDebug("ListViewItemConfFile::parseFile END"); } void ListViewItemConfFile::remove() { QFile::remove(confFileInfo->absFilePath()); QFile::remove(backupFileName()); delete this; @@ -135,8 +138,14 @@ bool ListViewItemConfFile::revertable() { return _changed || QFile(backupFileName()).exists(); } QString ListViewItemConfFile::backupFileName() { return confFileInfo->absFilePath()+"~"; } + + +void ListViewItemConfFile::expand() +{ + parseFile(); +} |