Пример #1
0
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");
}
Пример #2
0
void MainWindow::initActions(){

	TeamAFileOpen = new QAction(tr("Load Team A"), tr("Load Team &A..."), 0, this);
	TeamAFileOpen->setStatusTip(tr("Load a rule set for team A"));
	connect(TeamAFileOpen, SIGNAL(activated()), this, SLOT(slotLoadTeamA()));

	TeamBFileOpen = new QAction(tr("Load Team B"), tr("Load Team &B..."), 0, this);
	TeamBFileOpen->setStatusTip(tr("Load a rule set for team B"));
	connect(TeamBFileOpen, SIGNAL(activated()), this, SLOT(slotLoadTeamB()));

	TeamAFileSave = new QAction(tr("Save Team A"), tr("Save Team A..."), 0, this);
	TeamAFileSave->setStatusTip(tr("Save team A data"));
	connect(TeamAFileSave, SIGNAL(activated()), this, SLOT(slotSaveTeamA()));

	TeamBFileSave = new QAction(tr("Save Team B"), tr("Save Team B..."), 0, this);
	TeamBFileSave->setStatusTip(tr("Save team B data"));
	connect(TeamBFileSave, SIGNAL(activated()), this, SLOT(slotSaveTeamB()));

	TeamAGenerate = new QAction(tr("Generate Team A"), tr("Generate Team A"), 0, this);
	TeamAGenerate->setStatusTip(tr("Generate Team A"));
	connect(TeamAGenerate, SIGNAL(activated()), this, SLOT(slotGenerateTeamA()));

	TeamBGenerate = new QAction(tr("Generate Team B"), tr("Generate Team B"), 0, this);
	TeamBGenerate->setStatusTip(tr("Generate Team B"));
	connect(TeamBGenerate, SIGNAL(activated()), this, SLOT(slotGenerateTeamB()));
	
	FileQuit = new QAction(tr("Exit"), tr("E&xit"), 0, this);
	FileQuit->setStatusTip(tr("Quits the application"));
	FileQuit->setWhatsThis(tr("Exit\n\nQuits the application"));
	connect(FileQuit, SIGNAL(activated()), this, SLOT(slotFileQuit()));

	ViewToolBar = new QAction(tr("Toolbar"), tr("Tool&bar"), 0, this, 0, true);
	ViewToolBar->setStatusTip(tr("Enables/disables the toolbar"));
	ViewToolBar->setWhatsThis(tr("Toolbar\n\nEnables/disables the toolbar"));
	connect(ViewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool)));

	ViewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true);
	ViewStatusBar->setStatusTip(tr("Enables/disables the statusbar"));
	ViewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar"));
	connect(ViewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));

	/*
	ViewGame = new QAction(tr("Game Display"), tr("&Game Display"), 0, this, 0, true);
	ViewGame->setStatusTip(tr("Enables/disables the game play on screen"));
	ViewGame->setWhatsThis(tr("Game Display\n\nEnables/disables the game play on screen"));
	connect(ViewGame, SIGNAL(toggled(bool)), this, SLOT(slotViewGame(bool)));
	*/

	HelpAbout = new QAction(tr("About"), tr("&About..."), 0, this);
	HelpAbout->setStatusTip(tr("About the application"));
	HelpAbout->setWhatsThis(tr("About\n\nAbout the application"));
	connect(HelpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));

	ResetScreen = new QAction(tr("Reset Screen"), tr("Reset Screen"), 0, this);
	ResetScreen->setStatusTip(tr("Reset Screen"));
	ResetScreen->setWhatsThis(tr("Reset Screen\n\nReset Arena Display"));
	//connect(ResetScreen, SIGNAL(activated()), View, SLOT(slotClearField())); 

}
Пример #3
0
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);
}
Пример #4
0
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();
}
Пример #5
0
void editor::initActions()
{
	fileNew = new QAction(QIcon(":/icons/filenew.png"),tr("&New"),this);
	fileNew->setShortcut(tr("Ctrl+N"));
	fileNew->setStatusTip(tr("Create a new image"));
  connect(fileNew, SIGNAL(triggered()), this, SLOT(slotFileNew()));
	  	
	fileOpen = new QAction(QIcon(":/icons/fileopen.png"),tr("&Open"),this);
	fileOpen->setShortcut(tr("Ctrl+O"));
	fileOpen->setStatusTip(tr("Open an image file"));
  connect(fileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen()));
	
	fileSave = new QAction(QIcon(":/icons/filesave.png"),tr("&Save file .."),this);
  fileSave->setStatusTip(tr("Save the file under the same name and format"));
  connect(fileSave, SIGNAL(triggered()), this, SLOT(slotFileSave()));
	
	fileSaveImage = new QAction(tr("Save &Image file .."),this);
  fileSaveImage->setStatusTip(tr("Save the file in PNG format"));
  connect(fileSaveImage, SIGNAL(triggered()), this, SLOT(slotFileSaveImage()));
	
	fileSaveTemplate = new QAction(("Save &Template .."),this);
  fileSaveTemplate->setStatusTip(tr("Save template file "));
  connect(fileSaveTemplate, SIGNAL(triggered()), this, SLOT(slotFileSaveTemplate()));
	
	fileQuit = new QAction(tr("Quit"),this);
	fileQuit->setShortcut(tr("Ctrl+Q"));
  fileQuit->setStatusTip(tr("Quits the editor"));
  connect(fileQuit, SIGNAL(triggered()), this, SLOT(slotFileQuit()));
		
	clearAll= new QAction(QIcon(":/icons/eraser.png"),tr("Clear &All"),this);
  clearAll->setShortcut(tr("Ctrl+A"));
  clearAll->setStatusTip(tr("Delete all objects and fill the background with the background color"));
  connect(clearAll, SIGNAL(triggered()), ev, SLOT(slotClearAll()));

	copy= new QAction(tr("Copy"),this);
  copy->setShortcut(tr("Ctrl+C"));
  connect(copy, SIGNAL(triggered()), ev->getScene(), SLOT(slotCopy()));

	paste= new QAction(tr("Paste"),this);
	paste->setShortcut(tr("Ctrl+V"));
    connect(paste, SIGNAL(triggered()), ev->getScene(), SLOT(slotPaste()));

	deleteAction=new QAction(tr("&Delete"),this);
	deleteAction->setShortcut(tr("Del"));
    connect(deleteAction, SIGNAL(triggered()), ev->getScene(), SLOT(slotDeleteItem()));

	dump= new QAction(tr("dump"),this);
  connect(dump, SIGNAL(triggered()), ev, SLOT(slotDump()));
}
Пример #6
0
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;
}
Пример #7
0
/*
void DateTimeGrid::paintUserDefinedHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect, qreal offset, const KGantt::DateTimeScaleFormatter* formatter, QWidget* widget)
{
    const QStyle* const style = widget ? widget->style() : QApplication::style();

    QDateTime dt = formatter->currentRangeBegin( mapToDateTime( offset + exposedRect.left() ) ).toUTC();
    qreal x = mapFromDateTime( dt );

    while ( x < exposedRect.right() + offset ) {
        const QDateTime next = formatter->nextRangeBegin( dt );
        const qreal nextx = mapFromDateTime( next );

        QStyleOptionHeader opt;
        if ( widget ) opt.init( widget );
        opt.rect = QRectF( x - offset+1, headerRect.top(), qMax( 1., nextx-x-1 ), headerRect.height() ).toAlignedRect();
        //opt.state = QStyle::State_Raised | QStyle::State_Enabled;
        opt.textAlignment = formatter->alignment();
        opt.text = formatter->text( dt );

        // use white text on black background
        opt.palette.setColor(QPalette::Window, QColor("black"));
        opt.palette.setColor(QPalette::ButtonText, QColor("white"));

        style->drawControl( QStyle::CE_Header, &opt, painter, widget );

        dt = next;
        x = nextx;
    }
}
*/
MainWindow::MainWindow( QWidget* parent )
    : QMainWindow( parent ),
      m_model( new ProjectModel( this ) ),
      m_view( new KGantt::View )
{
    m_view->setModel( m_model );
    m_view->setSelectionModel( new QItemSelectionModel(m_model));

    // slotToolsNewItem();
    m_view->leftView()->setItemDelegateForColumn( 1, new MyItemDelegate( this ) );
    m_view->leftView()->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    m_view->graphicsView()->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );

    m_view->setGrid(new DateTimeGrid(this));

    //QItemEditorCreatorBase *creator = new QItemEditorCreator<ItemTypeComboBox>("itemType");
    //QItemEditorFactory* factory = new QItemEditorFactory;
    //factory->registerEditor( QVariant( KGantt::TypeTask ).type(), creator );
    //m_view->itemDelegate()->setItemEditorFactory( factory );

    setCentralWidget( m_view );

    QMenuBar* mb = menuBar();

    QMenu* fileMenu = new QMenu( tr( "&File" ) );

