Пример #1
0
void MainWindow::setupActions()
{
    actQuit         = KStandardAction::quit(this, SLOT(quit()), actionCollection());
    KAction *a = NULL;
    a = actionCollection()->addAction("minimizeRestore", this,
                                      SLOT(minimizeRestore()));
    a->setText(i18n("Minimize"));
    a->setIcon(KIcon(""));
    a->setShortcut(0);

    /** Settings : ************************************************************/
//  m_actShowToolbar   = KStandardAction::showToolbar(   this, SLOT(toggleToolBar()),   actionCollection());
    m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection());

//  m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) );

    (void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection());

    (void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

    //KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() );
    //actCfgNotifs->setEnabled(false); // Not yet implemented !

    actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection());
}
Пример #2
0
// private
void kpMainWindow::setupSettingsMenuActions ()
{
    KActionCollection *ac = actionCollection ();


    // Settings/Toolbars |> %s
    setStandardToolBarMenuEnabled (true);

    // Settings/Show Statusbar
    createStandardStatusBarAction ();


    d->actionFullScreen = KStandardAction::fullScreen (this, SLOT (slotFullScreen ()),
                                                      this/*window*/, ac);


    d->actionShowPath = ac->add<KToggleAction> ("settings_show_path");
    d->actionShowPath->setText (i18n ("Show &Path"));
    connect(d->actionShowPath, SIGNAL(triggered(bool) ), SLOT (slotShowPathToggled ()));
    //d->actionShowPath->setCheckedState (KGuiItem(i18n ("Hide &Path")));
    slotEnableSettingsShowPath ();


    d->actionKeyBindings = KStandardAction::keyBindings (this, SLOT (slotKeyBindings ()), ac);

    KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

    enableSettingsMenuDocumentActions (false);
}
void KAddressBookMain::initActions()
{
    KStandardAction::quit( this, SLOT( close() ), actionCollection() );

    KAction *action;
    action = KStandardAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
    action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) );

    KStandardAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
}
Пример #4
0
    void GUI::setupActions()
    {
        KActionCollection* ac = actionCollection();
        KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
        new_action->setToolTip(i18n("Create a new torrent"));
        KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
        open_action->setToolTip(i18n("Open a torrent"));
        paste_action = KStandardAction::paste(this, SLOT(paste()), ac);

        open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this);
        open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
        connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently()));
        ac->addAction("file_open_silently", open_silently_action);

        KStandardAction::quit(this, SLOT(quit()), ac);

        show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac);
        show_status_bar_action->setIcon(KIcon("kt-show-statusbar"));

        show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac);
        KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
        KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
        KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
        KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);

        paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this);
        paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
        paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P));
        connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL()));
        ac->addAction("paste_url", paste_url_action);

        ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this);
        ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
        ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I));
        connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter()));
        ac->addAction("ipfilter_action", ipfilter_action);

        import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this);
        import_action->setToolTip(i18n("Import a torrent"));
        import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I));
        connect(import_action, SIGNAL(triggered()), this, SLOT(import()));
        ac->addAction("import", import_action);

        show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this);
        connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide()));
        ac->addAction("show_kt", show_kt_action);
        show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T));

        setStandardToolBarMenuEnabled(true);
    }
void MainWindow::initActions()
{
  KStandardAction::quit( this, SLOT(close()), actionCollection() );

  KAction *action =
    KStandardAction::keyBindings( this, SLOT(configureKeyBindings()), actionCollection() );
  action->setWhatsThis(
    i18nc( "@info:whatsthis",
           "You will be presented with a dialog where you can configure "
           "the application-wide shortcuts." ) );

  KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() );
  KStandardAction::preferences( this, SLOT(configure()), actionCollection() );
}
Пример #6
0
void ActionConfigDialog::slotEditToolbar()
{
  QString toolbarName;
  QString toolbarId;
  QListViewItem *oldItem;
  QListViewItem *item = actionTreeView->currentItem();
  if (item->parent())
     item = item->parent();
  toolbarName = item->text(0);
  if ( toolbarName != i18n("All"))
  {
    emit configureToolbars(toolbarName +" <quanta>");

    //update the tree view
    KAction *action;
    KActionCollection *ac = m_mainWindow->actionCollection();
    ToolbarTabWidget *tb = ToolbarTabWidget::ref();
    for (int i = 0; i < tb->count(); i++)
    {
      toolbarName = tb->label(i);
      toolbarId = tb->id(i);
      ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
      if (p_toolbar)
      {
        oldItem = actionTreeView->findItem(toolbarName, 0);
        item = new KListViewItem(actionTreeView, oldItem, toolbarName);
        item->setOpen(oldItem->isOpen());
        delete oldItem;
        QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
        while (!node.isNull())
        {
          if (node.nodeName() == "Action")
          {
            action = ac->action(node.toElement().attribute("name"));
            if (action)
            {
              oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name());
              oldItem->setPixmap(0, SmallIcon(action->icon()));
            }
          }
          node = node.nextSibling();
        }
      }
    }
    actionTreeView->setCurrentItem(allActionsItem);
    actionTreeView->setSelected(allActionsItem, true);
  }
}
Пример #7
0
void MyFracWindow::createActions()
{
	KAction* actionSave = KStdAction::save(this, SLOT(onFileSave()), actionCollection());
	actionSave->setText(i18n("&Save Image..."));
	KStdAction::quit(kapp, SLOT(quit()), actionCollection());

	KStdAction::copy(this, SLOT(onEditCopy()), actionCollection());
	new KAction(i18n("&Edit Gradient..."), "frgradedit", CTRL+Key_E,
		this, SLOT(onGradientEdit()), actionCollection(), "grad_edit");
	new KAction(i18n("&Invert Gradient"), "frgradinv", CTRL+Key_X,
		this, SLOT(onGradientInvert()), actionCollection(), "grad_inv");

	_actionMandelbrot = KStdAction::up(this, SLOT(setMandelbrotMode()), actionCollection());
	_actionMandelbrot->setText(i18n("&To Mandelbrot"));
	KStdAction::home(this, SLOT(onDefaultView()), actionCollection());
	_actionBack = KStdAction::back(this, SLOT(onViewBack()), actionCollection());
	_actionForward = KStdAction::forward(this, SLOT(onViewForward()), actionCollection());

	createStandardStatusBarAction();
	setStandardToolBarMenuEnabled(true);

	_actionParams = new KToggleAction(i18n("Show Parameters"), SmallIconSet("frparams"), 0,
		_dockParams, SLOT(changeHideShowState()), actionCollection(), "show_params");
	_actionDisplay = new KToggleAction(i18n("Show Display"), SmallIconSet("frdisplay"), 0,
		_dockDisplay, SLOT(changeHideShowState()), actionCollection(), "show_display");
	_actionPreview = new KToggleAction(i18n("Show Preview"), SmallIconSet("viewmag"), 0,
		_dockPreview, SLOT(changeHideShowState()), actionCollection(), "show_preview");
#if KDE_IS_VERSION(3,2,90)
	_actionParams->setCheckedState(i18n("Hide Parameters"));
	_actionDisplay->setCheckedState(i18n("Hide Display"));
	_actionPreview->setCheckedState(i18n("Hide Preview"));
#endif
	KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
	KStdAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

	connect(dockManager, SIGNAL(change()), this, SLOT(updateShowActions()));
	updateShowActions();
}