summaryrefslogtreecommitdiff
path: root/noncore/apps/confedit/listviewitemconffile.cpp
Unidiff
Diffstat (limited to 'noncore/apps/confedit/listviewitemconffile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/confedit/listviewitemconffile.cpp59
1 files changed, 32 insertions, 27 deletions
diff --git a/noncore/apps/confedit/listviewitemconffile.cpp b/noncore/apps/confedit/listviewitemconffile.cpp
index 2958cf5..a7d6b00 100644
--- a/noncore/apps/confedit/listviewitemconffile.cpp
+++ b/noncore/apps/confedit/listviewitemconffile.cpp
@@ -41,48 +41,53 @@ void ListViewItemConfFile::displayText()
41 41
42QString ListViewItemConfFile::fileName() 42QString ListViewItemConfFile::fileName()
43{ 43{
44 return confFileInfo->fileName(); 44 return confFileInfo->fileName();
45} 45}
46 46
47void ListViewItemConfFile::parseFile() 47void ListViewItemConfFile::parseFile()
48{ 48{
49 //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl; 49 //odebug << "ListViewItemConfFile::parseFile BEGIN" << oendl;
50 QFile confFile(confFileInfo->absFilePath()); 50 QFile confFile(confFileInfo->absFilePath());
51 if(! confFile.open(IO_ReadOnly)) 51 if(! confFile.open(IO_ReadOnly))
52 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0); 52 QMessageBox::critical(0,tr("Could not open"),tr("The file ")+confFileInfo->fileName()+tr(" could not be opened."),1,0);
53 QTextStream t( &confFile ); 53
54 QString s; 54 QTextStream t( &confFile );
55 QString s;
55 QString group; 56 QString group;
56 ListViewItemConfigEntry *groupItem; 57 ListViewItemConfigEntry *groupItem = 0;
57 ListViewItemConfigEntry *item; 58 ListViewItemConfigEntry *item;
58 while ( !t.atEnd() ) 59 while ( !t.atEnd() )
59 { 60 {
60 s = t.readLine().stripWhiteSpace(); 61 s = t.readLine().stripWhiteSpace();
61 //odebug << "line: >" << s.latin1() << "<\n" << oendl; 62 //odebug << "line: >" << s.latin1() << "<\n" << oendl;
62 if (s.contains("<?xml")) 63 if (s.contains("<?xml"))
63 { 64 {
64 _valid = false; 65 _valid = false;
65 break; 66 break;
66 }else 67 }
67 if ( s[0] == '[' && s[s.length()-1] == ']' ) 68 else if ( s[0] == '[' && s[s.length()-1] == ']' )
68 { 69 {
69 // odebug << "got group"+s << oendl; 70 //odebug << "got group"+s << oendl;
70 group = s.mid(1,s.length()-2); 71 group = s.mid(1,s.length()-2);
71 if (!groupItem) groupItem = new ListViewItemConfigEntry(this, tr("no group") ); 72 if (!groupItem)
73 groupItem = new ListViewItemConfigEntry(this, tr("no group") );
74
72 groupItem = new ListViewItemConfigEntry(this, group ); 75 groupItem = new ListViewItemConfigEntry(this, group );
73 insertItem( groupItem ); 76 insertItem( groupItem );
74 } else 77 }
75 if ( int pos = s.find('=') ) 78 else if ( int pos = s.find('=') )
76 { 79 {
77// odebug << "got key"+s << oendl; 80 //odebug << "got key"+s << oendl;
78 if (!groupItem) odebug << "PANIK NO GROUP! >" << group.latin1() << "<" << oendl; 81 if (!groupItem)
79 item = new ListViewItemConfigEntry(this, group, s ); 82 odebug << "PANIC! no group >" << group.latin1() << "<" << oendl;
83
84 item = new ListViewItemConfigEntry(this, group, s );
80 groupItem->insertItem( item ); 85 groupItem->insertItem( item );
81 } 86 }
82 } 87 }
83 confFile.close(); 88 confFile.close();
84 setExpandable( _valid ); 89 setExpandable( _valid );
85 //odebug << "ListViewItemConfFile::parseFile END" << oendl; 90 //odebug << "ListViewItemConfFile::parseFile END" << oendl;
86} 91}
87 92
88 93