-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 64731e3..a4aa093 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -249,49 +249,49 @@ void NotesControl::save() { | |||
249 | edited=false; | 249 | edited=false; |
250 | } | 250 | } |
251 | qDebug("save"); | 251 | qDebug("save"); |
252 | if (doPopulate) | 252 | if (doPopulate) |
253 | populateBox(); | 253 | populateBox(); |
254 | } | 254 | } |
255 | cfg.writeEntry( "LastDoc",oldDocName ); | 255 | cfg.writeEntry( "LastDoc",oldDocName ); |
256 | cfg.write(); | 256 | cfg.write(); |
257 | } | 257 | } |
258 | 258 | ||
259 | void NotesControl::populateBox() { | 259 | void NotesControl::populateBox() { |
260 | box->clear(); | 260 | box->clear(); |
261 | qDebug("populate"); | 261 | qDebug("populate"); |
262 | Config cfg("Notes"); | 262 | Config cfg("Notes"); |
263 | cfg.setGroup("Docs"); | 263 | cfg.setGroup("Docs"); |
264 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 264 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
265 | QStringList list; | 265 | QStringList list; |
266 | QString entryName; | 266 | QString entryName; |
267 | for ( int i = 0; i < noOfFiles; i++ ) { | 267 | for ( int i = 0; i < noOfFiles; i++ ) { |
268 | entryName.sprintf( "File%i", i + 1 ); | 268 | entryName.sprintf( "File%i", i + 1 ); |
269 | list.append(cfg.readEntry( entryName )); | 269 | list.append(cfg.readEntry( entryName )); |
270 | } | 270 | } |
271 | list.sort(); | 271 | list.sort(); |
272 | box->insertStringList(list,-1); | 272 | box->insertStringList(list,-1); |
273 | 273 | doPopulate=false; | |
274 | } | 274 | } |
275 | 275 | ||
276 | void NotesControl::load() { | 276 | void NotesControl::load() { |
277 | 277 | ||
278 | Config cfg("Notes"); | 278 | Config cfg("Notes"); |
279 | cfg.setGroup("Docs"); | 279 | cfg.setGroup("Docs"); |
280 | if(!loaded) { | 280 | if(!loaded) { |
281 | QString lastDoc=cfg.readEntry( "LastDoc",""); | 281 | QString lastDoc=cfg.readEntry( "LastDoc",""); |
282 | DocLnk nf; | 282 | DocLnk nf; |
283 | nf.setType("text/plain"); | 283 | nf.setType("text/plain"); |
284 | nf.setFile(lastDoc); | 284 | nf.setFile(lastDoc); |
285 | 285 | ||
286 | loadDoc(nf); | 286 | loadDoc(nf); |
287 | loaded=true; | 287 | loaded=true; |
288 | oldDocName=lastDoc; | 288 | oldDocName=lastDoc; |
289 | } | 289 | } |
290 | cfg.writeEntry( "LastDoc",oldDocName ); | 290 | cfg.writeEntry( "LastDoc",oldDocName ); |
291 | cfg.write(); | 291 | cfg.write(); |
292 | } | 292 | } |
293 | 293 | ||
294 | void NotesControl::load(const QString & file) { | 294 | void NotesControl::load(const QString & file) { |
295 | qDebug("loading "+file); | 295 | qDebug("loading "+file); |
296 | if(!loaded) { | 296 | if(!loaded) { |
297 | DocLnk nf; | 297 | DocLnk nf; |
@@ -323,41 +323,41 @@ void NotesControl::slotViewEdited() { | |||
323 | edited=true; | 323 | edited=true; |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | //=========================================================================== | 327 | //=========================================================================== |
328 | 328 | ||
329 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) | 329 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) |
330 | : QWidget( parent, name ) { | 330 | : QWidget( parent, name ) { |
331 | setFixedHeight( 18 ); | 331 | setFixedHeight( 18 ); |
332 | setFixedWidth( 14 ); | 332 | setFixedWidth( 14 ); |
333 | vc = new NotesControl; | 333 | vc = new NotesControl; |
334 | } | 334 | } |
335 | 335 | ||
336 | NotesApplet::~NotesApplet() { | 336 | NotesApplet::~NotesApplet() { |
337 | } | 337 | } |
338 | 338 | ||
339 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 339 | void NotesApplet::mousePressEvent( QMouseEvent *) { |
340 | if( !vc->isHidden()) { | 340 | if( !vc->isHidden()) { |
341 | vc->doPopulate=false; | 341 | vc->doPopulate=false; |
342 | vc->save(); | 342 | vc->save(); |
343 | vc->close(); | 343 | vc->close(); |
344 | } else { | 344 | } else { |
345 | // vc = new NotesControl; | 345 | // vc = new NotesControl; |
346 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 346 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
347 | vc->show(); | 347 | vc->show(); |
348 | vc->move( 5, 18); | 348 | vc->move( 5, 18); |
349 | vc->doPopulate=true; | 349 | vc->doPopulate=true; |
350 | vc->populateBox(); | 350 | vc->populateBox(); |
351 | vc->load(); | 351 | vc->doPopulate=false; |
352 | 352 | ||
353 | 353 | vc->load(); | |
354 | this->setFocus(); | 354 | // this->setFocus(); |
355 | vc->view->setFocus(); | 355 | vc->view->setFocus(); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | 358 | ||
359 | void NotesApplet::paintEvent( QPaintEvent* ) { | 359 | void NotesApplet::paintEvent( QPaintEvent* ) { |
360 | QPainter p(this); | 360 | QPainter p(this); |
361 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); | 361 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); |
362 | } | 362 | } |
363 | 363 | ||