author | erik <erik> | 2007-01-29 21:53:48 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-29 21:53:48 (UTC) |
commit | 02ef45be75a3024df11365956e1cce6392d9103c (patch) (unidiff) | |
tree | 42fd5c909d67a473f57a607e01d32e01b3dd2511 /noncore/apps/confedit | |
parent | b2c306a99b8dc82c981390f02db859149fac8cf0 (diff) | |
download | opie-02ef45be75a3024df11365956e1cce6392d9103c.zip opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.gz opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.bz2 |
Each file in this commit has an issue where the initial value of a variable
is assumed to be something but no initial value is given.
This commit changes that by either assigning an initial value or removing
the assumption on an initial value (usually the former).
-rw-r--r-- | noncore/apps/confedit/listviewitemconffile.cpp | 59 |
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 | |||
@@ -40,50 +40,55 @@ void ListViewItemConfFile::displayText() | |||
40 | } | 40 | } |
41 | 41 | ||
42 | QString ListViewItemConfFile::fileName() | 42 | QString ListViewItemConfFile::fileName() |
43 | { | 43 | { |
44 | return confFileInfo->fileName(); | 44 | return confFileInfo->fileName(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void ListViewItemConfFile::parseFile() | 47 | void 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 | ||
89 | void ListViewItemConfFile::remove() | 94 | void ListViewItemConfFile::remove() |