void KgpgApp::initActions() { KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(slotFileNew()), actionCollection()); KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(slotFileOpen()), actionCollection()); KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(slotFileSaveAs()), actionCollection()); KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(slotFileQuit()), actionCollection()); KStdAction::cut(TQT_TQOBJECT(this), TQT_SLOT(slotEditCut()), actionCollection()); KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(slotEditCopy()), actionCollection()); KStdAction::paste(TQT_TQOBJECT(this), TQT_SLOT(slotEditPaste()), actionCollection()); KStdAction::selectAll(TQT_TQOBJECT(this), TQT_SLOT(slotSelectAll()), actionCollection()); KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotOptions()), actionCollection(),"kgpg_config"); //KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); //KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(slotConfigureToolbars()), actionCollection()); fileSave = KStdAction::save(TQT_TQOBJECT(this), TQT_SLOT(slotFileSave()), actionCollection()); (void) new TDEAction(i18n("&Encrypt File..."), "encrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreEnc()), actionCollection(),"file_encrypt"); (void) new TDEAction(i18n("&Decrypt File..."), "decrypted", 0,TQT_TQOBJECT(this), TQT_SLOT(slotFilePreDec()), actionCollection(),"file_decrypt"); (void) new TDEAction(i18n("&Open Key Manager"), "kgpg", 0,TQT_TQOBJECT(this), TQT_SLOT(slotKeyManager()), actionCollection(),"key_manage"); editUndo = KStdAction::undo(TQT_TQOBJECT(this), TQT_SLOT(slotundo()), actionCollection()); editRedo = KStdAction::redo(TQT_TQOBJECT(this), TQT_SLOT(slotredo()), actionCollection()); //(void) new TDEAction(i18n("&Manage Keys"), "kgpg_manage", CTRL+Key_K,TQT_TQOBJECT(this), TQT_SLOT(slotManageKey()), actionCollection(),"keys_manage"); (void) new TDEAction(i18n("&Generate Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreSignFile()), actionCollection(), "sign_generate"); (void) new TDEAction(i18n("&Verify Signature..."),0, TQT_TQOBJECT(this), TQT_SLOT(slotPreVerifyFile()), actionCollection(), "sign_verify"); (void) new TDEAction(i18n("&Check MD5 Sum..."), 0,TQT_TQOBJECT(this), TQT_SLOT(slotCheckMd5()), actionCollection(), "sign_check"); KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(slotFilePrint()), actionCollection()); // comment out for now, only confusing //encodingAction=new TDEToggleAction(i18n("&Unicode (utf-8) Encoding"), 0, 0,this, TQT_SLOT(slotSetCharset()),actionCollection(),"charsets"); }
void TravelWorkbench::initActions() { BEGIN; CoaAction *action; //action = GETACTION (CoaDefaultActions::actionApplicationSettings); //QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileNewContact())); action = GETACTION (CoaDefaultActions::actionFileNew); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileNew())); action = GETACTION (CoaDefaultActions::actionFileOpen); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileOpen())); action = GETACTION (CoaDefaultActions::actionFileSave); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSave())); action = GETACTION (CoaDefaultActions::actionFileSaveAs); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSaveAs())); action = GETACTION (CoaDefaultActions::actionFileSaveAll); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileSaveAll())); action = GETACTION (CoaDefaultActions::actionFileClose); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileClose())); action = GETACTION (CoaDefaultActions::actionFileCloseAll); QObject::connect (action, SIGNAL(triggered()), this, SLOT(slotFileCloseAll())); action = 0; }
ArchiverWindow::ArchiverWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::ArchiverWindow) , m_busy(false) { ui->setupUi(this); // Set the archive model m_model = new ArchiveModel(this); ui->treeView->setModel(m_model); connect(ui->actionFileNew, SIGNAL(triggered()), this, SLOT(slotFileNew())); connect(ui->actionFileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); connect(ui->actionFileSaveAs, SIGNAL(triggered()), this, SLOT(slotFileSaveAs())); connect(ui->actionFileQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionActionAddFile, SIGNAL(triggered()), this, SLOT(slotActionAddFile())); connect(ui->actionActionAddFolder, SIGNAL(triggered()), this, SLOT(slotActionAddFolder())); connect(ui->actionActionDelete, SIGNAL(triggered()), this, SLOT(slotActionDelete())); connect(ui->actionActionExtract, SIGNAL(triggered()), this, SLOT(slotActionExtract())); connect(ui->actionHelpAbout, SIGNAL(triggered()), this, SLOT(slotHelpAbout())); }
bool kvoctrainApp::queryExit() { saveOptions(); if (!doc || !doc->isModified() ) return true; bool save = (Prefs::autoSave()); //save without asking if (!save) { int exit = KMessageBox::warningYesNoCancel(this, i18n("Vocabulary is modified.\n\nSave file before exit?\n"), kapp->makeStdCaption(""), KStdGuiItem::save(), KStdGuiItem::discard()); if (exit==KMessageBox::Yes) { save = true; // save and exit } else if (exit == KMessageBox::No) { save = false; // dont save but exit } else { return false; // continue work } } if (save) { if (!doc->URL().isEmpty()) slotFileSave(); // save and exit if (doc->isModified()) { // Error while saving or no name slotFileSaveAs(); } } return true; }
/** * Requests the closing of this MDI window. * * @param force Force closing by disabling the cancel button (for demo versions). */ bool QC_MDIWindow::slotFileClose(bool force) { RS_DEBUG->print("QC_MDIWindow::slotFileClose()"); //return immediately, if forceClosing is set if(forceClosing) return true; bool succ = true; int exit = 0; if(document && document->isModified()) { QG_ExitDialog dlg(this); dlg.setForce(force); if (document->getFilename().isEmpty()) { dlg.setText(tr("Do you really want to close the drawing?")); } else { QString fn = document->getFilename(); if (fn.length() > 50) { fn = QString("%1...%2").arg(fn.left(24)).arg(fn.right(24)); } dlg.setText(tr("Do you really want to close the file\n%1?") .arg(fn)); } dlg.setTitle(tr("Closing Drawing")); bool again; bool cancelled; do { again = false; exit = dlg.exec(); switch (exit) { case 0: // cancel succ = false; forceClosing=false; break; case 1: // leave succ = true; forceClosing=true; break; case 2: // save succ = slotFileSave(cancelled); again = !succ || cancelled; break; case 3: // save as succ = slotFileSaveAs(cancelled); again = !succ || cancelled; break; default: forceClosing=false; break; } } while (again); } else { succ = true; } return forceClosing || succ; }
void App::initMenuBar() { /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filenew.png")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fileopen.png")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filesave.png")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/exit.png")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/help.png")), "Index...", this, SLOT(slotHelpIndex()), SHIFT + Key_F1, ID_HELP_INDEX); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/Q.png")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem("About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("File", m_fileMenu); menuBar()->insertItem("Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
int BrowserMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: loadPage((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: slotHome(); break; case 2: save(); break; case 3: slotLoadProgress((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: slotUpdateStatusbar((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 5: slotUpdateWindowTitle((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 6: slotUpdateWindowTitle(); break; case 7: loadUrl((*reinterpret_cast< const QUrl(*)>(_a[1]))); break; case 8: slotPreferences(); break; case 9: slotFileNew(); break; case 10: slotFileOpen(); break; case 11: slotFilePrintPreview(); break; case 12: slotFilePrint(); break; case 13: slotPrivateBrowsing(); break; case 14: slotFileSaveAs(); break; case 15: slotEditFind(); break; case 16: slotEditFindNext(); break; case 17: slotEditFindPrevious(); break; case 18: slotShowBookmarksDialog(); break; case 19: slotAddBookmark(); break; case 20: slotViewZoomIn(); break; case 21: slotViewZoomOut(); break; case 22: slotViewResetZoom(); break; case 23: slotViewZoomTextOnly((*reinterpret_cast< bool(*)>(_a[1]))); break; case 24: slotViewToolbar(); break; case 25: slotViewBookmarksBar(); break; case 26: slotViewStatusbar(); break; case 27: slotViewPageSource(); break; case 28: slotViewFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break; case 29: slotWebSearch(); break; case 30: slotToggleInspector((*reinterpret_cast< bool(*)>(_a[1]))); break; case 31: slotAboutApplication(); break; case 32: slotDownloadManager(); break; case 33: slotSelectLineEdit(); break; case 34: slotAboutToShowBackMenu(); break; case 35: slotAboutToShowForwardMenu(); break; case 36: slotAboutToShowWindowMenu(); break; case 37: slotOpenActionUrl((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 38: slotShowWindow(); break; case 39: slotSwapFocus(); break; case 40: printRequested((*reinterpret_cast< QWebFrame*(*)>(_a[1]))); break; case 41: geometryChangeRequested((*reinterpret_cast< const QRect(*)>(_a[1]))); break; case 42: updateToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; case 43: updateBookmarksToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 44; } return _id; }
void KgpgApp::slotFileSave() { TQString filn=Docname.path(); if (filn.isEmpty()) { slotFileSaveAs(); return; } TQTextCodec*cod=TQTextCodec::codecForName (textEncoding.ascii()); // slotStatusMsg(i18n("Saving file...")); if (!checkEncoding(cod)) { KMessageBox::sorry(this,i18n("The document could not been saved, as the selected encoding cannot encode every unicode character in it.")); return; } KTempFile tmpfile; if (Docname.isLocalFile()) { TQFile f(filn); if ( !f.open( IO_WriteOnly ) ) { KMessageBox::sorry(this,i18n("The document could not be saved, please check your permissions and disk space.")); return; } TQTextStream t( &f ); t.setCodec(cod); //t.setEncoding( TQTextStream::Latin1 ); t << view->editor->text();//.utf8(); f.close(); } else { /*FIXME use following code: TQFile f( fName ); 00983 if ( !f.open( IO_ReadOnly ) ) 00984 return; 00985 TQFileInfo info ( f ); 00986 smModificationTime = new TQTime( info.lastModified().time() ); 00987 TQTextStream t(&f); 00988 t.setEncoding( TQTextStream::Latin1 ); 00989 TQString s = t.readLine(); 00990 f.close(); */ TQTextStream *stream = tmpfile.textStream(); stream->setCodec(cod); *stream << view->editor->text();//.utf8(); tmpfile.close(); if(!TDEIO::NetAccess::upload(tmpfile.name(), Docname,this)) { KMessageBox::sorry(this,i18n("The document could not be saved, please check your permissions and disk space.")); tmpfile.unlink(); return; } tmpfile.unlink(); } fileSave->setEnabled(false); setCaption(Docname.fileName(),false); }
void KstApp::slotFileSave() { if (doc->getTitle() == "Untitled") { slotFileSaveAs(); } else { slotUpdateStatusMsg(i18n("Saving file...")); doc->saveDocument(doc->getAbsFilePath()); slotUpdateStatusMsg(i18n("Ready")); } }
QFile::FileError App::slotFileSave() { QFile::FileError error; /* Attempt to save with the existing name. Fall back to Save As. */ if (m_doc->fileName().isEmpty() == true) error = slotFileSaveAs(); else error = m_doc->saveXML(m_doc->fileName()); handleFileError(error); return error; }
void KVerbosApp::initActions() { fileNewWindow = new KAction(i18n("New &Window"), "window_new.png", 0, this, SLOT(slotFileNewWindow()), actionCollection(),"file_new_window"); fileNew = KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection()); fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); fileOpenRecent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)), actionCollection()); fileOpenStandard = new KAction(i18n("Open &Standard Verb File"), "fileopen.png", 0, this, SLOT(slotFileOpenStandard()), actionCollection(),"file_open_standard"); fileSave = KStdAction::save(this, SLOT(slotFileSave()), actionCollection()); fileSaveAs = KStdAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); fileClose = KStdAction::close(this, SLOT(slotFileClose()), actionCollection()); filePrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection()); fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection()); editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection()); editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection()); editPaste = KStdAction::paste(this, SLOT(slotEditPaste()), actionCollection()); editErfassen = new KAction(i18n("E&nter New Verb..."), 0, 0, this, SLOT(slotEditErfassen()), actionCollection(),"edit_erfassen"); editBearbeiten = new KAction(i18n("&Edit Verb List..."), 0, 0, this, SLOT(slotEditBearbeiten()), actionCollection(), "edit_bearbeiten"); settingOptions = new KAction(i18n("&Configure KVerbos..."), 0, 0, this, SLOT(slotSettingsOptions()), actionCollection(), "settings_options"); userUsername = new KAction(i18n("&Username..."), 0, 0, this, SLOT(slotSettingsUsername()), actionCollection(), "user_username"); userResults = new KAction(i18n("&Results"), 0, 0, this, SLOT(slotUserResults()), actionCollection(), "user_results"); fileNewWindow->setToolTip(i18n("Opens a new application window")); fileOpenStandard->setToolTip(i18n("Opens the standard KVerbos verb file")); fileNew->setToolTip(i18n("Creates a new document")); fileOpen->setToolTip(i18n("Opens an existing document")); fileOpenRecent->setToolTip(i18n("Opens a recently used file")); fileSave->setToolTip(i18n("Saves the actual document")); fileSaveAs->setToolTip(i18n("Saves the actual document as...")); fileClose->setToolTip(i18n("Closes the actual document")); filePrint ->setToolTip(i18n("Prints out the actual document")); fileQuit->setToolTip(i18n("Quits the application")); editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard")); editCopy->setToolTip(i18n("Copies the selected section to the clipboard")); editPaste->setToolTip(i18n("Pastes the clipboard contents to actual position")); editErfassen->setToolTip(i18n("Add new verbs.")); editBearbeiten->setToolTip(i18n("Edit the list of verbs.")); settingOptions->setToolTip(i18n("Change some options of the program")); userUsername->setToolTip(i18n("Enter your name as the username")); userResults->setToolTip(i18n("These are your latest results.")); // icons editBearbeiten->setIcon("edit.png"); editErfassen->setIcon("editclear.png"); settingOptions->setIcon("configure.png"); userUsername->setIcon("kverbosuser.png"); userResults->setIcon("kverbosuser.png"); setupGUI(); }
void KVerbosApp::slotFileSave() { slotStatusMsg(i18n("Saving file...")); if (doc->URL().fileName() == i18n("Untitled")) { // Hier liegt ein Fall vor, der zu "Save as ... " gehört. slotFileSaveAs(); } else { doc->saveDocument(doc->URL()); }; slotStatusMsg(i18n("Ready.")); }
// // Save current workspace // void App::slotFileSave() { if (m_doc->fileName().isEmpty()) { slotFileSaveAs(); } else { if (m_doc->saveWorkspace() == false) { QMessageBox::warning(this, KApplicationNameShort, "Unable to save file!"); } } }
/** * Saves the current file. * * @return true if the file was saved successfully. * false if the file could not be saved or the document * is invalid. */ bool QC_MDIWindow::slotFileSave(bool &cancelled) { RS_DEBUG->print("QC_MDIWindow::slotFileSave()"); bool ret = false; cancelled = false; if (document!=NULL) { if (document->getFilename().isEmpty()) { ret = slotFileSaveAs(cancelled); } else { QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); ret = document->save(); QApplication::restoreOverrideCursor(); } } return ret; }
void JuffEd::initActions() { CommandStorageInt* st = Juff::Utils::commandStorage(); st->addAction(FILE_NEW, tr("&New"), this, SLOT(slotFileNew())); st->addAction(FILE_OPEN, tr("&Open"), this, SLOT(slotFileOpen())); st->addAction(FILE_SAVE, tr("&Save"), this, SLOT(slotFileSave())); st->addAction(FILE_SAVE_AS, tr("Save as"), this, SLOT(slotFileSaveAs())); st->addAction(FILE_SAVE_ALL, tr("Save all"), this, SLOT(slotFileSaveAll())); st->addAction(FILE_RELOAD, tr("&Reload"), this, SLOT(slotFileReload())); st->addAction(FILE_RENAME, tr("Rename"), this, SLOT(slotFileRename())); st->addAction(FILE_CLOSE, tr("Close"), this, SLOT(slotFileClose())); st->addAction(FILE_CLOSE_ALL, tr("Close All"), this, SLOT(slotFileCloseAll())); st->addAction(FILE_PRINT, tr("&Print"), this, SLOT(slotFilePrint())); st->addAction(FILE_EXIT, tr("Exit"), this, SLOT(slotFileExit())); st->addAction(SESSION_NEW, tr("New session"), this, SLOT(slotSessionNew())); st->addAction(SESSION_OPEN, tr("Open session"), this, SLOT(slotSessionOpen())); st->addAction(SESSION_SAVE, tr("Save session as..."), this, SLOT(slotSessionSaveAs())); st->addAction(EDIT_UNDO, tr("Undo"), this, SLOT(slotEditUndo())); st->addAction(EDIT_REDO, tr("Redo"), this, SLOT(slotEditRedo())); st->addAction(EDIT_CUT, tr("Cut"), this, SLOT(slotEditCut())); st->addAction(EDIT_COPY, tr("Copy"), this, SLOT(slotEditCopy())); st->addAction(EDIT_PASTE, tr("Paste"), this, SLOT(slotEditPaste())); st->addAction(SEARCH_FIND, tr("Find"), this, SLOT(slotFind())); st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext())); st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev())); st->addAction(SEARCH_REPLACE, tr("Replace"), this, SLOT(slotReplace())); st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine())); st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile())); st->addAction(VIEW_ZOOM_IN, tr("Zoom In"), this, SLOT(slotZoomIn())); st->addAction(VIEW_ZOOM_OUT, tr("Zoom Out"), this, SLOT(slotZoomOut())); st->addAction(VIEW_ZOOM_100, tr("Zoom 100%"), this, SLOT(slotZoom100())); st->addAction(VIEW_FULLSCREEN, tr("Fullscreen"), this, SLOT(slotFullscreen())); st->addAction(TOOLS_SETTINGS, tr("Settings"), this, SLOT(slotSettings())); st->addAction(HELP_ABOUT, tr("About"), mw_, SLOT(slotAbout())); st->addAction(HELP_ABOUT_QT, tr("About Qt"), mw_, SLOT(slotAboutQt())); }
void App::slotFileSave() { statusBar()->message("Saving current workspace..."); if (m_doc->workspaceFileName().isEmpty()) { slotFileSaveAs(); } else { if (m_doc->saveWorkspace() == false) { statusBar()->message("Save failed", 2000); QMessageBox::warning(this, KApplicationNameShort, "An error occurred while attempting to save configuration.\nData may be lost."); } else { statusBar()->message("Save successful", 2000); } } statusBar()->message(IDS_STATUS_DEFAULT); }
int App::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: clipboardChanged(); break; case 1: slotFileNew(); break; case 2: slotFileOpen(); break; case 3: slotFileSave(); break; case 4: slotFileSaveAs(); break; case 5: slotFileQuit(); break; case 6: slotHelpIndex(); break; case 7: slotHelpAbout(); break; case 8: slotHelpAboutQt(); break; default: ; } _id -= 9; } return _id; }
/** * Saves the current file. * * @param isAutoSave true if this is an "autosave" operation. * false if this is "Save" operation requested * by the user. * @return true if the file was saved successfully. * false if the file could not be saved or the document * is invalid. */ bool QC_MDIWindow::slotFileSave(bool &cancelled, bool isAutoSave) { RS_DEBUG->print("QC_MDIWindow::slotFileSave()"); bool ret = false; cancelled = false; if (document!=NULL) { if (isAutoSave) { // Autosave filename is always supposed to be present. // Autosave does not change the cursor. ret = document->save(true); } else { if (document->getFilename().isEmpty()) { ret = slotFileSaveAs(cancelled); } else { QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); ret = document->save(); QApplication::restoreOverrideCursor(); } } } return ret; }
void KstApp::initActions() { fileNewWindow = new KAction(i18n("New &Window"), 0, 0, this, SLOT(slotFileNewWindow()), actionCollection(),"file_new_window"); fileOpenNew = KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection()); fileOpenNew->setWhatsThis(i18n("Open Kst plot file.")); fileSave = KStdAction::save( this, SLOT(slotFileSave()), actionCollection()); fileSave->setWhatsThis(i18n("Save to current Kst plot file.")); fileSaveAs = KStdAction::saveAs( this, SLOT(slotFileSaveAs()), actionCollection()); fileSaveAs->setWhatsThis(i18n("Save to new Kst plot file.")); fileClose = KStdAction::close( this, SLOT(slotFileClose()), actionCollection()); fileClose->setWhatsThis(i18n("Close Kst.")); fileQuit = KStdAction::quit( this, SLOT(slotFileClose()), actionCollection()); fileQuit->setWhatsThis(i18n("Quit Kst.")); fileKeyBindings = KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection()); fileKeyBindings->setWhatsThis(i18n("Bring up a dialog box\n" "to configure shortcuts.")); filePreferences = KStdAction::preferences(this, SLOT(slotPreferences()), actionCollection()); filePreferences->setWhatsThis(i18n("Bring up a dialog box\n" "to configure Kst settings.")); fileCopy = KStdAction::copy(this, SLOT(slotCopy()), actionCollection()); fileCopy->setWhatsThis(i18n("Copy cursor position to the clipboard.")); /************/ filePrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection()); filePrint->setToolTip(i18n("Print")); filePrint->setWhatsThis(i18n("Print current display")); /************/ ToolBarAction = KStdAction::showToolbar(this, SLOT(slotViewToolBar()), actionCollection()); ToolBarAction->setWhatsThis(i18n("Toggle Toolbar")); connect(ToolBarAction, SIGNAL(activated()), this, SLOT(setSettingsDirty())); /************/ StatusBarAction = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection()); StatusBarAction->setWhatsThis(i18n("Toggle Statusbar")); connect(StatusBarAction, SIGNAL(activated()), this, SLOT(setSettingsDirty())); /************/ KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); /************/ recent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL &)), actionCollection()); recent->setWhatsThis(i18n("Open a recently used Kst plot.")); /************/ PauseAction = new KToggleAction(i18n("P&ause"),"player_pause",0, actionCollection(), "pause_action"); PauseAction->setToolTip(i18n("Pause")); PauseAction->setWhatsThis(i18n("When paused, new data will not be read.")); /************/ TiedZoomAction = new KAction(i18n("&Tied Zoom"),"kst_zoomtie",0, view, SLOT(toggleTiedZoom()), actionCollection(), "zoomtie_action"); TiedZoomAction->setToolTip(i18n("Toggle tied zoom")); TiedZoomAction->setWhatsThis(i18n("Apply zoom actions to all plots\n" "(not just the active one).")); /************/ XYZoomAction = new KRadioAction(i18n("XY Mouse &Zoom"), "kst_zoomxy",0, actionCollection(), "zoomxy_action"); XYZoomAction->setExclusiveGroup("zoom"); XYZoomAction->setToolTip(i18n("XY mouse zoom")); XYZoomAction->setWhatsThis(i18n("XY zoom: mouse zooming effects\n" "both X and Y axis")); XYZoomAction->setChecked(true); /************/ XZoomAction = new KRadioAction(i18n("&X Mouse Zoom"), "kst_zoomx",0, actionCollection(), "zoomx_action"); XZoomAction->setExclusiveGroup("zoom"); XZoomAction->setToolTip(i18n("X mouse zoom")); XZoomAction->setWhatsThis(i18n("X zoom: Mouse zooming effects only the\n" "X axis (CTRL-mouse also does this)")); /************/ YZoomAction = new KRadioAction(i18n("&Y Mouse Zoom"), "kst_zoomy",0, actionCollection(), "zoomy_action"); YZoomAction->setExclusiveGroup("zoom"); YZoomAction->setToolTip(i18n("Y mouse zoom")); YZoomAction->setWhatsThis(i18n("Y zoom: Mouse zooming effects only the\n" "Y axis (SHIFT-mouse also does this)")); /************/ TextAction = new KRadioAction(i18n("&Label Editor"), "text",0, actionCollection(), "label_action"); TextAction->setExclusiveGroup("zoom"); TextAction->setToolTip(i18n("Label Editor")); TextAction->setWhatsThis(i18n("Use the mouse to create and edit labels.")); /************/ FilterDialogAction = new KAction(i18n("Edit &Filters"), 0, 0, this, SLOT(showFilterListEditor()), actionCollection(), "filterdialog_action"); FilterDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit filters.")); /************/ PlotDialogAction = new KAction(i18n("Edit &Plots"), "kst_editplots", 0, this, SLOT(showPlotDialog()), actionCollection(), "plotdialog_action"); PlotDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit plot settings.")); /************/ DataManagerAction = new KAction(i18n("&Data Manager"), "kst_datamanager", 0, dataManager, SLOT(show_I()), actionCollection(), "datamanager_action"); DataManagerAction->setWhatsThis(i18n("Bring up a dialog box\n" "to manage data.")); /************/ VectorDialogAction = new KAction(i18n("Edit &Vectors"), 0, 0, KstVectorDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "vectordialog_action"); VectorDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit or create vectors.")); /************/ CurveDialogAction = new KAction(i18n("Edit &Curves"), 0, 0, KstCurveDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "curvedialog_action"); CurveDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit or create curves.")); /************/ EqDialogAction = new KAction(i18n("Edit &Equations"), 0, 0, KstEqDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "eqdialog_action"); EqDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit or create equations.")); /************/ HsDialogAction = new KAction(i18n("Edit &Histograms"), 0, 0, KstHsDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "hsdialog_action"); HsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit or create histograms.")); /************/ PsdDialogAction = new KAction(i18n("Edit Power &Spectra"), 0, 0, KstPsdDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "psddialog_action"); PsdDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit or create power spectra.")); /************/ PluginDialogAction = new KAction(i18n("Edit &Plugins"), 0, 0, KstPluginDialogI::globalInstance(), SLOT(show_I()), actionCollection(), "plugindialog_action"); PluginDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to use plugins.")); /************/ ChangeFileDialogAction = new KAction(i18n("Change Data &File"), "kst_changefile", 0, this, SLOT(showChangeFileDialog()), actionCollection(), "changefiledialog_action"); ChangeFileDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to change input files.")); /************/ ViewScalarsDialogAction = new KAction(i18n("View &Scalars"), 0, 0, this, SLOT(showViewScalarsDialog()), actionCollection(), "viewscalarsdialog_action"); ViewScalarsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to view scalar values.")); /************/ ViewVectorsDialogAction = new KAction(i18n("View Vec&tors"), 0, 0, this, SLOT(showViewVectorsDialog()), actionCollection(), "viewvectorsdialog_action"); ViewVectorsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to view vector values.")); /************/ ChangeNptsDialogAction = new KAction(i18n("Change Data Sample &Ranges"), "kst_changenpts", 0, this, SLOT(showChangeNptsDialog()), actionCollection(), "changenptsdialog_action"); ChangeNptsDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to change data sample ranges.")); /************/ QuickCurvesDialogAction = new KAction(i18n("Quickly Create New Curve"), "kst_quickcurves", 0, this, SLOT(showQuickCurvesDialog()), actionCollection(), "quickcurvesdialog_action"); QuickCurvesDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to create a data curve\n" "and put it in a plot.")); /************/ QuickPSDDialogAction = new KAction(i18n("Quickly Create New PSD"), "kst_quickpsd", 0, this, SLOT(showQuickPSDDialog()), actionCollection(), "quickpsddialog_action"); QuickPSDDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to create a PSD\n" "and put it in a plot.")); /************/ EventMonitorAction = new KAction(i18n("Edit Event &Monitoring"), 0, 0, KstEventMonitorI::globalInstance(), SLOT(show_I()), actionCollection(), "eventmonitor_action"); EventMonitorAction->setWhatsThis(i18n("Bring up a dialog box\n" "to edit event monitoring.")); /************/ GraphFileDialogAction = new KAction(i18n("Export to Graphics File..."), "kst_graphfile", 0, this, SLOT(showGraphFileDialog()), actionCollection(), "graphfiledialog_action"); GraphFileDialogAction->setWhatsThis(i18n("Bring up a dialog box\n" "to export the plot as a\n" "graphics file.")); /************/ _vectorSaveAction = new KAction(i18n("Save Vectors to Disk..."), 0, 0, vectorSaveDialog, SLOT(show()), actionCollection(), "vectorsavedialog_action"); _vectorSaveAction->setWhatsThis(i18n("Bring up a dialog box\n" "to save vectors to text files.")); /************/ SamplesDownAction = new KAction(i18n("&Back 1 Screen"), "kst_back", KAccel::stringToKey("Ctrl+Left"), this, SLOT(samplesDown()), actionCollection(), "samplesdown_action"); //SamplesDownAction->setToolTip(i18n("Back")); SamplesDownAction->setWhatsThis(i18n("Reduce the starting frame by\n" "the current number of frames.")); /************/ SamplesUpAction = new KAction(i18n("&Advance 1 Screen"), "kst_advance", KAccel::stringToKey("Ctrl+Right"), this, SLOT(samplesUp()), actionCollection(), "samplesup_action"); //SamplesUpAction->setToolTip(i18n("Advance")); SamplesUpAction->setWhatsThis(i18n("Increase the starting frame by\n" "the current number of frames.")); /************/ SamplesFromEndAction = new KAction(i18n("Read From &End"), "1rightarrow", KAccel::stringToKey("Shift+Ctrl+Right"), this, SLOT(samplesEnd()), actionCollection(), "samplesend_action"); SamplesFromEndAction->setToolTip(i18n("Read from end")); SamplesFromEndAction->setWhatsThis(i18n("Read current data from end of file.")); /************/ PluginManagerAction = new KAction(i18n("&Plugins..."), 0, 0, this, SLOT(showPluginManager()), actionCollection(), "pluginmanager_action"); PluginManagerAction->setWhatsThis(i18n("Bring up a dialog box\n" "to manage plugins.")); /************/ ExtensionManagerAction = new KAction(i18n("&Extensions..."), 0, 0, this, SLOT(showExtensionManager()), actionCollection(), "extensionmanager_action"); ExtensionManagerAction->setWhatsThis(i18n("Bring up a dialog box\n" "to manage extensions.")); /************/ DataWizardAction = new KAction(i18n("Data &Wizard..."), "kst_datawizard", 0, this, SLOT(showDataWizard()), actionCollection(), "datawizard_action"); DataWizardAction->setWhatsThis(i18n("Bring up a wizard\n" "to easily load data.")); /************/ DebugDialogAction = new KAction(i18n("Debug Kst..."), 0, 0, this, SLOT(showDebugDialog()), actionCollection(), "debug_action"); DebugDialogAction->setWhatsThis(i18n("Bring up a dialog\n" "to display debugging information.")); /************/ DataMode = new KToggleAction(i18n("Data Mode"), "kst_datamode", 0, this, SLOT(toggleDataMode()), actionCollection(), "datamode_action"); DataMode->setWhatsThis(i18n("Toggle between cursor mode and data mode.")); /************/ _reloadAction = new KAction(i18n("Reload"), "reload", Key_F5, this, SLOT(reload()), actionCollection(), "reload"); _reloadAction->setWhatsThis(i18n("Reload the data from file.")); createGUI(); }
void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/info.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // View Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_D, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_G, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/deviceclasseditor.xpm")), "Device Class Editor", this, SLOT(slotViewDeviceClassEditor()), CTRL + Key_E, ID_VIEW_DEVICE_CLASS_EDITOR); m_toolsMenu->insertItem(QPixmap(dir + QString("/function.xpm")), "Function Tree", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_C, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshToolsMenu())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
QFile::FileError App::slotFileOpen() { QString fileName; /* Check that the user is aware of losing previous changes */ if (doc()->isModified() == true) { QString msg = tr("Do you wish to save the current workspace?\n" "Otherwise you will lose changes."); int result = QMessageBox::warning(this, "Open Workspace", msg, QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); if (result == QMessageBox::Yes) { /* Save first, but don't proceed unless it succeeded. */ QFile::FileError error = slotFileSaveAs(); if (handleFileError(error) == false) return error; } else if (result == QMessageBox::Cancel) { /* Second thoughts... Cancel loading. */ return QFile::NoError; } } /* Create a file open dialog */ QFileDialog dialog(this); dialog.setWindowTitle(tr("Open Workspace")); dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.selectFile(m_doc->fileName()); /* Append file filters to the dialog */ QStringList filters; filters << QString("Workspaces (*%1)").arg(KExtWorkspace); filters << QString("All Files (*)"); dialog.setNameFilters(filters); /* Append useful URLs to the dialog */ QList <QUrl> sidebar; sidebar.append(QUrl::fromLocalFile(QDir::homePath())); sidebar.append(QUrl::fromLocalFile(QDir::rootPath())); dialog.setSidebarUrls(sidebar); /* Get file name */ if (dialog.exec() != QDialog::Accepted) return QFile::NoError; fileName = dialog.selectedFiles().first(); if (fileName.isEmpty() == true) return QFile::NoError; /* Clear existing document data */ newDocument(); /* Load the file */ QFile::FileError error = doc()->loadXML(fileName, m_fixtureDefCache); if (handleFileError(error) == true) doc()->resetModified(); /* Update these in any case, since they are at least emptied now as a result of calling newDocument() a few lines ago. */ if (FunctionManager::instance() != NULL) FunctionManager::instance()->updateTree(); if (OutputManager::instance() != NULL) InputManager::instance()->updateTree(); if (InputManager::instance() != NULL) InputManager::instance()->updateTree(); return error; }
void App::initMenuBar() { /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // Edit Menu m_editMenu = new QPopupMenu(); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/add.xpm")), "Add &Channel...", this, SLOT(slotEmpty()), CTRL+Key_C, ID_EDIT_ADD_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/remove.xpm")), "&Remove Channel", this, SLOT(slotEmpty()), CTRL+Key_R, ID_EDIT_REMOVE_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/edit.xpm")), "Edit C&hannel...", this, SLOT(slotEmpty()), CTRL+Key_H, ID_EDIT_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/up.xpm")), "Raise Channel", this, SLOT(slotEmpty()), CTRL+Key_Up, ID_EDIT_RAISE_CHANNEL); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/down.xpm")), "Lower Channel", this, SLOT(slotEmpty()), CTRL+Key_Down, ID_EDIT_LOWER_CHANNEL); m_editMenu->insertSeparator(); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/add.xpm")), "&Add Capability...", this, SLOT(slotEmpty()), CTRL+Key_A, ID_EDIT_ADD_CAPABILITY); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/remove.xpm")), "R&emove Capability", this, SLOT(slotEmpty()), CTRL+Key_E, ID_EDIT_REMOVE_CAPABILITY); m_editMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/edit.xpm")), "Ed&it Capability...", this, SLOT(slotEmpty()), CTRL+Key_I, ID_EDIT_CAPABILITY); connect(m_editMenu, SIGNAL(activated(int)), this, SLOT(slotEditMenuActivated(int))); connect(m_editMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshEditMenu())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/help.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("File", m_fileMenu); menuBar()->insertItem("Edit", m_editMenu); menuBar()->insertItem("Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
// // Menu bar // void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/settings.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); connect(m_fileMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Tools Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_M, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_V, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/chaser.png")), "Function Manager", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertItem(QPixmap(dir + QString("/bus.xpm")), "Bus Properties", this, SLOT(slotViewBusProperties()), CTRL + Key_B, ID_VIEW_BUS_PROPERTIES); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_P, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); //////////////////////////////////////////////////////////////////// // Mode menu m_modeMenu = new QPopupMenu(); m_modeMenu->setCheckable(true); m_modeMenu->insertItem(QPixmap(dir + QString("/unlocked.xpm")), "Design", this, SLOT(slotSetDesignMode()), CTRL + Key_D, ID_FUNCTIONS_MODE_DESIGN); m_modeMenu->insertItem(QPixmap(dir + QString("/locked.xpm")), "Operate", this, SLOT(slotSetOperateMode()), CTRL + Key_R, ID_FUNCTIONS_MODE_OPERATE); connect(m_modeMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); connect(m_windowMenu, SIGNAL(activated(int)), this, SLOT(slotWindowMenuCallback(int))); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->setCheckable(true); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "Index...", this, SLOT(slotHelpIndex()), SHIFT + Key_F1, ID_HELP_INDEX); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("/Q.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("")), "Show Tooltips", this, SLOT(slotHelpTooltips()), 0, ID_HELP_TOOLTIPS); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); m_toolsMenu->insertItem("&Mode", m_modeMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
void Knmap::createMenu( ) { KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( )), actionCollection( )); KStdAction::keyBindings( this, SLOT( slotConfigureShortcuts( )), actionCollection( )); KStdAction::quit( kapp, SLOT( quit( )), actionCollection( )); m_fileSaveAction = KStdAction::save( m_mainWidget, SLOT( slotFileSave( )), actionCollection( )); m_fileSaveAsAction = KStdAction::saveAs( m_mainWidget, SLOT( slotFileSaveAs( )), actionCollection( )); m_settingsManAction = new KAction( i18n( "&Use local man page" ), "localman.png", 0, m_mainWidget, SLOT( slotSwitchManPages( )), actionCollection( ), "settings_local" ); m_useTargetHostAction = new KToggleAction( i18n( "Use target host name" ), NULL, 0, m_mainWidget, SLOT( slotUseTargetHost( )), actionCollection( ), "scan_use" ); m_wrapTextAction = new KToggleAction( i18n( "Wrap text" ), NULL, 0, m_mainWidget, SLOT( slotWrapText( )), actionCollection( ), "settings_wrap_text" ); new KAction( i18n( "Close scan" ), "scanclose", CTRL+Key_W, m_mainWidget, SLOT( slotScanClose( )), actionCollection( ), "scan_close" ); new KAction( i18n( "Copy profile..." ), "profilecopy", 0, m_mainWidget, SLOT( slotProfileCopy( )), actionCollection( ), "profile_copy" ); new KAction( i18n( "Delete profile..." ), "profiledelete", 0, m_mainWidget, SLOT( slotProfileDelete( )), actionCollection( ), "profile_delete" ); new KAction( i18n( "Display nmap man page" ), "manpage", 0, m_mainWidget, SLOT( slotShowManPage( )), actionCollection( ), "help_man_page" ); new KAction( i18n( "Duplicate scan" ), "scanduplicate", CTRL+Key_C, m_mainWidget, SLOT( slotScanDuplicate( )), actionCollection( ), "scan_duplicate" ); new KAction( i18n( "Load profile..." ), "profileload", 0, m_mainWidget, SLOT( slotProfileLoad( )), actionCollection( ), "profile_load" ); new KAction( i18n( "man page stylesheet..." ), "manstylesheet", 0, m_mainWidget, SLOT( slotSetStylesheet( )), actionCollection( ), "settings_stylesheet" ); new KAction( i18n( "New scan..." ), "scannew", CTRL+Key_N, m_mainWidget, SLOT( slotScanNew( )), actionCollection( ), "scan_new" ); new KAction( i18n( "Rename profile..." ), "profilerename", 0, m_mainWidget, SLOT( slotProfileRename( )), actionCollection( ), "profile_rename" ); new KAction( i18n( "Rename scan..." ), "scanrename", Key_F2, m_mainWidget, SLOT( slotScanRename( )), actionCollection( ), "scan_rename" ); new KAction( i18n( "Save profile..." ), "profilesave", 0, m_mainWidget, SLOT( slotProfileSave( )), actionCollection( ), "profile_save" ); new KAction( i18n( "Save profile as..." ), "profilesaveas", 0, m_mainWidget, SLOT( slotProfileSaveAs( )), actionCollection( ), "profile_save_as" ); new KAction( i18n( "Zoom custom" ), "zoomcustom", 0, m_mainWidget, SLOT( slotZoomCustom( )), actionCollection( ), "settings_zoom_custom" ); new KAction( i18n( "Zoom in" ), "zoomin", 0, m_mainWidget, SLOT( slotZoomIn( )), actionCollection( ), "settings_zoom_in" ); new KAction( i18n( "Zoom out" ), "zoomout", 0, m_mainWidget, SLOT( slotZoomOut( )), actionCollection( ), "settings_zoom_out" ); m_fileSaveAction->setEnabled( false ); m_fileSaveAsAction->setEnabled( false ); m_wrapTextAction->setChecked( m_mainWidget->wrapText( )); createStandardStatusBarAction( ); setStandardToolBarMenuEnabled( true ); #ifdef _DEBUG createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" ); #else createGUI( ); #endif }
void PMShell::setupActions( ) { // m_helpMenu = new KHelpMenu( this, PMFactory::aboutData( ), true, // actionCollection( ) ); KStdAction::openNew( this, SLOT( slotFileNew( ) ), actionCollection( ) ); KStdAction::open( this, SLOT( slotFileOpen( ) ), actionCollection( ) ); m_pRecent = KStdAction::openRecent( this, SLOT( slotOpenRecent( const KURL& ) ), actionCollection( ) ); KStdAction::save( this, SLOT( slotFileSave( ) ), actionCollection( ) ); KStdAction::saveAs( this, SLOT( slotFileSaveAs( ) ), actionCollection( ) ); KStdAction::revert( this, SLOT( slotFileRevert( ) ), actionCollection( ) ); KStdAction::print( this, SLOT( slotFilePrint( ) ), actionCollection( ) ); KStdAction::close( this, SLOT( slotFileClose( ) ), actionCollection( ) ); KStdAction::quit( this, SLOT( close( ) ), actionCollection( ) ); m_pPathAction = new KToggleAction( i18n( "Show &Path" ), 0, this, SLOT( slotShowPath( ) ), actionCollection( ), "options_show_path" ); m_pPathAction->setCheckedState(i18n("Hide &Path")); m_pStatusbarAction = KStdAction::showStatusbar( this, SLOT( slotShowStatusbar( ) ), actionCollection( ) ); KStdAction::saveOptions( this, SLOT( saveOptions( ) ), actionCollection( ) ); KStdAction::keyBindings( this, SLOT( slotConfigureKeys( ) ), actionCollection( ) ); KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( ) ), actionCollection( ) ); KStdAction::preferences( this, SLOT( slotSettings( ) ), actionCollection( ) ); m_pNewTopViewAction = new KAction( i18n( "New Top View" ), 0, this, SLOT( slotNewTopView( ) ), actionCollection( ), "view_new_topview" ); m_pNewBottomViewAction = new KAction( i18n( "New Bottom View" ), 0, this, SLOT( slotNewBottomView( ) ), actionCollection( ), "view_new_bottomview" ); m_pNewLeftViewAction = new KAction( i18n( "New Left View" ), 0, this, SLOT( slotNewLeftView( ) ), actionCollection( ), "view_new_leftview" ); m_pNewRightViewAction = new KAction( i18n( "New Right View" ), 0, this, SLOT( slotNewRightView( ) ), actionCollection( ), "view_new_rightview" ); m_pNewFrontViewAction = new KAction( i18n( "New Front View" ), 0, this, SLOT( slotNewFrontView( ) ), actionCollection( ), "view_new_frontview" ); m_pNewBackViewAction = new KAction( i18n( "New Back View" ), 0, this, SLOT( slotNewBackView( ) ), actionCollection( ), "view_new_back_view" ); m_pNewCameraViewAction = new KAction( i18n( "New Camera View" ), 0, this, SLOT( slotNewCameraView( ) ), actionCollection( ), "view_new_cameraview" ); m_pNewTreeViewAction = new KAction( i18n( "New Object Tree" ), 0, this, SLOT( slotNewTreeView( ) ), actionCollection( ), "view_new_treeview" ); m_pNewDialogViewAction = new KAction( i18n( "New Properties View" ), 0, this, SLOT( slotNewDialogView( ) ), actionCollection( ), "view_new_dialogview" ); #ifdef KPM_WITH_OBJECT_LIBRARY m_pNewLibraryBrowserAction = new KAction( i18n( "New Library Browser" ), 0, this, SLOT( slotNewLibraryBrowserView( ) ), actionCollection( ), "view_new_librarybrowser" ); #endif // Creating the view layouts menu m_pViewLayoutsAction = new KActionMenu( i18n( "View Layouts" ), actionCollection( ), "view_layouts_menu" ); KPopupMenu* menu = m_pViewLayoutsAction->popupMenu( ); connect( menu, SIGNAL( aboutToShow( ) ), SLOT( slotViewsMenuAboutToShow( ) ) ); PMViewLayoutManager::theManager( )->fillPopupMenu( menu ); connect( menu, SIGNAL( activated( int ) ), SLOT( slotSelectedLayout( int ) ) ); m_pSaveViewLayoutAction = new KAction( i18n( "Save View Layout..." ), 0, this, SLOT( slotSaveViewLayout( ) ), actionCollection( ), "save_view_layout" ); }
QFile::FileError App::slotFileOpen() { QString fn; /* Check that the user is aware of losing previous changes */ if (m_doc->isModified() == true) { QString msg(tr("Do you wish to save the current workspace?\n" \ "Changes will be lost if you don't save them.")); int result = QMessageBox::warning(this, tr("Open Workspace"), msg, QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel); if (result == QMessageBox::Yes) { /* Save first, but don't proceed unless it succeeded. */ QFile::FileError error = slotFileSaveAs(); if (handleFileError(error) == false) return error; } else if (result == QMessageBox::Cancel) { /* Second thoughts... Cancel loading. */ return QFile::NoError; } } /* Create a file open dialog */ QFileDialog dialog(this); dialog.setWindowTitle(tr("Open Workspace")); dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.selectFile(fileName()); /* Append file filters to the dialog */ QStringList filters; filters << tr("Workspaces (*%1)").arg(KExtWorkspace); #ifdef WIN32 filters << tr("All Files (*.*)"); #else filters << tr("All Files (*)"); #endif dialog.setNameFilters(filters); /* Append useful URLs to the dialog */ QList <QUrl> sidebar; sidebar.append(QUrl::fromLocalFile(QDir::homePath())); sidebar.append(QUrl::fromLocalFile(QDir::rootPath())); dialog.setSidebarUrls(sidebar); /* Get file name */ if (dialog.exec() != QDialog::Accepted) return QFile::NoError; fn = dialog.selectedFiles().first(); if (fn.isEmpty() == true) return QFile::NoError; /* Clear existing document data */ clearDocument(); /* Set the workspace path before loading the new XML. In this way local files can be loaded even if the workspace file has been moved */ m_doc->setWorkspacePath(QFileInfo(fn).absolutePath()); /* Load the file */ QFile::FileError error = loadXML(fn); if (handleFileError(error) == true) m_doc->resetModified(); /* Update these in any case, since they are at least emptied now as a result of calling clearDocument() a few lines ago. */ if (FunctionManager::instance() != NULL) FunctionManager::instance()->updateTree(); if (FixtureManager::instance() != NULL) FixtureManager::instance()->updateView(); if (InputOutputManager::instance() != NULL) InputOutputManager::instance()->updateTree(); return error; }