void RecentFile::selectRecentFile(const QString &filePath) { QByteArray securityTokenData; moveToFront(filePath); securityTokenData = d->securityTokenData.first(); SecurityToken *securityToken = SecurityToken::create(securityTokenData); emit recentFileSelected(filePath, securityToken); securityToken->release(); securityToken = nullptr; }
void ndManager::setupActions() { //File Menu QMenu *fileMenu = menuBar()->addMenu(tr("&File")); mNewAction = fileMenu->addAction(tr("&New...")); mNewAction->setIcon(QPixmap(":/shared-icons/document-new")); mNewAction->setShortcut(QKeySequence::New); connect(mNewAction, SIGNAL(triggered()), this, SLOT(slotNewFile())); mOpenAction = fileMenu->addAction(tr("&Open...")); mOpenAction->setIcon(QPixmap(":/shared-icons/document-open")); mOpenAction->setShortcut(QKeySequence::Open); connect(mOpenAction, SIGNAL(triggered()), this, SLOT(slotFileOpen())); mFileOpenRecent = new QRecentFileAction(this); QSettings settings; mFileOpenRecent->setRecentFiles(settings.value(QLatin1String("Recent Files"),QStringList()).toStringList()); fileMenu->addAction(mFileOpenRecent); connect(mFileOpenRecent, SIGNAL(recentFileSelected(QString)), this, SLOT(slotFileOpenRecent(QString))); connect(mFileOpenRecent, SIGNAL(recentFileListChanged()), this, SLOT(slotSaveRecentFiles())); mUseTemplateAction = fileMenu->addAction(tr("Use &Template...")); connect(mUseTemplateAction, SIGNAL(triggered()), this, SLOT(slotImport())); fileMenu->addSeparator(); mSaveAction = fileMenu->addAction(tr("Save...")); mSaveAction->setIcon(QPixmap(":/shared-icons/document-save")); mSaveAction->setShortcut(QKeySequence::Save); connect(mSaveAction, SIGNAL(triggered()), this, SLOT(slotSave())); mSaveAsAction = fileMenu->addAction(tr("&Save As...")); mSaveAsAction->setIcon(QPixmap(":/shared-icons/document-save-as")); mSaveAsAction->setShortcut(QKeySequence::SaveAs); connect(mSaveAsAction, SIGNAL(triggered()), this, SLOT(slotSaveAs())); mSaveAsDefaultAction = fileMenu->addAction(tr("Save as &Default")); connect(mSaveAsDefaultAction, SIGNAL(triggered()), this, SLOT(slotSaveDefault())); mReloadAction = fileMenu->addAction(tr("&Reload")); mReloadAction->setShortcut(Qt::Key_F5); connect(mReloadAction, SIGNAL(triggered()), this, SLOT(slotReload())); fileMenu->addSeparator(); mCloseAction = fileMenu->addAction(tr("Close")); mCloseAction->setIcon(QPixmap(":/shared-icons/document-close")); mCloseAction->setShortcut(QKeySequence::Close); connect(mCloseAction, SIGNAL(triggered()), this, SLOT(slotFileClose())); fileMenu->addSeparator(); mQuitAction = fileMenu->addAction(tr("Quit")); mQuitAction->setIcon(QPixmap(":/shared-icons/window-close")); mQuitAction->setShortcut(QKeySequence::Quit); connect(mQuitAction, SIGNAL(triggered()), this, SLOT(close())); QMenu *actionMenu = menuBar()->addMenu(tr("&Actions")); mQueryAction = actionMenu->addAction(tr("&Query")); #ifndef Q_OS_UNIX mQueryAction->setEnabled(false); #endif connect(mQueryAction, SIGNAL(triggered()), this, SLOT(slotQuery())); //mProcessingManager = actionMenu->addAction(tr("Show Processing Manager")); QMenu *settingsMenu = menuBar()->addMenu(tr("&Settings")); //Settings mExpertMode = settingsMenu->addAction(tr("&Expert Mode")); mExpertMode->setCheckable(true); connect(mExpertMode, SIGNAL(triggered(bool)), this, SLOT(slotExpertMode())); settingsMenu->addSeparator(); settings.beginGroup("General"); if ( settings.contains("expertMode")) mExpertMode->setChecked(settings.value("expertMode").toBool()); else mExpertMode->setChecked(true); settings.endGroup(); viewMainToolBar = settingsMenu->addAction(tr("Show Main Toolbar")); viewMainToolBar->setCheckable(true); viewMainToolBar->setChecked(true); connect(viewMainToolBar,SIGNAL(triggered()), this,SLOT(slotViewMainToolBar())); viewStatusBar = settingsMenu->addAction(tr("Show StatusBar")); viewStatusBar->setCheckable(true); connect(viewStatusBar,SIGNAL(triggered()), this,SLOT(slotViewStatusBar())); viewStatusBar->setChecked(true); QMenu *helpMenu = menuBar()->addMenu(tr("Help")); QAction *handbook = helpMenu->addAction(tr("Handbook")); handbook->setShortcut(Qt::Key_F1); connect(handbook,SIGNAL(triggered()), this,SLOT(slotHanbook())); QAction *about = helpMenu->addAction(tr("About")); connect(about,SIGNAL(triggered()), this,SLOT(slotAbout())); mMainToolBar->addAction(mNewAction); mMainToolBar->addAction(mOpenAction); mMainToolBar->addAction(mSaveAction); resize(800,600); }