#ifndef QT_NO_PRINTER
    fileMenu->addAction( tr( "&Save as PDF..." ), this, SLOT( slotFileSavePdf() ) );
    fileMenu->addAction( tr( "&Print..." ), this, SLOT( slotFilePrint() ) );
#endif

    fileMenu->addSeparator();
    fileMenu->addAction( tr( "&Quit" ), this, SLOT( slotFileQuit() ) );

    mb->addMenu( fileMenu );

    QMenu* toolsMenu = new QMenu( tr( "&Tools" ) );

    toolsMenu->addAction( tr( "&New Item" ), this, SLOT( slotToolsNewItem() ) );
    toolsMenu->addAction( tr( "&Add Item" ), this, SLOT( slotToolsAppendItem() ) );
    toolsMenu->addSeparator();
    QMenu *alignMenu = toolsMenu->addMenu( tr( "Ali&gn" ) );
    alignMenu->addAction( tr( "&Left" ), this, SLOT( slotAlignLeft() ) );
    alignMenu->addAction( tr( "&Center" ), this, SLOT( slotAlignCenter() ) );
    alignMenu->addAction( tr( "&Right" ), this, SLOT( slotAlignRight() ) );
    alignMenu->addAction( tr( "&Hidden" ), this, SLOT( slotAlignHidden() ) );
    toolsMenu->addSeparator();
    toolsMenu->addAction( tr( "&Collapse All" ), this, SLOT( slotCollapseAll() ) );
    toolsMenu->addAction( tr( "&Expand All" ), this, SLOT( slotExpandAll() ) );

    mb->addMenu( toolsMenu );

    /*
    slotToolsNewItem();
    slotToolsNewItem();
    slotToolsNewItem();
    for (int i = 0; i < 3; ++i) {
        m_model->setData(m_model->index(i,2,QModelIndex()), qVariantFromValue(QDateTime::currentDateTime().addDays(i)), KGantt::StartTimeRole);
        m_model->setData(m_model->index(i,3,QModelIndex()), qVariantFromValue(QDateTime::currentDateTime().addDays(i+1)), KGantt::EndTimeRole);
    }
    m_view->setConstraintModel(new KGantt::ConstraintModel(m_view));
    m_view->constraintModel()->addConstraint(KGantt::Constraint(m_model->index(0,0,QModelIndex()),m_model->index(1,0,QModelIndex())));
    m_view->constraintModel()->addConstraint(KGantt::Constraint(m_model->index(1,0,QModelIndex()),m_model->index(2,0,QModelIndex())));
    */
}
Пример #8
0
void KMouthApp::initActions()
{
// The "File" menu
    fileOpen = actionCollection()->addAction(QLatin1String("file_open"));
    fileOpen->setIcon(KIcon(QLatin1String("document-open")));
    fileOpen->setText(i18n("&Open as History..."));
    fileOpen->setShortcuts(KStandardShortcut::open());
    connect(fileOpen, SIGNAL(triggered(bool)), this, SLOT(slotFileOpen()));
    fileOpen->setToolTip(i18n("Opens an existing file as history"));
    fileOpen->setWhatsThis(i18n("Opens an existing file as history"));

    fileSaveAs = actionCollection()->addAction(QLatin1String("file_save_as"));
    fileSaveAs->setIcon(KIcon(QLatin1String("document-save")));
    fileSaveAs->setText(i18n("Save &History As..."));
    fileSaveAs->setShortcuts(KStandardShortcut::save());
    connect(fileSaveAs, SIGNAL(triggered(bool)), this, SLOT(slotFileSaveAs()));
    fileSaveAs->setToolTip(i18n("Saves the actual history as..."));
    fileSaveAs->setWhatsThis(i18n("Saves the actual history as..."));

    filePrint = actionCollection()->addAction(QLatin1String("file_print"));
    filePrint->setIcon(KIcon(QLatin1String("document-print")));
    filePrint->setText(i18n("&Print History..."));
    filePrint->setShortcuts(KStandardShortcut::print());
    connect(filePrint, SIGNAL(triggered(bool)), this, SLOT(slotFilePrint()));
    filePrint->setToolTip(i18n("Prints out the actual history"));
    filePrint->setWhatsThis(i18n("Prints out the actual history"));

    fileQuit = KStandardAction::quit(this, SLOT(slotFileQuit()), actionCollection());
    fileQuit->setToolTip(i18n("Quits the application"));
    fileQuit->setWhatsThis(i18n("Quits the application"));

// The "Edit" menu
    editCut = KStandardAction::cut(phraseList, SLOT(cut()), actionCollection());
    editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
    editCut->setWhatsThis(i18n("Cuts the selected section and puts it to the clipboard. If there is some text selected in the edit field it is placed it on the clipboard. Otherwise the selected sentences in the history (if any) are placed on the clipboard."));

    editCopy = KStandardAction::copy(phraseList, SLOT(copy()), actionCollection());
    editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
    editCopy->setWhatsThis(i18n("Copies the selected section to the clipboard. If there is some text selected in the edit field it is copied to the clipboard. Otherwise the selected sentences in the history (if any) are copied to the clipboard."));

    editPaste = KStandardAction::paste(phraseList, SLOT(paste()), actionCollection());
    editPaste->setToolTip(i18n("Pastes the clipboard contents to current position"));
    editPaste->setWhatsThis(i18n("Pastes the clipboard contents at the current cursor position into the edit field."));

    editSpeak = actionCollection()->addAction(QLatin1String("edit_speak"));
    editSpeak->setIcon(KIcon(QLatin1String("text-speak")));
    editSpeak->setText(i18nc("Start speaking", "&Speak"));
    connect(editSpeak, SIGNAL(triggered(bool)), phraseList, SLOT(speak()));
    editSpeak->setToolTip(i18n("Speaks the currently active sentence(s)"));
    editSpeak->setWhatsThis(i18n("Speaks the currently active sentence(s). If there is some text in the edit field it is spoken. Otherwise the selected sentences in the history (if any) are spoken."));

// The "Phrase book" menu
    phrasebookEdit = actionCollection()->addAction(QLatin1String("phrasebook_edit"));
    phrasebookEdit->setText(i18n("&Edit..."));
    connect(phrasebookEdit, SIGNAL(triggered(bool)), this, SLOT(slotEditPhrasebook()));

// The "Options" menu
    viewMenuBar = KStandardAction::showMenubar(this, SLOT(slotViewMenuBar()), actionCollection());
    // FIXME: Disable so it will compile.
    // viewToolBar = KStandardAction::showToolbar(this, SLOT(slotViewToolBar()), actionCollection());
    // viewToolBar->setToolTip(i18n("Enables/disables the toolbar"));
    // viewToolBar->setWhatsThis (i18n("Enables/disables the toolbar"));

    viewPhrasebookBar = actionCollection()->add<KToggleAction>(QLatin1String("showPhrasebookBar"));
    viewPhrasebookBar->setText(i18n("Show P&hrasebook Bar"));
    connect(viewPhrasebookBar, SIGNAL(triggered(bool)), this, SLOT(slotViewPhrasebookBar()));
    viewPhrasebookBar->setToolTip(i18n("Enables/disables the phrasebook bar"));
    viewPhrasebookBar->setWhatsThis(i18n("Enables/disables the phrasebook bar"));

    viewStatusBar = KStandardAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection());
    viewStatusBar->setToolTip(i18n("Enables/disables the statusbar"));
    viewStatusBar->setWhatsThis(i18n("Enables/disables the statusbar"));

    configureTTS = actionCollection()->addAction(QLatin1String("configureTTS"));
    configureTTS->setIcon(KIcon(QLatin1String("configure")));
    configureTTS->setText(i18n("&Configure KMouth..."));
    connect(configureTTS, SIGNAL(triggered(bool)), this, SLOT(slotConfigureTTS()));
    configureTTS->setToolTip(i18n("Opens the configuration dialog"));
    configureTTS->setWhatsThis(i18n("Opens the configuration dialog"));

