summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
Unidiff
Diffstat (limited to 'noncore/todayplugins/stockticker/stockticker/helpwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stockticker/helpwindow.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
index 410d642..2498bf9 100644
--- a/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
+++ b/noncore/todayplugins/stockticker/stockticker/helpwindow.cpp
@@ -179,21 +179,23 @@ HelpWindow::~HelpWindow()
179 history.clear(); 179 history.clear();
180 QMap<int, QString>::Iterator it = mHistory.begin(); 180 QMap<int, QString>::Iterator it = mHistory.begin();
181 for ( ; it != mHistory.end(); ++it ) 181 for ( ; it != mHistory.end(); ++it )
182 history.append( *it ); 182 history.append( *it );
183 183
184 QFile f( QDir::currentDirPath() + "/.history" ); 184 QFile f( QDir::currentDirPath() + "/.history" );
185 f.open( IO_WriteOnly ); 185 if ( f.open( IO_WriteOnly ) ) {
186 QDataStream s( &f ); 186 QDataStream s( &f );
187 s << history; 187 s << history;
188 f.close(); 188 f.close();
189 }
189 190
190 bookmarks.clear(); 191 bookmarks.clear();
191 QMap<int, QString>::Iterator it2 = mBookmarks.begin(); 192 QMap<int, QString>::Iterator it2 = mBookmarks.begin();
192 for ( ; it2 != mBookmarks.end(); ++it2 ) 193 for ( ; it2 != mBookmarks.end(); ++it2 )
193 bookmarks.append( *it2 ); 194 bookmarks.append( *it2 );
194 195
195 QFile f2( QDir::currentDirPath() + "/.bookmarks" ); 196 QFile f2( QDir::currentDirPath() + "/.bookmarks" );
196 f2.open( IO_WriteOnly ); 197 if ( !f2.open( IO_WriteOnly ) )
198 return;
197 QDataStream s2( &f2 ); 199 QDataStream s2( &f2 );
198 s2 << bookmarks; 200 s2 << bookmarks;
199 f2.close(); 201 f2.close();
@@ -231,24 +233,26 @@ void HelpWindow::pathSelected( const QString &_path )
231void HelpWindow::readHistory() 233void HelpWindow::readHistory()
232{ 234{
233 if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) { 235 if ( QFile::exists( QDir::currentDirPath() + "/.history" ) ) {
234 QFile f( QDir::currentDirPath() + "/.history" ); 236 QFile f( QDir::currentDirPath() + "/.history" );
235 f.open( IO_ReadOnly ); 237 if ( !f.open( IO_ReadOnly ) )
236 QDataStream s( &f ); 238 return;
237 s >> history; 239 QDataStream s( &f );
238 f.close(); 240 s >> history;
239 while ( history.count() > 20 ) 241 f.close();
240 history.remove( history.begin() ); 242 while ( history.count() > 20 )
243 history.remove( history.begin() );
241 } 244 }
242} 245}
243 246
244void HelpWindow::readBookmarks() 247void HelpWindow::readBookmarks()
245{ 248{
246 if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) { 249 if ( QFile::exists( QDir::currentDirPath() + "/.bookmarks" ) ) {
247 QFile f( QDir::currentDirPath() + "/.bookmarks" ); 250 QFile f( QDir::currentDirPath() + "/.bookmarks" );
248 f.open( IO_ReadOnly ); 251 if ( !f.open( IO_ReadOnly ) )
249 QDataStream s( &f ); 252 return;
250 s >> bookmarks; 253 QDataStream s( &f );
251 f.close(); 254 s >> bookmarks;
255 f.close();
252 } 256 }
253} 257}
254 258