-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index f2dbabf..92fdb0a 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -281,77 +281,77 @@ void NotesControl::save() { | |||
281 | docname = docname.mid( 1 ); | 281 | docname = docname.mid( 1 ); |
282 | docname.replace( QRegExp("/"), "_" ); | 282 | docname.replace( QRegExp("/"), "_" ); |
283 | // cut the length. filenames longer than that don't make sense | 283 | // cut the length. filenames longer than that don't make sense |
284 | // and something goes wrong when they get too long. | 284 | // and something goes wrong when they get too long. |
285 | if ( docname.length() > 40 ) | 285 | if ( docname.length() > 40 ) |
286 | docname = docname.left(40); | 286 | docname = docname.left(40); |
287 | if ( docname.isEmpty() ) | 287 | if ( docname.isEmpty() ) |
288 | docname = "Empty Text"; | 288 | docname = "Empty Text"; |
289 | qDebug(docname); | 289 | qDebug(docname); |
290 | 290 | ||
291 | if( oldDocName != docname) { | 291 | if( oldDocName != docname) { |
292 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 292 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
293 | QString entryName; | 293 | QString entryName; |
294 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 294 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
295 | cfg.writeEntry( entryName,docname ); | 295 | cfg.writeEntry( entryName,docname ); |
296 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); | 296 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); |
297 | cfg.write(); | 297 | cfg.write(); |
298 | } | 298 | } |
299 | else | 299 | else |
300 | qDebug("oldname equals docname"); | 300 | qDebug("oldname equals docname"); |
301 | doc = new DocLnk(docname); | 301 | doc = new DocLnk(docname); |
302 | 302 | ||
303 | doc->setType("text/plain"); | 303 | doc->setType("text/plain"); |
304 | doc->setFile(docname); | 304 | doc->setFile(docname); |
305 | doc->setName(docname); | 305 | doc->setName(docname); |
306 | 306 | ||
307 | FileManager fm; | 307 | FileManager fm; |
308 | if ( !fm.saveFile( *doc, rt ) ) { | 308 | if ( !fm.saveFile( *doc, rt ) ) { |
309 | } | 309 | } |
310 | 310 | ||
311 | oldDocName=docname; | 311 | oldDocName=docname; |
312 | edited=false; | 312 | edited=false; |
313 | qDebug("save"); | 313 | // qDebug("save"); |
314 | if (doPopulate) | 314 | if (doPopulate) |
315 | populateBox(); | 315 | populateBox(); |
316 | } | 316 | } |
317 | cfg.writeEntry( "LastDoc",oldDocName ); | 317 | cfg.writeEntry( "LastDoc",oldDocName ); |
318 | cfg.write(); | 318 | cfg.write(); |
319 | 319 | ||
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | void NotesControl::populateBox() { | 323 | void NotesControl::populateBox() { |
324 | box->clear(); | 324 | box->clear(); |
325 | qDebug("populate"); | 325 | // qDebug("populate"); |
326 | Config cfg("Notes"); | 326 | Config cfg("Notes"); |
327 | cfg.setGroup("Docs"); | 327 | cfg.setGroup("Docs"); |
328 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 328 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
329 | QStringList list; | 329 | QStringList list; |
330 | QString entryName; | 330 | QString entryName; |
331 | for ( int i = 0; i < noOfFiles; i++ ) { | 331 | for ( int i = 0; i < noOfFiles; i++ ) { |
332 | entryName.sprintf( "File%i", i + 1 ); | 332 | entryName.sprintf( "File%i", i + 1 ); |
333 | list.append(cfg.readEntry( entryName )); | 333 | list.append(cfg.readEntry( entryName )); |
334 | } | 334 | } |
335 | list.sort(); | 335 | list.sort(); |
336 | box->insertStringList(list,-1); | 336 | box->insertStringList(list,-1); |
337 | doPopulate=false; | 337 | doPopulate=false; |
338 | update(); | 338 | update(); |
339 | } | 339 | } |
340 | 340 | ||
341 | void NotesControl::load() { | 341 | void NotesControl::load() { |
342 | 342 | ||
343 | if(!loaded) { | 343 | if(!loaded) { |
344 | Config cfg("Notes"); | 344 | Config cfg("Notes"); |
345 | cfg.setGroup("Docs"); | 345 | cfg.setGroup("Docs"); |
346 | QString lastDoc=cfg.readEntry( "LastDoc",""); | 346 | QString lastDoc=cfg.readEntry( "LastDoc",""); |
347 | DocLnk nf; | 347 | DocLnk nf; |
348 | nf.setType("text/plain"); | 348 | nf.setType("text/plain"); |
349 | nf.setFile(lastDoc); | 349 | nf.setFile(lastDoc); |
350 | 350 | ||
351 | loadDoc(nf); | 351 | loadDoc(nf); |
352 | loaded=true; | 352 | loaded=true; |
353 | oldDocName=lastDoc; | 353 | oldDocName=lastDoc; |
354 | cfg.writeEntry( "LastDoc",oldDocName ); | 354 | cfg.writeEntry( "LastDoc",oldDocName ); |
355 | cfg.write(); | 355 | cfg.write(); |
356 | } | 356 | } |
357 | } | 357 | } |