// The "Help" menu
    // The "Help" menu will automatically get created.

// The popup menu of the list of spoken sentences
    phraseListSpeak = actionCollection()->addAction(QLatin1String("phraselist_speak"));
    phraseListSpeak->setIcon(KIcon(QLatin1String("text-speak")));
    phraseListSpeak->setText(i18n("&Speak"));
    phraseListSpeak->setToolTip(i18n("Speaks the currently selected phrases in the history"));
    connect(phraseListSpeak, SIGNAL(triggered(bool)), phraseList, SLOT(speakListSelection()));
    phraseListSpeak->setWhatsThis(i18n("Speaks the currently selected phrases in the history"));

    phraseListRemove = actionCollection()->addAction(QLatin1String("phraselist_remove"));
    phraseListRemove->setIcon(KIcon(QLatin1String("edit-delete")));
    phraseListRemove->setText(i18n("&Delete"));
    connect(phraseListRemove, SIGNAL(triggered(bool)), phraseList, SLOT(removeListSelection()));
    phraseListRemove->setToolTip(i18n("Deletes the currently selected phrases from the history"));
    phraseListRemove->setWhatsThis(i18n("Deletes the currently selected phrases from the history"));

    phraseListCut = actionCollection()->addAction(QLatin1String("phraselist_cut"));
    phraseListCut->setIcon(KIcon(QLatin1String("edit-cut")));
    phraseListCut->setText(i18n("Cu&t"));
    connect(phraseListCut, SIGNAL(triggered(bool)), phraseList, SLOT(cutListSelection()));
    phraseListCut->setToolTip(i18n("Cuts the currently selected phrases from the history and puts them to the clipboard"));
    phraseListCut->setWhatsThis(i18n("Cuts the currently selected phrases from the history and puts them to the clipboard"));

    phraseListCopy = actionCollection()->addAction(QLatin1String("phraselist_copy"));
    phraseListCopy->setIcon(KIcon(QLatin1String("edit-copy")));
    phraseListCopy->setText(i18n("&Copy"));
    connect(phraseListCopy, SIGNAL(triggered(bool)), phraseList, SLOT(copyListSelection()));
    phraseListCut->setToolTip(i18n("Copies the currently selected phrases from the history to the clipboard"));
    phraseListCut->setWhatsThis(i18n("Copies the currently selected phrases from the history to the clipboard"));

    phraselistSelectAll = actionCollection()->addAction(QLatin1String("phraselist_select_all"));
    phraselistSelectAll->setText(i18n("Select &All Entries"));
    connect(phraselistSelectAll, SIGNAL(triggered(bool)), phraseList, SLOT(selectAllEntries()));
    phraselistSelectAll->setToolTip(i18n("Selects all phrases in the history"));
    phraselistSelectAll->setWhatsThis(i18n("Selects all phrases in the history"));

    phraselistDeselectAll = actionCollection()->addAction(QLatin1String("phraselist_deselect_all"));
    phraselistDeselectAll->setText(i18n("D&eselect All Entries"));
    connect(phraselistDeselectAll, SIGNAL(triggered(bool)), phraseList, SLOT(deselectAllEntries()));
    phraselistDeselectAll->setToolTip(i18n("Deselects all phrases in the history"));
    phraselistDeselectAll->setWhatsThis(i18n("Deselects all phrases in the history"));

