-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 13f297e..61a47d7 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -190,97 +190,97 @@ void NotesControl::slotBeamButton() { | |||
190 | } else { | 190 | } else { |
191 | this->hide(); | 191 | this->hide(); |
192 | QString selectedText = box->currentText(); | 192 | QString selectedText = box->currentText(); |
193 | if( !selectedText.isEmpty()) { | 193 | if( !selectedText.isEmpty()) { |
194 | QString file = QDir::homeDirPath()+"/"+selectedText; | 194 | QString file = QDir::homeDirPath()+"/"+selectedText; |
195 | QFile f(file); | 195 | QFile f(file); |
196 | Ir *irFile = new Ir(this, "IR"); | 196 | Ir *irFile = new Ir(this, "IR"); |
197 | connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished(Ir*))); | 197 | connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished(Ir*))); |
198 | irFile->send( file, "Note", "text/plain" ); | 198 | irFile->send( file, "Note", "text/plain" ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | void NotesControl::slotBeamFinished(Ir *) { | 203 | void NotesControl::slotBeamFinished(Ir *) { |
204 | this->show(); | 204 | this->show(); |
205 | } | 205 | } |
206 | 206 | ||
207 | void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { | 207 | void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { |
208 | switch (mouse) { | 208 | switch (mouse) { |
209 | case 1:{ | 209 | case 1:{ |
210 | } | 210 | } |
211 | break; | 211 | break; |
212 | case 2: | 212 | case 2: |
213 | menuTimer.start( 500, TRUE ); | 213 | menuTimer.start( 500, TRUE ); |
214 | break; | 214 | break; |
215 | }; | 215 | }; |
216 | } | 216 | } |
217 | 217 | ||
218 | void NotesControl::slotBoxSelected(const QString &itemString) { | 218 | void NotesControl::slotBoxSelected(const QString &itemString) { |
219 | if(edited) { | 219 | if(edited) { |
220 | save(); | 220 | save(); |
221 | } | 221 | } |
222 | loaded=false; | 222 | loaded=false; |
223 | edited=false; | 223 | edited=false; |
224 | load(itemString); | 224 | load(itemString); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | void NotesControl::showMenu() { | 228 | void NotesControl::showMenu() { |
229 | QPopupMenu *m = new QPopupMenu(0); | 229 | QPopupMenu *m = new QPopupMenu(0); |
230 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); | 230 | m->insertItem( tr( "Beam Out" ), this, SLOT( slotBeamButton() )); |
231 | m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); | 231 | m->insertItem( tr( "Search For..." ), this, SLOT( slotSearch() )); |
232 | m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); | 232 | m->insertItem( tr( "Toggle Maximized" ), this, SLOT( slotShowMax() )); |
233 | m->insertSeparator(); | 233 | m->insertSeparator(); |
234 | m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); | 234 | m->insertItem( tr( "Delete" ), this, SLOT( slotDeleteButton() )); |
235 | m->setFocus(); | 235 | m->setFocus(); |
236 | m->exec( QCursor::pos() ); | 236 | m->exec( QCursor::pos() ); |
237 | 237 | ||
238 | if(m) delete m; | 238 | delete m; |
239 | } | 239 | } |
240 | 240 | ||
241 | void NotesControl::focusOutEvent ( QFocusEvent * e) { | 241 | void NotesControl::focusOutEvent ( QFocusEvent * e) { |
242 | if( e->reason() == QFocusEvent::Popup) | 242 | if( e->reason() == QFocusEvent::Popup) |
243 | save(); | 243 | save(); |
244 | else { | 244 | else { |
245 | if(!loaded) { | 245 | if(!loaded) { |
246 | populateBox(); | 246 | populateBox(); |
247 | load(); | 247 | load(); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | QWidget::focusOutEvent(e); | 250 | QWidget::focusOutEvent(e); |
251 | } | 251 | } |
252 | 252 | ||
253 | void NotesControl::save() { | 253 | void NotesControl::save() { |
254 | Config cfg("Notes"); | 254 | Config cfg("Notes"); |
255 | cfg.setGroup("Docs"); | 255 | cfg.setGroup("Docs"); |
256 | if( edited) { | 256 | if( edited) { |
257 | // odebug << "is edited" << oendl; | 257 | // odebug << "is edited" << oendl; |
258 | QString rt = view->text(); | 258 | QString rt = view->text(); |
259 | if( rt.length()>1) { | 259 | if( rt.length()>1) { |
260 | QString pt = rt.simplifyWhiteSpace(); | 260 | QString pt = rt.simplifyWhiteSpace(); |
261 | int i = pt.find( ' ', pt.find( ' ' )+2 ); | 261 | int i = pt.find( ' ', pt.find( ' ' )+2 ); |
262 | QString docname = pt; | 262 | QString docname = pt; |
263 | if ( i > 0 ) | 263 | if ( i > 0 ) |
264 | docname = pt.left(i); | 264 | docname = pt.left(i); |
265 | // remove "." at the beginning | 265 | // remove "." at the beginning |
266 | while( docname.startsWith( "." ) ) | 266 | while( docname.startsWith( "." ) ) |
267 | docname = docname.mid( 1 ); | 267 | docname = docname.mid( 1 ); |
268 | docname.replace( QRegExp("/"), "_" ); | 268 | docname.replace( QRegExp("/"), "_" ); |
269 | // cut the length. filenames longer than that don't make sense | 269 | // cut the length. filenames longer than that don't make sense |
270 | // and something goes wrong when they get too long. | 270 | // and something goes wrong when they get too long. |
271 | if ( docname.length() > 40 ) | 271 | if ( docname.length() > 40 ) |
272 | docname = docname.left(40); | 272 | docname = docname.left(40); |
273 | if ( docname.isEmpty() ) | 273 | if ( docname.isEmpty() ) |
274 | docname = "Empty Text"; | 274 | docname = "Empty Text"; |
275 | // odebug << docname << oendl; | 275 | // odebug << docname << oendl; |
276 | 276 | ||
277 | if( oldDocName != docname) { | 277 | if( oldDocName != docname) { |
278 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 278 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
279 | QString entryName; | 279 | QString entryName; |
280 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 280 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
281 | cfg.writeEntry( entryName,docname ); | 281 | cfg.writeEntry( entryName,docname ); |
282 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); | 282 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); |
283 | cfg.write(); | 283 | cfg.write(); |
284 | } | 284 | } |
285 | // else | 285 | // else |
286 | // odebug << "oldname equals docname" << oendl; | 286 | // odebug << "oldname equals docname" << oendl; |
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 828f5a1..cf19ba8 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -451,97 +451,97 @@ void AdvancedFm::showFileMenu() { | |||
451 | } else { | 451 | } else { |
452 | 452 | ||
453 | if (app) | 453 | if (app) |
454 | m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); | 454 | m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis())); |
455 | else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this | 455 | else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this |
456 | m->insertItem(tr("Execute"),this,SLOT(runThis())); | 456 | m->insertItem(tr("Execute"),this,SLOT(runThis())); |
457 | m->insertItem( Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon ), | 457 | m->insertItem( Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon ), |
458 | tr("Open as text"),this,SLOT(runText())); | 458 | tr("Open as text"),this,SLOT(runText())); |
459 | } | 459 | } |
460 | 460 | ||
461 | m->insertItem(tr("Actions"),n); | 461 | m->insertItem(tr("Actions"),n); |
462 | n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); | 462 | n->insertItem(tr("Make Directory"),this,SLOT(makeDir())); |
463 | 463 | ||
464 | n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); | 464 | n->insertItem(tr("Make Symlink"),this,SLOT(mkSym())); |
465 | 465 | ||
466 | n->insertSeparator(); | 466 | n->insertSeparator(); |
467 | n->insertItem(tr("Rename"),this,SLOT(renameIt())); | 467 | n->insertItem(tr("Rename"),this,SLOT(renameIt())); |
468 | 468 | ||
469 | n->insertItem(tr("Copy"),this,SLOT(copyTimer())); | 469 | n->insertItem(tr("Copy"),this,SLOT(copyTimer())); |
470 | n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); | 470 | n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer())); |
471 | n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); | 471 | n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer())); |
472 | n->insertItem(tr("Move"),this,SLOT(moveTimer())); | 472 | n->insertItem(tr("Move"),this,SLOT(moveTimer())); |
473 | 473 | ||
474 | n->insertSeparator(); | 474 | n->insertSeparator(); |
475 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); | 475 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); |
476 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); | 476 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); |
477 | 477 | ||
478 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); | 478 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); |
479 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); | 479 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); |
480 | 480 | ||
481 | m->insertSeparator(); | 481 | m->insertSeparator(); |
482 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); | 482 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); |
483 | 483 | ||
484 | #if defined(QT_QWS_OPIE) | 484 | #if defined(QT_QWS_OPIE) |
485 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); | 485 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); |
486 | #endif | 486 | #endif |
487 | m->setCheckable(TRUE); | 487 | m->setCheckable(TRUE); |
488 | if (!b) | 488 | if (!b) |
489 | m->setItemChecked(m->idAt(0),TRUE); | 489 | m->setItemChecked(m->idAt(0),TRUE); |
490 | else | 490 | else |
491 | m->setItemChecked(m->idAt(0),FALSE); | 491 | m->setItemChecked(m->idAt(0),FALSE); |
492 | 492 | ||
493 | if(Ir::supported()) | 493 | if(Ir::supported()) |
494 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); | 494 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); |
495 | m->setFocus(); | 495 | m->setFocus(); |
496 | 496 | ||
497 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); | 497 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); |
498 | 498 | ||
499 | if(m) delete m; | 499 | delete m; |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 503 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
504 | struct statfs fss; | 504 | struct statfs fss; |
505 | if ( !statfs( path.latin1(), &fss ) ) { | 505 | if ( !statfs( path.latin1(), &fss ) ) { |
506 | int blkSize = fss.f_bsize; | 506 | int blkSize = fss.f_bsize; |
507 | // int totalBlks = fs.f_blocks; | 507 | // int totalBlks = fs.f_blocks; |
508 | int availBlks = fss.f_bavail; | 508 | int availBlks = fss.f_bavail; |
509 | 509 | ||
510 | long mult = blkSize / 1024; | 510 | long mult = blkSize / 1024; |
511 | long div = 1024 / blkSize; | 511 | long div = 1024 / blkSize; |
512 | if ( !mult ) mult = 1; | 512 | if ( !mult ) mult = 1; |
513 | if ( !div ) div = 1; | 513 | if ( !div ) div = 1; |
514 | 514 | ||
515 | 515 | ||
516 | return QString::number(availBlks * mult / div); | 516 | return QString::number(availBlks * mult / div); |
517 | } | 517 | } |
518 | return ""; | 518 | return ""; |
519 | } | 519 | } |
520 | 520 | ||
521 | void AdvancedFm::addToDocs() { | 521 | void AdvancedFm::addToDocs() { |
522 | QStringList strListPaths = getPath(); | 522 | QStringList strListPaths = getPath(); |
523 | QDir *thisDir = CurrentDir(); | 523 | QDir *thisDir = CurrentDir(); |
524 | 524 | ||
525 | if( strListPaths.count() > 0) { | 525 | if( strListPaths.count() > 0) { |
526 | QString curFile; | 526 | QString curFile; |
527 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 527 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
528 | curFile = thisDir->canonicalPath()+"/"+(*it); | 528 | curFile = thisDir->canonicalPath()+"/"+(*it); |
529 | // odebug << curFile << oendl; | 529 | // odebug << curFile << oendl; |
530 | QFileInfo fi(curFile); | 530 | QFileInfo fi(curFile); |
531 | DocLnk f; | 531 | DocLnk f; |
532 | // curFile.replace(QRegExp("\\..*"),""); | 532 | // curFile.replace(QRegExp("\\..*"),""); |
533 | f.setName(fi.baseName() ); | 533 | f.setName(fi.baseName() ); |
534 | f.setFile( curFile); | 534 | f.setFile( curFile); |
535 | f.writeLink(); | 535 | f.writeLink(); |
536 | } | 536 | } |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | 540 | ||
541 | void AdvancedFm::customDirsToMenu() { | 541 | void AdvancedFm::customDirsToMenu() { |
542 | 542 | ||
543 | Config cfg("AdvancedFm"); | 543 | Config cfg("AdvancedFm"); |
544 | cfg.setGroup("Menu"); | 544 | cfg.setGroup("Menu"); |
545 | 545 | ||
546 | QStringList list = cfg.readListEntry( "CustomDir", ','); | 546 | QStringList list = cfg.readListEntry( "CustomDir", ','); |
547 | menuButton->insertItems(list ); | 547 | menuButton->insertItems(list ); |