void FileWatcher::handleFileChanged (const QString& path) { if (IsScheduled_ || path != CurrentFile_) return; QTimer::singleShot (2000, this, SLOT (doReload ())); IsScheduled_ = true; }
void NBFolderView::createAndSetupActions() { connect( IconView, SIGNAL( peek( QModelIndex ) ), this, SLOT( doPeek( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QModelIndex ) ), this, SLOT( doOpen( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QString ) ), this, SLOT( doOpen( QString ) ) ); connect( IconView, SIGNAL( contextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); connect( IconView, SIGNAL( actionsMenuRequested( QPoint ) ), this, SLOT( showActionsMenu( QPoint ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( updateActions() ) ); connect( IconView, SIGNAL( link( QStringList, QString ) ), this, SLOT( link( QStringList, QString ) ) ); // DragDrop copy connect( IconView, SIGNAL( copy( QStringList, QString ) ), this, SLOT( copy( QStringList, QString ) ) ); // DragDrop move connect( IconView, SIGNAL( move( QStringList, QString ) ), this, SLOT( move( QStringList, QString ) ) ); // Update actions once the directory is loaded connect( fsModel, SIGNAL( directoryLoaded( QString ) ), this, SLOT( updateActions() ) ); // Peek peekAct = new QAction( QIcon( ":/icons/peek.png" ), "Pee&k", this ); peekAct->setShortcuts( Settings->shortcuts( "Peek" ) ); connect( peekAct, SIGNAL( triggered() ), this, SLOT( doPeek() ) ); addAction( peekAct ); // Home Dir actHomeDir = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actHomeDir->setShortcuts( Settings->shortcuts( "GoHome" ) ); connect( actHomeDir, SIGNAL( triggered() ), this, SLOT( loadHomeDir() ) ); addAction( actHomeDir ); // Home actGoHome = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actGoHome->setShortcut( tr( "Alt+Shift+Home" ) ); connect( actGoHome, SIGNAL( triggered() ), this, SLOT( doOpenHome() ) ); addAction( actGoHome ); // Up actParDir = new QAction( QIcon( ":/icons/up.png" ), "&Up", this ); actParDir->setShortcuts( Settings->shortcuts( "GoUp" ) ); connect( actParDir, SIGNAL( triggered() ), fsModel, SLOT( goUp() ) ); addAction( actParDir ); // Back actPrevDir = new QAction( QIcon( ":/icons/prev.png" ), "&Back", this ); actPrevDir->setShortcuts( Settings->shortcuts( "GoLeft" ) ); connect( actPrevDir, SIGNAL( triggered() ), fsModel, SLOT( goBack() ) ); addAction( actPrevDir ); // Forward actNextDir = new QAction( QIcon( ":/icons/next.png" ), "&Forward", this ); actNextDir->setShortcuts( Settings->shortcuts( "GoRight" ) ); connect( actNextDir, SIGNAL( triggered() ), fsModel, SLOT( goForward() ) ); addAction( actNextDir ); // New Folder actNewDir = new QAction( QIcon::fromTheme( "folder-new" ), "New folder", this ); actNewDir->setShortcuts( Settings->shortcuts( "NewFolder" ) ); connect( actNewDir, SIGNAL( triggered() ), this, SLOT( newFolder() ) ); addAction( actNewDir ); // New file actNewFile = new QAction( QIcon::fromTheme( "document-new" ), "New File", this ); actNewFile->setShortcuts( Settings->shortcuts( "NewFile" ) ); connect( actNewFile, SIGNAL( triggered() ), this, SLOT( newFile() ) ); addAction( actNewFile ); // New file actNewEncFS = new QAction( QIcon::fromTheme( "document-new" ), "New Encrypted Directory", this ); actNewEncFS->setShortcuts( Settings->shortcuts( "NewEncFS" ) ); connect( actNewEncFS, SIGNAL( triggered() ), this, SLOT( createEncFS() ) ); addAction( actNewEncFS ); // Copy copyAct = new QAction( QIcon( ":/icons/copy.png" ), "&Copy", this ); copyAct->setShortcuts( Settings->shortcuts( "Copy" ) ); connect( copyAct, SIGNAL( triggered() ), this, SLOT( prepareCopy() ) ); addAction( copyAct ); // Move moveAct = new QAction( QIcon( ":/icons/cut.png" ), "Cu&t", this ); moveAct->setShortcuts( Settings->shortcuts( "Cut" ) ); connect( moveAct, SIGNAL( triggered() ), this, SLOT( prepareMove() ) ); addAction( moveAct ); // Paste pasteAct = new QAction( QIcon( ":/icons/paste.png" ), "&Paste", this ); pasteAct->setShortcuts( Settings->shortcuts( "Paste" ) ); connect( pasteAct, SIGNAL( triggered() ), this, SLOT( prepareIO() ) ); addAction( pasteAct ); // Rename renameAct = new QAction( QIcon( ":/icons/rename.png" ), "&Rename", this ); renameAct->setShortcuts( Settings->shortcuts( "Rename" ) ); connect( renameAct, SIGNAL( triggered() ), this, SLOT( doRename() ) ); addAction( renameAct ); // Reload reloadAct = new QAction( QIcon( ":/icons/reload.png" ), "Re&fresh", this ); reloadAct->setShortcuts( Settings->shortcuts( "Reload" ) ); connect( reloadAct, SIGNAL( triggered() ), this, SLOT( doReload() ) ); addAction( reloadAct ); // showDotFiles showHideDotFiles = new QAction( QIcon( ":/icons/showDotFiles.png" ), "Show &Hidden", this ); showHideDotFiles->setShortcuts( Settings->shortcuts( "ToggleHidden" ) ); connect( showHideDotFiles, SIGNAL( triggered() ), this, SLOT( doToggleHidden() ) ); addAction( showHideDotFiles ); // Trash trashAct = new QAction( QIcon( ":/icons/trash.png" ), "Move to trash", this ); trashAct->setShortcuts( Settings->shortcuts( "Trash" ) ); connect( trashAct, SIGNAL( triggered() ), this, SLOT( doSendToTrash() ) ); addAction( trashAct ); // Delete delAct = new QAction( QIcon( ":/icons/delete.png" ), "Delete", this ); delAct->setShortcuts( Settings->shortcuts( "Delete" ) ); connect( delAct, SIGNAL( triggered() ), this, SLOT( doDelete() ) ); addAction( delAct ); // Properties propertiesAct = new QAction( QIcon( ":/icons/props.png" ), "&Properties", this ); propertiesAct->setShortcuts( Settings->shortcuts( "Properties" ) ); connect( propertiesAct, SIGNAL( triggered() ), this, SIGNAL( showProperties() ) ); addAction( propertiesAct ); // Permissions permissionsAct = new QAction( QIcon::fromTheme( "system-users" ), "P&ermissions", this ); permissionsAct->setShortcuts( Settings->shortcuts( "Permissions" ) ); connect( permissionsAct, SIGNAL( triggered() ), this, SIGNAL( showPermissions() ) ); addAction( permissionsAct ); // Open a virtual terminal emulator openVTE = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE", this ); openVTE->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTE, SIGNAL( triggered() ), this, SLOT( openTerminal() ) ); addAction( openVTE ); // Open a virtual terminal emulator openVTEin = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE Here", this ); // openVTEin->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTEin, SIGNAL( triggered() ), this, SLOT( openTerminalIn() ) ); // Select All QAction *selectAllAct = new QAction( "&Select All", this ); selectAllAct->setShortcuts( Settings->shortcuts( "SelectAll" ) ); connect( selectAllAct, SIGNAL( triggered() ), this, SLOT( selectAll() ) ); addAction( selectAllAct ); // Sorting sortByNameAct = new QAction( QIcon::fromTheme( "format-text-underline" ), "&Name", this ); sortByNameAct->setCheckable( true ); connect( sortByNameAct, SIGNAL( triggered() ), this, SLOT( sortByName() ) ); sortByTypeAct = new QAction( QIcon::fromTheme( "preferences-other" ), "&Type", this ); sortByTypeAct->setCheckable( true ); connect( sortByTypeAct, SIGNAL( triggered() ), this, SLOT( sortByType() ) ); sortBySizeAct = new QAction( QIcon( ":/icons/size.png" ), "&Size", this ); sortBySizeAct->setCheckable( true ); connect( sortBySizeAct, SIGNAL( triggered() ), this, SLOT( sortBySize() ) ); sortByDateAct = new QAction( QIcon::fromTheme( "office-calendar" ), "&Date", this ); sortByDateAct->setCheckable( true ); connect( sortByDateAct, SIGNAL( triggered() ), this, SLOT( sortByDate() ) ); QActionGroup *sortGroup = new QActionGroup( this ); sortGroup->addAction( sortByNameAct ); sortGroup->addAction( sortByTypeAct ); sortGroup->addAction( sortBySizeAct ); sortGroup->addAction( sortByDateAct ); switch( ( int )Settings->value( "SortColumn" ) ) { case 0: { sortByNameAct->setChecked( true ); break; } case 1: { sortBySizeAct->setChecked( true ); break; } case 2: { sortByTypeAct->setChecked( true ); break; } case 4: { sortByDateAct->setChecked( true ); break; } } groupsAct = new QAction( QIcon::fromTheme( "view-group", QIcon( ":/icons/groups.png" ) ), "Show in &Groups", this ); groupsAct->setCheckable( true ); groupsAct->setChecked( Settings->value( "Grouping" ) ); connect( groupsAct, SIGNAL( triggered() ), this, SIGNAL( toggleGroups() ) ); // Add bookmark addBookMarkAct = new QAction( QIcon( ":/icons/bookmark.png" ), "Add &Bookmark", this ); addBookMarkAct->setShortcuts( Settings->shortcuts( "AddBookmark" ) ); connect( addBookMarkAct, SIGNAL( triggered() ), this, SLOT( addBookMark() ) ); addAction( addBookMarkAct ); /* Add to SuperStart */ addToSuperStartAct = new QAction( QIcon( ":/icons/superstart.png" ), "Add to S&uperStart", this ); addToSuperStartAct->setShortcut( tr( "Ctrl+U" ) ); connect( addToSuperStartAct, SIGNAL( triggered() ), this, SLOT( addToSuperStart() ) ); addAction( addToSuperStartAct ); updateActions(); };
bool Notepad_plus::fileReload() { BufferID buf = _pEditView->getCurrentBufferID(); return doReload(buf, buf->isDirty()); }
//============================================================================= // METHOD : SPELLcontroller::executeCommand() //============================================================================= void SPELLcontroller::executeCommand( const ExecutorCommand& cmd ) { // If a (repeatable) command is being executed, discard this one if (isCommandPending() && (cmd.id != CMD_ABORT) && (cmd.id != CMD_FINISH) && (cmd.id != CMD_INTERRUPT) && (cmd.id != CMD_PAUSE) && (cmd.id != CMD_CLOSE)) { LOG_WARN("Discarding command " + cmd.id); return; } LOG_INFO("Now executing command " + cmd.id); startCommandProcessing(); if (cmd.id == CMD_ABORT) { doAbort(); } else if (cmd.id == CMD_FINISH) { doFinish(); } else if (cmd.id == CMD_ACTION) { doUserAction(); } else if (cmd.id == CMD_STEP) { doStep( false ); } else if (cmd.id == CMD_STEP_OVER) { doStep( true ); } else if (cmd.id == CMD_RUN) { doPlay(); } else if (cmd.id == CMD_SKIP) { doSkip(); } else if (cmd.id == CMD_GOTO) { if (cmd.earg == "line") { DEBUG("[C] Processing go-to-line " + cmd.arg); try { int line = STRI(cmd.arg); doGoto( line ); } catch(...) {}; } else if (cmd.earg == "label") { DEBUG("[C] Processing go-to-label " + cmd.arg); doGoto( cmd.arg ); } else { SPELLexecutor::instance().getCIF().error("Unable to process Go-To command, no target information", LanguageConstants::SCOPE_SYS ); } } else if (cmd.id == CMD_PAUSE) { doPause(); } else if (cmd.id == CMD_INTERRUPT) { doInterrupt(); } else if (cmd.id == CMD_SCRIPT) { /** \todo determine when to override */ doScript(cmd.arg,false); } else if (cmd.id == CMD_CLOSE) { m_recover = false; m_reload = false; doClose(); } else if (cmd.id == CMD_RELOAD) { doReload(); } else if (cmd.id == CMD_RECOVER) { doRecover(); } else { LOG_ERROR("[C] UNRECOGNISED COMMAND: " + cmd.id) } m_mailbox.commandProcessed(); // The command has finished, release the dispatcher setCommandFinished(); DEBUG("[C] Command execution finished " + cmd.id); //TEMPORARILY DISABLED: it creates deadlocks. // notifyCommandToCore( cmd.id ); }