// The popup menu of the edit field
    // The popup menu of the edit field will automatically get created.

    // use the absolute path to your kmouthui.rc file for testing purpose in createGUI();
    createGUI();
}
Пример #9
0
bool KateAppCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg)
{
    QStringList args(cmd.split( QRegExp("\\s+"), QString::SkipEmptyParts)) ;
    QString command( args.takeFirst() );

    KateMainWindow *mainWin = KateApp::self()->activeMainWindow();

    if (re_write.exactMatch(command)) {  //TODO: handle writing to specific file
        if (!re_write.cap(1).isEmpty()) { // [a]ll
            KateDocManager::self()->saveAll();
            msg = i18n("All documents written to disk");
        } else {
            view->document()->documentSave();
            msg = i18n("Document written to disk");
        }
    }
    // Other buffer commands are implemented by the KateFileTree plugin
    else if (re_close.exactMatch(command)) {
        QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
    }
    else if (re_quit.exactMatch(command)) {
        if (!re_quit.cap(2).isEmpty()) { // a[ll]
            if (!re_quit.cap(1).isEmpty()) { // [w]rite
                KateDocManager::self()->saveAll();
            }
            QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        } else {
            if (!re_quit.cap(1).isEmpty() && view->document()->isModified()) { // [w]rite
                view->document()->documentSave();
            }

            if (mainWin->viewManager()->count() > 1) {
              QTimer::singleShot(0, mainWin->viewManager(), SLOT(slotCloseCurrentViewSpace()));
            } else {
                if (KateDocManager::self()->documents() > 1)
                  QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
                else
                  QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
            }
        }
    } else if (re_exit.exactMatch(command)) {
        if (!re_exit.cap(1).isEmpty()) { // a[ll]
            KateDocManager::self()->saveAll();
            QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        } else {
            if (view->document()->isModified()) {
                view->document()->documentSave();
            }

            if (KateDocManager::self()->documents() > 1)
                QTimer::singleShot(0, mainWin, SLOT(slotFileClose()));
            else
                QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
        }
        QTimer::singleShot(0, mainWin, SLOT(slotFileQuit()));
    }
    else if (re_edit.exactMatch(command)) {
        QString argument = args.join(QString(' '));
        if (argument.isEmpty() || argument == "!") {
            view->document()->documentReload();
        } else {
            KUrl base = mainWin->activeDocumentUrl();
            KUrl url;
            KUrl arg2path(argument);
            if (base.isValid()) { // first try to use the same path as the current open document has
              url = KUrl(base.resolved(arg2path));  //resolved handles the case where the args is a relative path, and is the same as using KUrl(args) elsewise
            } else { // else use the cwd
              url = KUrl(KUrl(QDir::currentPath() + "/").resolved(arg2path)); // + "/" is needed because of http://lists.qt.nokia.com/public/qt-interest/2011-May/033913.html
            }
            QFileInfo file( url.toLocalFile() );
            KTextEditor::Document *doc = KateDocManager::self()->findDocument( url );
            if (doc) {
                mainWin->viewManager()->activateView( doc );
            } else if (file.exists()) {
                mainWin->viewManager()->openUrl( url, QString(), true );
            } else {
                mainWin->viewManager()->openUrl( KUrl(), QString(), true )->saveAs ( url );
            }
        }
    }
    else if (re_new.exactMatch(command)) {
        if (re_new.cap(1) == "v") { // vertical split
            mainWin->viewManager()->slotSplitViewSpaceVert();
        } else {                    // horizontal split
            mainWin->viewManager()->slotSplitViewSpaceHoriz();
        }
        mainWin->viewManager()->slotDocumentNew();
    }
    else if (command == "enew") {
        mainWin->viewManager()->slotDocumentNew();
    }
    else if (re_split.exactMatch(command)) {
        mainWin->viewManager()->slotSplitViewSpaceHoriz();
    }
    else if (re_vsplit.exactMatch(command)) {
        mainWin->viewManager()->slotSplitViewSpaceVert();
    } else if (re_only.exactMatch(command)) {
      mainWin->viewManager()->slotCloseOtherViews();
    }

    return true;
}
Пример #10
0
void KateMainWindow::setupActions()
{
  KAction *a;

  actionCollection()->addAction( KStandardAction::New, "file_new", m_viewManager, SLOT(slotDocumentNew()) )
  ->setWhatsThis(i18n("Create a new document"));
  actionCollection()->addAction( KStandardAction::Open, "file_open", m_viewManager, SLOT(slotDocumentOpen()) )
  ->setWhatsThis(i18n("Open an existing document for editing"));

  fileOpenRecent = KStandardAction::openRecent (m_viewManager, SLOT(openUrl(KUrl)), this);
  actionCollection()->addAction(fileOpenRecent->objectName(), fileOpenRecent);
  fileOpenRecent->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again."));

  a = actionCollection()->addAction( "file_save_all" );
  a->setIcon( KIcon("document-save-all") );
  a->setText( i18n("Save A&ll") );
  a->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_L) );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(saveAll()) );
  a->setWhatsThis(i18n("Save all open, modified documents to disk."));

  a = actionCollection()->addAction( "file_reload_all" );
  a->setText( i18n("&Reload All") );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(reloadAll()) );
  a->setWhatsThis(i18n("Reload all open documents."));

  a = actionCollection()->addAction( "file_close_orphaned" );
  a->setText( i18n("Close Orphaned") );
  connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(closeOrphaned()) );
  a->setWhatsThis(i18n("Close all documents in the file list that could not be reopened, because they are not accessible anymore."));

  actionCollection()->addAction( KStandardAction::Close, "file_close", m_viewManager, SLOT(slotDocumentClose()) )
  ->setWhatsThis(i18n("Close the current document."));

  a = actionCollection()->addAction( "file_close_other" );
  a->setText( i18n( "Close Other" ) );
  connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()) );
  a->setWhatsThis(i18n("Close other open documents."));

  a = actionCollection()->addAction( "file_close_all" );
  a->setText( i18n( "Clos&e All" ) );
  connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseAll()) );
  a->setWhatsThis(i18n("Close all open documents."));

  a = actionCollection()->addAction( KStandardAction::Quit, "file_quit" );
  // Qt::QueuedConnection: delay real shutdown, as we are inside menu action handling (bug #185708)
  connect( a, SIGNAL(triggered()), this, SLOT(slotFileQuit()), Qt::QueuedConnection );
  a->setWhatsThis(i18n("Close this window"));

  a = actionCollection()->addAction( "view_new_view" );
  a->setIcon( KIcon("window-new") );
  a->setText( i18n("&New Window") );
  connect( a, SIGNAL(triggered()), this, SLOT(newWindow()) );
  a->setWhatsThis(i18n("Create a new Kate view (a new window with the same document list)."));

  KToggleAction* showFullScreenAction = KStandardAction::fullScreen( 0, 0, this, this);
  actionCollection()->addAction( showFullScreenAction->objectName(), showFullScreenAction );
  connect( showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool)));

  documentOpenWith = new KActionMenu(i18n("Open W&ith"), this);
  actionCollection()->addAction("file_open_with", documentOpenWith);
  documentOpenWith->setWhatsThis(i18n("Open the current document using another application registered for its file type, or an application of your choice."));
  connect(documentOpenWith->menu(), SIGNAL(aboutToShow()), this, SLOT(mSlotFixOpenWithMenu()));
  connect(documentOpenWith->menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotOpenWithMenuAction(QAction*)));

  a = KStandardAction::keyBindings(this, SLOT(editKeys()), actionCollection());
  a->setWhatsThis(i18n("Configure the application's keyboard shortcut assignments."));

  a = KStandardAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
  a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s)."));

  QAction* settingsConfigure = KStandardAction::preferences(this, SLOT(slotConfigure()), actionCollection());
  settingsConfigure->setWhatsThis(i18n("Configure various aspects of this application and the editing component."));

  // tip of the day :-)
  actionCollection()->addAction( KStandardAction::TipofDay, this, SLOT(tipOfTheDay()) )
  ->setWhatsThis(i18n("This shows useful tips on the use of this application."));

  if (KatePluginManager::self()->pluginList().count() > 0)
  {
    a = actionCollection()->addAction( "help_plugins_contents" );
    a->setText( i18n("&Plugins Handbook") );
    connect( a, SIGNAL(triggered()), this, SLOT(pluginHelp()) );
    a->setWhatsThis(i18n("This shows help files for various available plugins."));
  }

  a = actionCollection()->addAction( "help_about_editor" );
  a->setText( i18n("&About Editor Component") );
  connect( a, SIGNAL(triggered()), this, SLOT(aboutEditor()) );

  connect(m_viewManager, SIGNAL(viewChanged()), m_mainWindow, SIGNAL(viewChanged()));
  connect(m_viewManager, SIGNAL(viewCreated(KTextEditor::View*)), m_mainWindow, SIGNAL(viewCreated(KTextEditor::View*)));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotWindowActivated()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateOpenWith()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateBottomViewBar()));
  connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateTopViewBar()));
  slotWindowActivated ();

  // session actions
  a = actionCollection()->addAction( "sessions_new" );
  a->setIcon( KIcon("document-new") );
  a->setText( i18nc("Menu entry Session->New", "&New") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionNew()), Qt::QueuedConnection );
  a = actionCollection()->addAction( "sessions_open" );
  a->setIcon( KIcon("document-open") );
  a->setText( i18n("&Open Session") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionOpen()), Qt::QueuedConnection );
  a = actionCollection()->addAction( "sessions_save" );
  a->setIcon( KIcon("document-save") );
  a->setText( i18n("&Save Session") );
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSave()) );
  a = actionCollection()->addAction( "sessions_save_as" );
  a->setIcon( KIcon("document-save-as") );
  a->setText( i18n("Save Session &As...") );
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSaveAs()) );
  a = actionCollection()->addAction( "sessions_manage" );
  a->setIcon( KIcon("view-choose") );
  a->setText( i18n("&Manage Sessions...") );
  // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
  connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionManage()), Qt::QueuedConnection );

  // quick open menu ;)
  a = new KateSessionsAction (i18n("&Quick Open Session"), this);
  actionCollection()->addAction("sessions_list", a);
}
Пример #11
0
//
// 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);
}
Пример #12
0
/**
  * Initialisiert alle QActions der Anwendung incl.
  * aller connects zu den jeweiligen Slots
  */
void AstroCalcApp::initActions()
{
	QPixmap JulianDateIcon( ( const char** ) imageJD_data );
	QPixmap MagnitudeIcon( ( const char** ) imageMag_data );
	
	//JulianDateIcon = QPixmap( "toolJulianDate.xpm" );
	//MagnitudeIcon = QPixmap( "toolMagnitude.xpm" );

	fileQuit = new QAction(tr("Exit"), tr("E&xit"), QAccel::stringToKey(tr("Ctrl+Q")), this);
  	fileQuit->setStatusTip(tr("Beendet das Programm"));
  	fileQuit->setWhatsThis(tr("Exit\n\nBeendet das Programm"));
  	connect(fileQuit, SIGNAL(activated()), this, SLOT(slotFileQuit()));
	
	dataTeleskop = new QAction( tr( "Teleskop" ), tr( "Teleskop" ), QAccel::stringToKey( tr( "Ctrl+T" )), this );
	dataTeleskop->setStatusTip( tr( "Eingabe der Teleskopdaten" ) );
	dataTeleskop->setWhatsThis( tr( "Teleskop\n\nFragt die Teleskopdaten (Öffnung / Brennweite) ab" ) );
	connect( dataTeleskop, SIGNAL( activated() ), this, SLOT( slotDataTeleskop() ));
	
	berechneVergroesserung = new QAction( tr( "Vergrößerung" ), tr( "Vergrößerung" ), 0, this );
	berechneVergroesserung->setStatusTip( tr( "Berechnet die Vergrößerung" ) );
	berechneVergroesserung->setWhatsThis( tr( "Vergrößerung\n\nErmittelt anhand des Okulars die erzielte Vergrößerung" ) );
	connect( berechneVergroesserung, SIGNAL( activated() ), this, SLOT( slotBerechneVergroesserung() ));
	
	berechneOkular = new QAction( tr( "Okular" ), tr( "Okular" ), 0, this );
	berechneOkular->setStatusTip( tr( "Ermittelt das Okular" ) );
	berechneOkular->setWhatsThis( tr( "Okular\n\nErmittelt das Okular anhand der Vergrößerung" ) );
	connect( berechneOkular, SIGNAL( activated() ), this, SLOT( slotBerechneOkular() ));
	
	berechneGrenzgroesse = new QAction( tr( "Grenzgröße" ), tr( "Grenzgröße" ), 0, this );
	berechneGrenzgroesse->setStatusTip( tr( "Ermittelt die Grenzgröße" ) );
	berechneGrenzgroesse->setWhatsThis( tr( "Grenzgröße\n\nErmittelt die Grenzgröße anhand der Vergrößerung" ) );
	connect( berechneGrenzgroesse, SIGNAL( activated() ), this, SLOT( slotBerechneGrenzgroesse() ));
	
	toolsMagnitude = new QAction( tr( "Magnitude" ), MagnitudeIcon, tr( "Magnitude" ), QAccel::stringToKey( tr( "Ctrl+M" )), this );
	toolsMagnitude->setStatusTip( tr( "Helligkeitsunterschied zweier Objekte" ) );
	toolsMagnitude->setWhatsThis( tr( "Magnitude\n\nErmittelt den Helligkeitsunterschied zweier Objekte" ) );
	connect( toolsMagnitude, SIGNAL( activated() ), this, SLOT( slotToolsMagnitude() ));
	
	toolsJulianDatum = new QAction( tr( "Julian. Datum" ), JulianDateIcon, tr( "Julian. Datum" ), QAccel::stringToKey( tr( "Ctrl+J" )), this );
	toolsJulianDatum->setStatusTip( tr( "Berechnet das Julianische Datum" ) );
	toolsJulianDatum->setWhatsThis( tr( "Julianisches Datum\n\nBerechnet das Julianische Datum" ) );
	connect( toolsJulianDatum, SIGNAL( activated() ), this, SLOT( slotToolsJulianDatum() ));
		
	viewToolBar = new QAction(tr("Toolbar"), tr("Tool&bar"), 0, this, 0, true);
  	viewToolBar->setStatusTip(tr("Toolbar ein-/ausschalten"));
  	viewToolBar->setWhatsThis(tr("Toolbar\n\nToolbar ein-/ausschalten"));
  	connect(viewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool)));

  	viewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true);
  	viewStatusBar->setStatusTip(tr("Statusbar ein-/ausschalten"));
  	viewStatusBar->setWhatsThis(tr("Statusbar\n\nStatusbar ein-/ausschalten"));
  	connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));

	helpAboutApp = new QAction(tr("Über"), tr("Über..."), 0, this);
  	helpAboutApp->setStatusTip(tr("Über das Programm"));
  	helpAboutApp->setWhatsThis(tr("Über\n\nÜber das Programm"));
  	connect(helpAboutApp, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
  	
  	if ( !Teleskop.TeleDataOK() )
	{
		berechneVergroesserung->setEnabled( false );
		berechneOkular->setEnabled( false );
		berechneGrenzgroesse->setEnabled( false );
	}
}
Пример #13
0
void Portal::initActions()
{
  fileQuit = actionCollection()->addAction( KStandardAction::Quit, this, SLOT(slotFileQuit() ) );
  editCut = actionCollection()->addAction( KStandardAction::Cut, this, SLOT(slotEditCut() ) );
  editCopy = actionCollection()->addAction( KStandardAction::Copy, this, SLOT(slotEditCopy() ) );
  editPaste = actionCollection()->addAction( KStandardAction::Paste, this, SLOT(slotEditPaste() ) );
  viewStatusBar = KStandardAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection());

  actionCollection()->addAction( KStandardAction::Preferences, this, SLOT( preferences() ) );

  actNewDocument = actionCollection()->addAction( "document_new", this, SLOT( slotNewDocument()) );
  actNewDocument->setText( i18n("Create Document") );
  actNewDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::New) );
  actNewDocument->setIcon( KIcon("document-new"));

  actCopyDocument = actionCollection()->addAction( "document_copy", this, SLOT( slotCopyDocument()) );
  actCopyDocument->setText( i18n("Copy Document"));
  actCopyDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Copy) );
  actCopyDocument->setIcon( KIcon( "document-edit"));

  actFollowDocument = actionCollection()->addAction( "document_follow", this, SLOT( slotFollowUpDocument() ) );
  actFollowDocument->setText( i18n("Follow Document" ));
  actFollowDocument->setShortcut( KShortcut( Qt::CTRL + Qt::Key_F ));
  actFollowDocument->setIcon( KIcon( "document-edit"));

  actPrintDocument = actionCollection()->addAction( "document_print", this, SLOT( slotPrintDocument()) );
  actPrintDocument->setText( i18n("Print Document"));
  actPrintDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Print) );
  actPrintDocument->setIcon( KIcon("document-print"));

  actOpenArchivedDocument = actionCollection()->addAction( "archived_open", this, SLOT( slotArchivedDocExecuted()) );
  actOpenArchivedDocument->setText( i18n("Open Archived Document"));
  actOpenArchivedDocument->setShortcut( KShortcut(Qt::CTRL + Qt::Key_A) );

  actViewDocument  = actionCollection()->addAction( "document_view", this, SLOT( slotViewDocument()));
  actViewDocument->setText(i18n("Show Document"));
  actViewDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Reload) );
  actViewDocument->setIcon( KIcon("document-preview" ));

  actOpenDocument = actionCollection()->addAction( "document_open", this, SLOT( slotOpenDocument()) );
  actOpenDocument->setText( i18n("Edit Document"));
  actOpenDocument->setShortcut( KStandardShortcut::shortcut(KStandardShortcut::Open) );
  actOpenDocument->setIcon( KIcon("document-open" ));

  actMailDocument = actionCollection()->addAction( "document_mail", this, SLOT( slotMailDocument()) );
  actMailDocument->setText(i18n("&Mail Document"));
  actMailDocument->setShortcut( KShortcut(Qt::CTRL + Qt::Key_M ));
  actMailDocument->setIcon( KIcon("mail-forward"));

  actEditTemplates = actionCollection()->addAction( "edit_tag_templates", this, SLOT( slotEditTagTemplates() ) );
  actEditTemplates->setText("Edit Tag Templates");
  actEditTemplates->setShortcut( KShortcut( Qt::CTRL + Qt::Key_E ));

  KAction *reconfDb = actionCollection()->addAction( "reconfigure_db", this, SLOT( slotReconfigureDatabase() ) );
  reconfDb->setText("Redo Initial Setup...");
  reconfDb->setShortcut( KShortcut( Qt::CTRL + Qt::Key_R ));

  fileQuit->setStatusTip(i18n("Quits the application"));
  editCut->setStatusTip(i18n("Cuts the selected section and puts it to the clipboard"));
  editCopy->setStatusTip(i18n("Copies the selected section to the clipboard"));
  editPaste->setStatusTip(i18n("Pastes the clipboard contents to current position"));
  viewStatusBar->setStatusTip(i18n("Enables/disables the statusbar"));

  actNewDocument->setStatusTip( i18n( "Creates a new Document" ) );
  actPrintDocument->setStatusTip( i18n( "Print and archive this Document" ) );
  actCopyDocument->setStatusTip( i18n( "Creates a new document which is a copy of the selected document" ) );
  actFollowDocument->setStatusTip( i18n( "Create a followup document for the current document" ) );
  actOpenDocument->setStatusTip( i18n( "Opens the document for editing" ) );
  actViewDocument->setStatusTip( i18n( "Opens a read only view on the document." ) );
  actMailDocument->setStatusTip( i18n( "Send document per mail" ) );
  actEditTemplates->setStatusTip( i18n("Edit the available tag templates which can be assigned to document items.") );
  reconfDb->setStatusTip( i18n( "Configure the Database Kraft is working on." ) );

  actOpenArchivedDocument->setStatusTip( i18n( "Open a viewer on an archived document" ) );
  setStandardToolBarMenuEnabled( true );
  actOpenDocument->setEnabled( false );
  actViewDocument->setEnabled( false );
  actPrintDocument->setEnabled( false );
  actCopyDocument->setEnabled( false );
  actFollowDocument->setEnabled( false );
  actMailDocument->setEnabled( false );

  actOpenArchivedDocument->setEnabled( false );
  // use the absolute path to your kraftui.rc file for testing purpose in createGUI();
  QString prjPath = QString::fromUtf8(qgetenv("KRAFT_HOME"));
  if( !prjPath.isEmpty() ) {
      createGUI(QString("%1/src/kraftui.rc").arg(prjPath));
  } else {
      createGUI( "kraftui.rc");
  }

}
Пример #14
0
void Freecell::initMenuBar()
{
    ///////////////////////////////////////////////////////////////////
    // MENUBAR

    ///////////////////////////////////////////////////////////////////
    // menuBar entry fileMenu

#ifdef QTOPIA
    fileMenu = QSoftMenuBar::menuFor(this);
#else
    fileMenu = menuBar()->addMenu("&File");
#endif

    fileMenu->addAction("Rotate", this, SLOT(slotFileRotate()));
    fileMenu->addAction("New Game", this, SLOT(slotFileNew()));
    fileMenu->addAction("Select Game", this, SLOT(slotFileSelect()));
    fileMenu->addAction("Statistic", this, SLOT(slotFileStatistic()));
    fileMenu->addAction("Options", this, SLOT(slotFileOptions()));
    fileMenu->addAction("Exit", this, SLOT(slotFileQuit()));

    ///////////////////////////////////////////////////////////////////
    // menuBar entry protocolMenu
    protocolMenu = new QMenu();
    protocolMenu->addAction("Start Protocol", this, SLOT(slotProtocolStart()));
    protocolMenu->addAction("Stop Protocol", this, SLOT(slotProtocolStop()));

    ///////////////////////////////////////////////////////////////////
    // menuBar entry viewMenu
    //viewMenu=new QPopupMenu();
    //viewMenu->setCheckable(true);
    //viewMenu->insertItem("Tool&bar", this, SLOT(slotViewToolBar()), 0, ID_VIEW_TOOLBAR);
    //viewMenu->insertItem("&Statusbar", this, SLOT(slotViewStatusBar()), 0, ID_VIEW_STATUSBAR);

    //viewMenu->setItemChecked(ID_VIEW_TOOLBAR, true);
    //viewMenu->setItemChecked(ID_VIEW_STATUSBAR, true);

    ///////////////////////////////////////////////////////////////////
    // EDIT YOUR APPLICATION SPECIFIC MENUENTRIES HERE

    ///////////////////////////////////////////////////////////////////
    // menuBar entry helpMenu
    helpMenu = new QMenu();
    helpMenu->addAction("About...", this, SLOT(slotHelpAbout()));

    ///////////////////////////////////////////////////////////////////
    // MENUBAR CONFIGURATION
    // set menuBar() the current menuBar 

//  menuBar()->insertItem("&File", fileMenu);
//  menuBar()->insertItem("&Protocol", protocolMenu);
//
//  menuBar()->insertSeparator();
//  menuBar()->insertItem("&Help", helpMenu);

    ///////////////////////////////////////////////////////////////////
    // CONNECT THE SUBMENU SLOTS WITH SIGNALS

    connect(fileMenu, SIGNAL(highlighted(int)), SLOT(statusCallback(int)));
    connect(protocolMenu, SIGNAL(highlighted(int)), SLOT(statusCallback(int)));
    connect(helpMenu, SIGNAL(highlighted(int)), SLOT(statusCallback(int)));

}
Пример #15
0
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);
}
Пример #16
0
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);
}