Exemple #1
0
MainWindow::MainWindow(const QUrl& url)
    : m_markpad(0)
    , m_recentFiles(0)
    , m_firstTextChange(false)
{
    m_markpad = new Markpado(this);
    
    setupAction();
    setupConnect();
    
    
    setCentralWidget(m_markpad);
    setupGUI(QSize(500,600), Default, "markpado.rc");
    guiFactory()->addClient(m_markpad->m_editor);
    setStandardToolBarMenuEnabled(true);
    
    // FIXME: make sure the config dir exists, any idea how to do it more cleanly?
    QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral("."));    
    
    setAutoSaveSettings();
    readConfig();
    
    slotOpen(url);
    show();
}
Exemple #2
0
MainWindow::~MainWindow()
{
    if(document) {
        guiFactory()->removeClient(view);
        delete document;
    }
}
Exemple #3
0
MainWindow::MainWindow(KTextEditor::Document* doc)
    : document(0),
      view(0)
{
    if(!doc) {
        KTextEditor::Editor* editor = NULL;
        KService::Ptr serv = KService::serviceByDesktopName("yzispart");

        if(!serv) {
            KMessageBox::error(this, "Could not find yzispart!");
            kapp->exit(-1);
        } else {
            editor = KTextEditor::editor(serv->library().toLatin1());

            if(!editor) {
                KMessageBox::error(this, "Could not create yziskpart editor component");
                kapp->exit(-1);
            }
        }

        document = editor->createDocument(0);
    } else {
        document = doc;
    }

    view = qobject_cast< KTextEditor::View* >(document->createView(this));
    setCentralWidget(view);
    guiFactory()->addClient(view);
    show();
}
Exemple #4
0
ArkViewer::~ArkViewer()
{
    if (m_part) {
        QProgressDialog progressDialog(this);
        progressDialog.setWindowTitle(i18n("Closing preview"));
        progressDialog.setLabelText(i18n("Please wait while the preview is being closed..."));

        progressDialog.setMinimumDuration(500);
        progressDialog.setModal(true);
        progressDialog.setCancelButton(nullptr);
        progressDialog.setRange(0, 0);

        // #261785: this preview dialog is not modal, so we need to delete
        //          the previewed file ourselves when the dialog is closed;

        m_part.data()->closeUrl();

        if (!m_fileName.isEmpty()) {
            QFile::remove(m_fileName);
        }
    }

    guiFactory()->removeClient(m_part);
    delete m_part;
}
Exemple #5
0
void KInfoCenter::createToolBar()
{
    KStandardAction::quit(this, SLOT(close()), actionCollection());
    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());

    toolBar()->setMovable(false);

    m_aboutKcm = actionCollection()->addAction("help_about_module");
    m_aboutKcm->setText(i18nc("Information about current module located in about menu","About Current Information Module"));
    m_aboutKcm->setIcon(KIcon("help"));
    m_aboutKcm->setEnabled(false);

    m_exportAction = new KAction(this);
    m_exportAction->setText(i18nc("Export button label", "Export"));
    m_exportAction->setIcon(KIcon("document-export"));

    m_moduleHelpAction = new KAction(this);
    m_moduleHelpAction->setText(i18nc("Module help button label", "Module Help"));
    m_moduleHelpAction->setIcon(KIcon("help-contextual"));

    m_helpAction = new KActionMenu( KIcon("help-contents"), i18nc("Help button label","Help"), this );
    m_helpAction->setDelayed( false );

    actionCollection()->addAction("export", m_exportAction);
    actionCollection()->addAction("helpModule", m_moduleHelpAction);
    actionCollection()->addAction("helpMenu", m_helpAction);
}
void MainWindow::slotEditToolbars()
{
  KEditToolbar dlg(guiFactory());
  if (dlg.exec())
  {
    //setupGUI();
    applyMainWindowSettings( KGlobal::config(), autoSaveGroup() );
  }
}
Exemple #7
0
MainWindow::~MainWindow()
{
    if (m_recentFilesAction) {
        m_recentFilesAction->saveEntries(KSharedConfig::openConfig()->group("Recent Files"));
    }

    guiFactory()->removeClient(m_part);
    delete m_part;
    m_part = 0;
}
Exemple #8
0
KWrite::KWrite(KTextEditor::Document *doc)
    : m_view(0)
    , m_recentFiles(0)
    , m_paShowPath(0)
    , m_paShowMenuBar(0)
    , m_paShowStatusBar(0)
    , m_activityResource(0)
{
    if (!doc) {
        doc = KTextEditor::Editor::instance()->createDocument(0);

        // enable the modified on disk warning dialogs if any
        if (qobject_cast<KTextEditor::ModificationInterface *>(doc)) {
            qobject_cast<KTextEditor::ModificationInterface *>(doc)->setModifiedOnDiskWarning(true);
        }

        docList.append(doc);
    }

    m_view = doc->createView(this);

    setCentralWidget(m_view);

    setupActions();

    // signals for the statusbar
    connect(m_view->document(), &KTextEditor::Document::modifiedChanged, this, &KWrite::modifiedChanged);
    connect(m_view->document(), SIGNAL(documentNameChanged(KTextEditor::Document*)), this, SLOT(documentNameChanged()));
    connect(m_view->document(), SIGNAL(readWriteChanged(KTextEditor::Document*)), this, SLOT(documentNameChanged()));
    connect(m_view->document(), SIGNAL(documentUrlChanged(KTextEditor::Document*)), this, SLOT(urlChanged()));

    setAcceptDrops(true);
    connect(m_view, SIGNAL(dropEventPass(QDropEvent*)), this, SLOT(slotDropEvent(QDropEvent*)));

    setXMLFile(QStringLiteral("kwriteui.rc"));
    createShellGUI(true);
    guiFactory()->addClient(m_view);

    // FIXME: make sure the config dir exists, any idea how to do it more cleanly?
    QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).mkpath(QStringLiteral("."));

    // call it as last thing, must be sure everything is already set up ;)
    setAutoSaveSettings();

    readConfig();

    winList.append(this);

    documentNameChanged();
    show();

    // give view focus
    m_view->setFocus(Qt::OtherFocusReason);
}
Exemple #9
0
void KMarkNote::setupUI()
{
    KConfigGroup cg(KGlobal::config(), "KMarkNote");
    setAutoSaveSettings(cg, true);

    setCentralWidget(m_view);
    setupGUI(QSize(500,600), Default, "kmarknote.rc");
    guiFactory()->addClient(m_view->getEditor());
    setStandardToolBarMenuEnabled(true);
    restoreWindowSize(cg);
}
void KFileReplace::slotConfigureKeys()
{
    KKeyDialog dlg( false, this );
    QPtrList<KXMLGUIClient> clients = guiFactory()->clients();
    for( QPtrListIterator<KXMLGUIClient> it( clients );
            it.current(); ++it )
    {
        dlg.insert( (*it)->actionCollection() );
    }
    dlg.configure();
}
Exemple #11
0
KWrite::~KWrite()
{
    guiFactory()->removeClient(m_view);

    winList.removeAll(this);

    KTextEditor::Document *doc = m_view->document();
    delete m_view;

    // kill document, if last view is closed
    if (doc->views().isEmpty()) {
        docList.removeAll(doc);
        delete doc;
    }

    KSharedConfig::openConfig()->sync();
}
Exemple #12
0
 void GUI::mergePluginGui(Plugin* p)
 {
     if (p->parentPart() == "ktorrent")
     {
         guiFactory()->addClient(p);
     }
     else
     {
         QList<KParts::Part*> parts = part_manager->parts();
         foreach (KParts::Part* part, parts)
         {
             if (part->domDocument().documentElement().attribute(QStringLiteral("name")) == p->parentPart())
             {
                 part->insertChildClient(p);
                 break;
             }
         }
     }
 }
Exemple #13
0
 void GUI::removePluginGui(Plugin* p)
 {
     if (p->parentPart() == "ktorrent")
     {
         guiFactory()->removeClient(p);
     }
     else
     {
         QList<KParts::Part*> parts = part_manager->parts();
         foreach (KParts::Part* part, parts)
         {
             if (part->domDocument().documentElement().attribute("name") == p->parentPart())
             {
                 part->removeChildClient(p);
                 break;
             }
         }
     }
 }
Exemple #14
0
Fichier : kdf.cpp Projet : KDE/kdf
KDFTopLevel::KDFTopLevel(QWidget *)
        : KXmlGuiWindow(0)
{
    kdf = new KDFWidget(this,false);
    Q_CHECK_PTR(kdf);
    QAction *action = actionCollection()->addAction( QLatin1String("updatedf"));
    action->setText( i18nc( "Update action", "&Update" ) );
    actionCollection()->setDefaultShortcuts(action, KStandardShortcut::reload());
    connect(action, SIGNAL(triggered(bool)), kdf, SLOT(updateDF()));

    KStandardAction::quit(this, SLOT(close()), actionCollection());
    KStandardAction::preferences(kdf, SLOT(settingsBtnClicked()), actionCollection());
    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
                                 actionCollection());
    setCentralWidget(kdf);
    //  kdf->setMinimumSize(kdf->sizeHint());
    kdf->resize(kdf->sizeHint());
    setupGUI(KXmlGuiWindow::Keys | StatusBar | Save | Create);
}
Exemple #15
0
MainWindow::MainWindow()
    : m_markpad(0)
    , m_recentFiles(0)
    , m_firstTextChange(false)
{
    m_markpad = new Markpado(this);

    setupAction();
    setupConnect();

    setCentralWidget(m_markpad);
    setupGUI(QSize(500,600), Default, "markpado.rc");
    guiFactory()->addClient(m_markpad->m_editor);
    setStandardToolBarMenuEnabled(true);
    
    setAutoSaveSettings();
    readConfig();

    show();
}
Exemple #16
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();
}
Exemple #17
0
 QWidget* GUI::container(const QString& name)
 {
     return guiFactory()->container(name, this);
 }
Exemple #18
0
TDEWalletManager::TDEWalletManager(TQWidget *parent, const char *name, WFlags f)
: TDEMainWindow(parent, name, f), DCOPObject("TDEWalletManager") {
	TDEGlobal::dirs()->addResourceType("tdewallet", "share/apps/tdewallet");
	_tdewalletdLaunch = false;
	TQAccel *accel = new TQAccel(this, "tdewalletmanager");

	TDEApplication::dcopClient()->setQtBridgeEnabled(false);
	_shuttingDown = false;
	TDEConfig cfg("tdewalletrc"); // not sure why this setting isn't in tdewalletmanagerrc...
	TDEConfigGroup walletConfigGroup(&cfg, "Wallet");
	_dcopRef = 0L;
	if (walletConfigGroup.readBoolEntry("Launch Manager", true)) {
		_tray = new KSystemTray(this, "tdewalletmanager tray");
		_tray->setPixmap(loadSystemTrayIcon("wallet_closed"));
		TQToolTip::add(_tray, i18n("TDE Wallet: No wallets open."));
		connect(_tray, TQT_SIGNAL(quitSelected()), TQT_SLOT(shuttingDown()));
		TQStringList wl = TDEWallet::Wallet::walletList();
		bool isOpen = false;
		for (TQStringList::Iterator it = wl.begin(); it != wl.end(); ++it) {
			if (TDEWallet::Wallet::isOpen(*it)) {
				_tray->setPixmap(loadSystemTrayIcon("wallet_open"));
				TQToolTip::remove(_tray);
				TQToolTip::add(_tray, i18n("TDE Wallet: A wallet is open."));
				isOpen = true;
				break;
			}
		}
		if (!isOpen && kapp->isRestored()) {
			delete _tray;
			_tray = 0L;
			TQTimer::singleShot( 0, kapp, TQT_SLOT( quit()));
			return;
		}
	} else {
		_tray = 0L;
	}

	_iconView = new TDEWalletIconView(this, "tdewalletmanager icon view");
	connect(_iconView, TQT_SIGNAL(executed(TQIconViewItem*)), TQT_TQOBJECT(this), TQT_SLOT(openWallet(TQIconViewItem*)));
	connect(_iconView, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*, const TQPoint&)), TQT_TQOBJECT(this), TQT_SLOT(contextMenu(TQIconViewItem*, const TQPoint&)));

	updateWalletDisplay();
	setCentralWidget(_iconView);
	_iconView->setMinimumSize(320, 200);

	_dcopRef = new DCOPRef("kded", "tdewalletd");
	_dcopRef->dcopClient()->setNotifications(true);
	connect(_dcopRef->dcopClient(),
		TQT_SIGNAL(applicationRemoved(const TQCString&)),
		this,
		TQT_SLOT(possiblyRescan(const TQCString&)));
	connect(_dcopRef->dcopClient(),
		TQT_SIGNAL(applicationRegistered(const TQCString&)),
		this,
		TQT_SLOT(possiblyRescan(const TQCString&)));

	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "allWalletsClosed()", "allWalletsClosed()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletClosed(TQString)", "updateWalletDisplay()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletOpened(TQString)", "aWalletWasOpened()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletDeleted(TQString)", "updateWalletDisplay()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletListDirty()", "updateWalletDisplay()", false);

	// FIXME: slight race - a wallet can open, then we get launched, but the
	//        wallet closes before we are done opening.  We will then stay
	//        open.  Must check that a wallet is still open here.

	new TDEAction(i18n("&New Wallet..."), "tdewalletmanager", 0, TQT_TQOBJECT(this),
			TQT_SLOT(createWallet()), actionCollection(),
			"wallet_create");
	TDEAction *act = new TDEAction(i18n("Configure &Wallet..."), "configure",
			0, TQT_TQOBJECT(this), TQT_SLOT(setupWallet()), actionCollection(),
			"wallet_settings");
	if (_tray) {
		act->plug(_tray->contextMenu());
	}
	act = new TDEAction(i18n("Close &All Wallets"), 0, 0, TQT_TQOBJECT(this),
			TQT_SLOT(closeAllWallets()), actionCollection(),
			"close_all_wallets");
	if (_tray) {
		act->plug(_tray->contextMenu());
	}
	KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(shuttingDown()), actionCollection());
	KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()),
actionCollection());

	createGUI("tdewalletmanager.rc");
	accel->connectItem(accel->insertItem(Key_Return), TQT_TQOBJECT(this), TQT_SLOT(openWallet()));
	accel->connectItem(accel->insertItem(Key_Delete), TQT_TQOBJECT(this), TQT_SLOT(deleteWallet()));

	if (_tray) {
		_tray->show();
	} else {
		show();
	}

	kapp->setName("tdewallet"); // hack to fix docs
}
Exemple #19
0
void Kiten::setupActions()
{
  /* Add the basic quit/print/prefs actions, use the gui factory for keybindings */
  (void) KStandardAction::quit( this, SLOT(close()), actionCollection() );
  //Why the heck is KSA:print adding it's own toolbar!?
  //	(void) KStandardAction::print(this, SLOT(print()), actionCollection());
  (void) KStandardAction::preferences( this, SLOT(slotConfigure()), actionCollection() );
  //old style cast seems needed here, (const QObject*)
  KStandardAction::keyBindings(   (const QObject*)guiFactory()
                                , SLOT(configureShortcuts())
                                , actionCollection() );

  /* Setup the Go-to-learn-mode actions */
  /* TODO: put back when Dictionary Editor is reorganised */
// 	(void) new KAction(   i18n( "&Dictionary Editor..." )
//                             , "document-properties"
//                             , 0
//                             , this
//                             , SLOT(createEEdit())
//                             , actionCollection()
//                             , "dict_editor");
  QAction *radselect = actionCollection()->addAction( "radselect" );
  radselect->setText( i18n( "Radical Selector" ) );
//	radselect->setIcon( "edit-find" );
  actionCollection()->setDefaultShortcut(radselect, Qt::CTRL+Qt::Key_R );
  connect(radselect, &QAction::triggered, this, &Kiten::radicalSearch);

  QAction *kanjibrowser = actionCollection()->addAction( "kanjibrowser" );
  kanjibrowser->setText( i18n( "Kanji Browser" ) );
  actionCollection()->setDefaultShortcut(kanjibrowser, Qt::CTRL+Qt::Key_K );
  connect(kanjibrowser, &QAction::triggered, this, &Kiten::kanjiBrowserSearch);

  /* Setup the Search Actions and our custom Edit Box */
  _inputManager = new SearchStringInput( this );

  QAction *searchButton = actionCollection()->addAction( "search" );
  searchButton->setText( i18n( "S&earch" ) );
  // Set the search button to search
  connect(searchButton, &QAction::triggered, this, &Kiten::searchFromEdit);
  searchButton->setIcon( KStandardGuiItem::find().icon() );

  // That's not it, that's "find as you type"...
//   connect( Edit, SIGNAL(completion(QString)),
//            this,   SLOT(searchFromEdit()) );

  /* Setup our widgets that handle preferences */
//   deinfCB = new KToggleAction(   i18n( "&Deinflect Verbs in Regular Search" )
//                                 , 0
//                                 , this
//                                 , SLOT(kanjiDictChange())
//                                 , actionCollection()
//                                 , "deinf_toggle" );

  _autoSearchToggle = actionCollection()->add<KToggleAction>( "autosearch_toggle" );
  _autoSearchToggle->setText( i18n( "&Automatically Search Clipboard Selections" ) );

  _irAction = actionCollection()->add<QAction>( "search_in_results" );
  _irAction->setText( i18n( "Search &in Results" ) );
  connect(_irAction, &QAction::triggered, this, &Kiten::searchInResults);


  QAction *actionFocusResultsView;
  actionFocusResultsView = actionCollection()->addAction(  "focusresultview"
                                                         , this
                                                         , SLOT(focusResultsView()) );
  actionCollection()->setDefaultShortcut(actionFocusResultsView, Qt::Key_Escape );
  actionFocusResultsView->setText( i18n( "Focus result view" ) );


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

  //TODO: this should probably be a standard action
  /*
  globalShortcutsAction = actionCollection()->addAction( "options_configure_global_keybinding" );
  globalShortcutsAction->setText( i18n( "Configure &Global Shortcuts..." ) );
  connect( globalShortcutsAction, SIGNAL(triggered()), this, SLOT(configureGlobalKeys()) );
  */

  //TODO: implement this
  //_globalSearchAction = actionCollection()->add<KToggleAction>( "search_on_the_spot" );
  //_globalSearchAction->setText( i18n( "On The Spo&t Search" ) );
  //KAction *temp = qobject_cast<KAction*>( _globalSearchAction );
  //KShortcut shrt( "Ctrl+Alt+S" );
  //globalSearchAction->setGlobalShortcut(shrt);  //FIXME: Why does this take ~50 seconds to return!?
  //connect(globalSearchAction, SIGNAL(triggered()), this, SLOT(searchOnTheSpot()));

  _backAction = KStandardAction::back( this, SLOT(back()), actionCollection() );
  _forwardAction = KStandardAction::forward( this, SLOT(forward()), actionCollection() );
  _backAction->setEnabled( false );
  _forwardAction->setEnabled( false );
}
Exemple #20
0
// decoupled from resetActions in toplevel.cpp
// as resetActions simply uses the action groups
// specified in the ui.rc file
void KEBApp::createActions() {

    m_actionsImpl = new ActionsImpl(this, GlobalBookmarkManager::self()->model());

    connect(m_actionsImpl->testLinkHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelTestsEnabled(bool)));
    connect(m_actionsImpl->favIconHolder(), SIGNAL(setCancelEnabled(bool)),
            this, SLOT(setCancelFavIconUpdatesEnabled(bool)));

    // save and quit should probably not be in the toplevel???
    (void) KStandardAction::quit(
        this, SLOT( close() ), actionCollection());
    KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
    (void) KStandardAction::configureToolbars(
        this, SLOT( slotConfigureToolbars() ), actionCollection());

    if (m_browser) {
        (void) KStandardAction::open(
            m_actionsImpl, SLOT( slotLoad() ), actionCollection());
        (void) KStandardAction::saveAs(
            m_actionsImpl, SLOT( slotSaveAs() ), actionCollection());
    }

    (void) KStandardAction::cut(m_actionsImpl, SLOT( slotCut() ), actionCollection());
    (void) KStandardAction::copy(m_actionsImpl, SLOT( slotCopy() ), actionCollection());
    (void) KStandardAction::paste(m_actionsImpl, SLOT( slotPaste() ), actionCollection());

    // actions
    KAction* m_actionsImplDelete = actionCollection()->addAction("delete");
    m_actionsImplDelete->setIcon(KIcon("edit-delete"));
    m_actionsImplDelete->setText(i18n("&Delete"));
    m_actionsImplDelete->setShortcut(Qt::Key_Delete);
    connect(m_actionsImplDelete, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotDelete() ));

    KAction* m_actionsImplRename = actionCollection()->addAction("rename");
    m_actionsImplRename->setIcon(KIcon("edit-rename"));
    m_actionsImplRename->setText(i18n("Rename"));
    m_actionsImplRename->setShortcut(Qt::Key_F2);
    connect(m_actionsImplRename, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRename() ));

    KAction* m_actionsImplChangeURL = actionCollection()->addAction("changeurl");
    m_actionsImplChangeURL->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeURL->setText(i18n("C&hange Location"));
    m_actionsImplChangeURL->setShortcut(Qt::Key_F3);
    connect(m_actionsImplChangeURL, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeURL() ));

    KAction* m_actionsImplChangeComment = actionCollection()->addAction("changecomment");
    m_actionsImplChangeComment->setIcon(KIcon("edit-rename"));
    m_actionsImplChangeComment->setText(i18n("C&hange Comment"));
    m_actionsImplChangeComment->setShortcut(Qt::Key_F4);
    connect(m_actionsImplChangeComment, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeComment() ));

    KAction* m_actionsImplChangeIcon = actionCollection()->addAction("changeicon");
    m_actionsImplChangeIcon->setIcon(KIcon("preferences-desktop-icons"));
    m_actionsImplChangeIcon->setText(i18n("Chan&ge Icon..."));
    connect(m_actionsImplChangeIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotChangeIcon() ));

    KAction* m_actionsImplUpdateFavIcon = actionCollection()->addAction("updatefavicon");
    m_actionsImplUpdateFavIcon->setText(i18n("Update Favicon"));
    connect(m_actionsImplUpdateFavIcon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateFavIcon() ));

    KAction* m_actionsImplRecursiveSort = actionCollection()->addAction("recursivesort");
    m_actionsImplRecursiveSort->setText(i18n("Recursive Sort"));
    connect(m_actionsImplRecursiveSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotRecursiveSort() ));

    KAction* m_actionsImplNewFolder = actionCollection()->addAction("newfolder");
    m_actionsImplNewFolder->setIcon(KIcon("folder-new"));
    m_actionsImplNewFolder->setText(i18n("&New Folder..."));
    m_actionsImplNewFolder->setShortcut(Qt::CTRL+Qt::Key_N);
    connect(m_actionsImplNewFolder, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewFolder() ));

    KAction* m_actionsImplNewBookmark = actionCollection()->addAction("newbookmark");
    m_actionsImplNewBookmark->setIcon(KIcon("bookmark-new"));
    m_actionsImplNewBookmark->setText(i18n("&New Bookmark"));
    connect(m_actionsImplNewBookmark, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotNewBookmark() ));

    KAction* m_actionsImplInsertSeparator = actionCollection()->addAction("insertseparator");
    m_actionsImplInsertSeparator->setText(i18n("&Insert Separator"));
    m_actionsImplInsertSeparator->setShortcut(Qt::CTRL+Qt::Key_I);
    connect(m_actionsImplInsertSeparator, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotInsertSeparator() ));

    KAction* m_actionsImplSort = actionCollection()->addAction("sort");
    m_actionsImplSort->setText(i18n("&Sort Alphabetically"));
    connect(m_actionsImplSort, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSort() ));

    KAction* m_actionsImplSetAsToolbar = actionCollection()->addAction("setastoolbar");
    m_actionsImplSetAsToolbar->setIcon(KIcon("bookmark-toolbar"));
    m_actionsImplSetAsToolbar->setText(i18n("Set as T&oolbar Folder"));
    connect(m_actionsImplSetAsToolbar, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotSetAsToolbar() ));

    KAction* m_actionsImplExpandAll = actionCollection()->addAction("expandall");
    m_actionsImplExpandAll->setText(i18n("&Expand All Folders"));
    connect(m_actionsImplExpandAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExpandAll() ));

    KAction* m_actionsImplCollapseAll = actionCollection()->addAction("collapseall");
    m_actionsImplCollapseAll->setText(i18n("Collapse &All Folders"));
    connect(m_actionsImplCollapseAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCollapseAll() ));

    KAction* m_actionsImplOpenLink = actionCollection()->addAction("openlink");
    m_actionsImplOpenLink->setIcon(KIcon("document-open"));
    m_actionsImplOpenLink->setText(i18n("&Open in Konqueror"));
    connect(m_actionsImplOpenLink, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotOpenLink() ));

    KAction* m_actionsImplTestSelection = actionCollection()->addAction("testlink");
    m_actionsImplTestSelection->setIcon(KIcon("bookmarks"));
    m_actionsImplTestSelection->setText(i18n("Check &Status"));
    connect(m_actionsImplTestSelection, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestSelection() ));

    KAction* m_actionsImplTestAll = actionCollection()->addAction("testall");
    m_actionsImplTestAll->setText(i18n("Check Status: &All"));
    connect(m_actionsImplTestAll, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotTestAll() ));

    KAction* m_actionsImplUpdateAllFavIcons = actionCollection()->addAction("updateallfavicons");
    m_actionsImplUpdateAllFavIcons->setText(i18n("Update All &Favicons"));
    connect(m_actionsImplUpdateAllFavIcons, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotUpdateAllFavIcons() ));

    KAction* m_actionsImplCancelAllTests = actionCollection()->addAction("canceltests");
    m_actionsImplCancelAllTests->setText(i18n("Cancel &Checks"));
    connect(m_actionsImplCancelAllTests, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelAllTests() ));

    KAction* m_actionsImplCancelFavIconUpdates = actionCollection()->addAction("cancelfaviconupdates");
    m_actionsImplCancelFavIconUpdates->setText(i18n("Cancel &Favicon Updates"));
    connect(m_actionsImplCancelFavIconUpdates, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotCancelFavIconUpdates() ));

    KAction* m_actionsImplImportNS = actionCollection()->addAction("importNS");
    m_actionsImplImportNS->setObjectName( QLatin1String("NS" ));
    m_actionsImplImportNS->setIcon(KIcon("netscape"));
    m_actionsImplImportNS->setText(i18n("Import &Netscape Bookmarks..."));
    connect(m_actionsImplImportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportOpera = actionCollection()->addAction("importOpera");
    m_actionsImplImportOpera->setObjectName( QLatin1String("Opera" ));
    m_actionsImplImportOpera->setIcon(KIcon("opera"));
    m_actionsImplImportOpera->setText(i18n("Import &Opera Bookmarks..."));
    connect(m_actionsImplImportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
/*
    KAction* m_actionsImplImportCrashes = actionCollection()->addAction("importCrashes");
    m_actionsImplImportCrashes->setObjectName( QLatin1String("Crashes" ));
    m_actionsImplImportCrashes->setText(i18n("Import All &Crash Sessions as Bookmarks..."));
    connect(m_actionsImplImportCrashes, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));
*/
    KAction* m_actionsImplImportGaleon = actionCollection()->addAction("importGaleon");
    m_actionsImplImportGaleon->setObjectName( QLatin1String("Galeon" ));
    m_actionsImplImportGaleon->setText(i18n("Import &Galeon Bookmarks..."));
    connect(m_actionsImplImportGaleon, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportKDE2 = actionCollection()->addAction("importKDE2");
    m_actionsImplImportKDE2->setObjectName( QLatin1String("KDE2" ));
    m_actionsImplImportKDE2->setIcon(KIcon("kde"));
    m_actionsImplImportKDE2->setText(i18n("Import &KDE 2 or KDE 3 Bookmarks..."));

    connect(m_actionsImplImportKDE2, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportIE = actionCollection()->addAction("importIE");
    m_actionsImplImportIE->setObjectName( QLatin1String("IE" ));
    m_actionsImplImportIE->setText(i18n("Import &Internet Explorer Bookmarks..."));
    connect(m_actionsImplImportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplImportMoz = actionCollection()->addAction("importMoz");
    m_actionsImplImportMoz->setObjectName( QLatin1String("Moz" ));
    m_actionsImplImportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplImportMoz->setText(i18n("Import &Mozilla Bookmarks..."));
    connect(m_actionsImplImportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotImport() ));

    KAction* m_actionsImplExportNS = actionCollection()->addAction("exportNS");
    m_actionsImplExportNS->setIcon(KIcon("netscape"));
    m_actionsImplExportNS->setText(i18n("Export &Netscape Bookmarks"));
    connect(m_actionsImplExportNS, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportNS() ));

    KAction* m_actionsImplExportOpera = actionCollection()->addAction("exportOpera");
    m_actionsImplExportOpera->setIcon(KIcon("opera"));
    m_actionsImplExportOpera->setText(i18n("Export &Opera Bookmarks..."));
    connect(m_actionsImplExportOpera, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportOpera() ));

    KAction* m_actionsImplExportHTML = actionCollection()->addAction("exportHTML");
    m_actionsImplExportHTML->setIcon(KIcon("text-html"));
    m_actionsImplExportHTML->setText(i18n("Export &HTML Bookmarks..."));
    connect(m_actionsImplExportHTML, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportHTML() ));

    KAction* m_actionsImplExportIE = actionCollection()->addAction("exportIE");
    m_actionsImplExportIE->setText(i18n("Export &Internet Explorer Bookmarks..."));
    connect(m_actionsImplExportIE, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportIE() ));

    KAction* m_actionsImplExportMoz = actionCollection()->addAction("exportMoz");
    m_actionsImplExportMoz->setIcon(KIcon("mozilla"));
    m_actionsImplExportMoz->setText(i18n("Export &Mozilla Bookmarks..."));
    connect(m_actionsImplExportMoz, SIGNAL( triggered() ), m_actionsImpl, SLOT( slotExportMoz() ));
}
// public
QPopupMenu *kpMainWindow::selectionToolRMBMenu ()
{
    return (QPopupMenu *) guiFactory ()->container ("selectionToolRMBMenu", this);
}
Exemple #22
0
void TestKHTML::setupActions()
{
    QDomDocument document = m_part->domDocument();
    QDomElement fileMenu = document.documentElement().firstChild().childNodes().item( 0 ).toElement();

    QDomElement quitElement = document.createElement("action");
    quitElement.setAttribute("name",
                             KStandardAction::name(KStandardAction::Quit));
    fileMenu.appendChild(quitElement);

    QDomElement viewMenu = document.documentElement().firstChild().childNodes().item( 2 ).toElement();

    QDomElement element = document.createElement("action");
    element.setAttribute("name", "debugRenderTree");
    viewMenu.appendChild(element);

    element = document.createElement("action");
    element.setAttribute("name", "debugDOMTree");
    viewMenu.appendChild(element);

    QDomElement toolBar = document.documentElement().firstChild().nextSibling().toElement();
    element = document.createElement("action");
    element.setAttribute("name", "editable");
    toolBar.insertBefore(element, toolBar.firstChild());

    element = document.createElement("action");
    element.setAttribute("name", "navigable");
    toolBar.insertBefore(element, toolBar.firstChild());

    element = document.createElement("action");
    element.setAttribute("name", "reload");
    toolBar.insertBefore(element, toolBar.firstChild());

    element = document.createElement("action");
    element.setAttribute("name", "print");
    toolBar.insertBefore(element, toolBar.firstChild());

    KAction *action = new KAction(KIcon("view-refresh"), "Reload", this );
    m_part->actionCollection()->addAction( "reload", action );
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reload()));
    action->setShortcut(Qt::Key_F5);

    KAction *kprint = new KAction(KIcon("document-print"), "Print", this );
    m_part->actionCollection()->addAction( "print", kprint );
    connect(kprint, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(print()));
    kprint->setEnabled(true);

    KToggleAction *ta = new KToggleAction( KIcon("edit-rename"), "Navigable", this );
    actionCollection()->addAction( "navigable", ta );
    ta->setShortcuts( KShortcut() );
    ta->setChecked(m_part->isCaretMode());
    connect(ta, SIGNAL(toggled(bool)), this, SLOT(toggleNavigable(bool)));

    ta = new KToggleAction( KIcon("document-properties"), "Editable", this );
    actionCollection()->addAction( "editable", ta );
    ta->setShortcuts( KShortcut() );
    ta->setChecked(m_part->isEditable());
    connect(ta, SIGNAL(toggled(bool)), this, SLOT(toggleEditable(bool)));

    KStandardAction::quit( kapp, SLOT(quit()), m_part->actionCollection() );

    guiFactory()->addClient(m_part);
}
Exemple #23
0
void Kooka::setupActions()
{

    KStdAction::print(this, SLOT(filePrint()), actionCollection());
    KStdAction::quit(this , SLOT(close()), actionCollection());

    KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), 
actionCollection());
    KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()),
				  actionCollection());
    KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    m_view->createDockMenu(actionCollection(), this, "settings_show_docks" );

    /* Image Viewer action Toolbar - OCR, Scaling etc. */
    (void) new KAction(i18n("&OCR Image..."), "ocr", CTRL+Key_O,
		       m_view, SLOT(doOCR()),
		       actionCollection(), "ocrImage" );

    (void) new KAction(i18n("O&CR on Selection..."), "ocr-select", CTRL+Key_C,
		       m_view, SLOT(doOCRonSelection()),
		       actionCollection(), "ocrImageSelect" );

    KAction *act;
    act =  new KAction(i18n("Scale to W&idth"), "scaletowidth", CTRL+Key_I,
		       m_view, SLOT( slIVScaleToWidth()),
		       actionCollection(), "scaleToWidth" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Scale to &Height"), "scaletoheight", CTRL+Key_H,
		       m_view, SLOT( slIVScaleToHeight()),
		       actionCollection(), "scaleToHeight" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Original &Size"), "scaleorig", CTRL+Key_S,
                      m_view, SLOT( slIVScaleOriginal()),
                      actionCollection(), "scaleOriginal" );
    m_view->connectViewerAction( act );

#ifdef QICONSET_HONOUR_ON_OFF
    /* The Toggleaction does not seem to handle the on/off icon from QIconSet */
    QIconSet lockSet;
    lockSet.setPixmap(BarIcon("lock")  , QIconSet::Automatic, QIconSet::Normal, QIconSet::On );
    lockSet.setPixmap(BarIcon("unlock"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
    act = new KToggleAction ( i18n("Keep &Zoom Setting"), lockSet, CTRL+Key_Z,
                              actionCollection(), "keepZoom" );
#else
    act = new KToggleAction( i18n("Keep &Zoom Setting"), BarIcon("lockzoom"), CTRL+Key_Z,
                             actionCollection(), "keepZoom" );
#endif

    connect( act, SIGNAL( toggled( bool ) ), m_view->getImageViewer(),
             SLOT(setKeepZoom(bool)));

    m_view->connectViewerAction( act );

    /* thumbview and gallery actions */
    act = new KAction(i18n("Set Zoom..."), "viewmag", 0,
		       m_view, SLOT( slIVShowZoomDialog()),
		       actionCollection(), "showZoomDialog" );
    m_view->connectViewerAction( act );

    (void) new KAction(i18n("Create From Selectio&n"), "crop", CTRL+Key_N,
		       m_view, SLOT( slCreateNewImgFromSelection() ),
		       actionCollection(), "createFromSelection" );

    (void) new KAction(i18n("Mirror Image &Vertically"), "mirror-vert", CTRL+Key_V,
		       this, SLOT( slMirrorVertical() ),
		       actionCollection(), "mirrorVertical" );

    (void) new KAction(i18n("&Mirror Image Horizontally"), "mirror-horiz", CTRL+Key_M,
		       this, SLOT( slMirrorHorizontal() ),
		       actionCollection(), "mirrorHorizontal" );

    (void) new KAction(i18n("Mirror Image &Both Directions"), "mirror-both", CTRL+Key_B,
		       this, SLOT( slMirrorBoth() ),
		       actionCollection(), "mirrorBoth" );

    (void) new KAction(i18n("Open Image in &Graphic Application..."), "fileopen", CTRL+Key_G,
		       m_view, SLOT( slOpenCurrInGraphApp() ),
		       actionCollection(), "openInGraphApp" );

    act = new KAction(i18n("&Rotate Image Clockwise"), "rotate_cw", CTRL+Key_R,
		      this, SLOT( slRotateClockWise() ),
		       actionCollection(), "rotateClockwise" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Rotate Image Counter-Clock&wise"), "rotate_ccw", CTRL+Key_W,
		       this, SLOT( slRotateCounterClockWise() ),
		       actionCollection(), "rotateCounterClockwise" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Rotate Image 180 &Degrees"), "rotate", CTRL+Key_D,
		       this, SLOT( slRotate180() ),
		       actionCollection(), "upsitedown" );
    m_view->connectViewerAction( act );

    /* Gallery actions */
    act = new KAction(i18n("&Create Folder..."), "folder_new", 0,
		      m_view->gallery(), SLOT( slotCreateFolder() ),
		       actionCollection(), "foldernew" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Save Image..."), "filesave", 0,
		      m_view->gallery(), SLOT( slotExportFile() ),
		       actionCollection(), "saveImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Import Image..."), "inline_image", 0,
		      m_view->gallery(), SLOT( slotImportFile() ),
		       actionCollection(), "importImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Delete Image"), "edittrash", 0,
		      m_view->gallery(), SLOT( slotDeleteItems() ),
		       actionCollection(), "deleteImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Unload Image"), "fileclose", 0,
		      m_view->gallery(), SLOT( slotUnloadItems() ),
		       actionCollection(), "unloadImage" );
    m_view->connectGalleryAction( act );

#if 0
    /* not yet supported actions - coming post 3.1 */
    (void) new KAction(i18n("&Load Scan Parameters"), "bookmark_add", CTRL+Key_L,
                       m_view, SLOT(slLoadScanParams()),
                       actionCollection(), "loadscanparam" );

    (void) new KAction(i18n("Save &Scan Parameters"), "bookmark_add", CTRL+Key_S,
		       m_view, SLOT(slSaveScanParams()),
		       actionCollection(), "savescanparam" );
#endif

    (void) new KAction(i18n("Select Scan Device"), "scanner", 0,
		       m_view, SLOT( slSelectDevice()),
		       actionCollection(), "selectsource" );

    (void) new KAction( i18n("Enable All Warnings && Messages"), 0,
			this,  SLOT(slEnableWarnings()),
			actionCollection(), "enable_msgs");


    m_saveOCRTextAction = new KAction( i18n("Save OCR Res&ult Text"), "filesaveas", CTRL+Key_U,
                                       m_view, SLOT(slSaveOCRResult()),
                                       actionCollection(), "saveOCRResult");
}
Exemple #24
0
MainWindow::MainWindow()
{
//QTime t = QTime::currentTime();
#ifndef KTIKZ_USE_KDE
	m_aboutDialog = 0;
	m_assistantController = 0;
#endif
	m_configDialog = 0;
	m_isModifiedExternally = false;
	m_insertAction = 0;

	s_mainWindowList.append(this);

#ifndef KTIKZ_USE_KDE
	QStringList themeSearchPaths;
	themeSearchPaths << QDir::homePath() + QLatin1String("/.local/share/icons/");
	themeSearchPaths << QIcon::themeSearchPaths();
	QIcon::setThemeSearchPaths(themeSearchPaths);
#endif

	setAttribute(Qt::WA_DeleteOnClose);
#ifdef KTIKZ_USE_KDE
	setObjectName(QLatin1String("ktikz#"));
	setWindowIcon(KIcon(QLatin1String("ktikz")));
	Action::setActionCollection(actionCollection());
#else
	setObjectName(QLatin1String("qtikz#") + QString::number(s_mainWindowList.size()));
	setWindowIcon(QIcon(QLatin1String(":/icons/qtikz-22.png")));
#endif

	setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
	setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
	setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
	setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

//qCritical() << t.msecsTo(QTime::currentTime());
	m_tikzPreviewController = new TikzPreviewController(this);
//qCritical() << "TikzPreviewController" << t.msecsTo(QTime::currentTime());
	m_tikzEditorView = new TikzEditorView(this);
//qCritical() << "TikzEditorView" << t.msecsTo(QTime::currentTime());
	m_commandInserter = new TikzCommandInserter(this);
	m_tikzHighlighter = new TikzHighlighter(m_tikzEditorView->editor()->document());
	m_userCommandInserter = new UserCommandInserter(this);

	QWidget *mainWidget = new QWidget(this);
	QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
	mainLayout->setSpacing(0);
	mainLayout->setMargin(0);
	mainLayout->addWidget(m_tikzPreviewController->templateWidget());
	mainLayout->addWidget(m_tikzEditorView);

	m_logDock = new QDockWidget(this);
	m_logDock->setObjectName(QLatin1String("LogDock"));
	m_logDock->setAllowedAreas(Qt::AllDockWidgetAreas);
	m_logDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
	m_logDock->setWindowTitle(tr("&Messages"));
	addDockWidget(Qt::BottomDockWidgetArea, m_logDock);
	m_logTextEdit = new LogTextEdit;
	m_logTextEdit->setWhatsThis(tr("<p>The messages produced by "
	                               "LaTeX are shown here.  If your TikZ code contains errors, "
	                               "then a red border will appear and the errors will be "
	                               "highlighted.</p>"));
	m_logDock->setWidget(m_logTextEdit);

	m_previewDock = new QDockWidget(this);
	m_previewDock->setObjectName(QLatin1String("PreviewDock"));
	m_previewDock->setAllowedAreas(Qt::AllDockWidgetAreas);
	m_previewDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
	m_previewDock->setWindowTitle(tr("Previe&w"));
	m_previewDock->setWidget(m_tikzPreviewController->tikzPreview());
	addDockWidget(Qt::RightDockWidgetArea, m_previewDock);

	setCentralWidget(mainWidget);

	createActions();
#ifndef KTIKZ_USE_KDE
	createToolBars(); // run first in order to be able to add file/editToolBar->toggleViewAction() to the menu
	createMenus();
#endif
//qCritical() << "createMenus" << t.msecsTo(QTime::currentTime());
	createCommandInsertWidget(); // must happen after createMenus and before readSettings
	createStatusBar();

#ifdef KTIKZ_USE_KDE
	setupGUI(ToolBar | Keys | StatusBar | Save);
	setXMLFile(QLatin1String("ktikzui.rc"));
	createGUI();
	guiFactory()->addClient(this);
#endif
	setTabOrder(m_tikzPreviewController->templateWidget()->lastTabOrderWidget(), m_tikzEditorView->editor());

	connect(m_commandInserter, SIGNAL(showStatusMessage(QString,int)),
	        statusBar(), SLOT(showMessage(QString,int)));

	connect(m_tikzEditorView, SIGNAL(modificationChanged(bool)),
	        this, SLOT(setDocumentModified(bool)));
	connect(m_tikzEditorView, SIGNAL(cursorPositionChanged(int,int)),
	        this, SLOT(showCursorPosition(int,int)));
	connect(m_tikzEditorView, SIGNAL(showStatusMessage(QString,int)),
	        statusBar(), SLOT(showMessage(QString,int)));

	connect(m_tikzEditorView, SIGNAL(focusIn()),
	        this, SLOT(checkForFileChanges()));
	connect(m_tikzEditorView, SIGNAL(focusOut()),
	        this, SLOT(saveLastInternalModifiedDateTime()));

	connect(m_tikzPreviewController, SIGNAL(updateLog(QString,bool)),
	        m_logTextEdit, SLOT(updateLog(QString,bool)));
	connect(m_tikzPreviewController, SIGNAL(appendLog(QString,bool)),
	        m_logTextEdit, SLOT(appendLog(QString,bool)));
	connect(m_tikzPreviewController, SIGNAL(showMouseCoordinates(qreal,qreal,int,int)),
	        this, SLOT(showMouseCoordinates(qreal,qreal,int,int)));

	connect(m_userCommandInserter, SIGNAL(updateCompleter()),
	        this, SLOT(updateCompleter()));

	readSettings(); // must be run after defining tikzController and tikzHighlighter, and after creating the toolbars, and after the connects
//qCritical() << "readSettings()" << t.msecsTo(QTime::currentTime());

	setCurrentUrl(Url());
	setDocumentModified(false);
	saveLastInternalModifiedDateTime();
	m_tikzEditorView->editor()->setFocus();

	// delayed initialization
//	QTimer::singleShot(0, this, SLOT(init())); // this causes flicker at startup and init() is not executed in a separate thread anyway :(
	init();
//qCritical() << "mainwindow" << t.msecsTo(QTime::currentTime());
}
Exemple #25
0
void
KMixWindow::initActions()
{
  // file menu
  KStandardAction::quit(this, SLOT(quit()), actionCollection());

  // settings menu
  _actionShowMenubar = KStandardAction::showMenubar(this, SLOT(toggleMenuBar()),
      actionCollection());
  //actionCollection()->addAction( a->objectName(), a );
  KStandardAction::preferences(this, SLOT(showSettings()), actionCollection());
  KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
      actionCollection());
  KAction* action = actionCollection()->addAction("launch_kdesoundsetup");
  action->setText(i18n("Audio Setup"));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotKdeAudioSetupExec()));

  action = actionCollection()->addAction("hwinfo");
  action->setText(i18n("Hardware &Information"));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotHWInfo()));
  action = actionCollection()->addAction("hide_kmixwindow");
  action->setText(i18n("Hide Mixer Window"));
  connect(action, SIGNAL(triggered(bool)), SLOT(hideOrClose()));
  action->setShortcut(QKeySequence(Qt::Key_Escape));
  action = actionCollection()->addAction("toggle_channels_currentview");
  action->setText(i18n("Configure &Channels..."));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotConfigureCurrentView()));
  action = actionCollection()->addAction("select_master");
  action->setText(i18n("Select Master Channel..."));
  connect(action, SIGNAL(triggered(bool)), SLOT(slotSelectMaster()));

  action = actionCollection()->addAction("save_1");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_1));
  action->setText(i18n("Save volume profile 1"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes1()));

  action = actionCollection()->addAction("save_2");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_2));
  action->setText(i18n("Save volume profile 2"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes2()));

  action = actionCollection()->addAction("save_3");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_3));
  action->setText(i18n("Save volume profile 3"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes3()));

  action = actionCollection()->addAction("save_4");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_4));
  action->setText(i18n("Save volume profile 4"));
  connect(action, SIGNAL(triggered(bool)), SLOT(saveVolumes4()));

  action = actionCollection()->addAction("load_1");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_1));
  action->setText(i18n("Load volume profile 1"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes1()));

  action = actionCollection()->addAction("load_2");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_2));
  action->setText(i18n("Load volume profile 2"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes2()));

  action = actionCollection()->addAction("load_3");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_3));
  action->setText(i18n("Load volume profile 3"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes3()));

  action = actionCollection()->addAction("load_4");
  action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_4));
  action->setText(i18n("Load volume profile 4"));
  connect(action, SIGNAL(triggered(bool)), SLOT(loadVolumes4()));

  osdWidget = new OSDWidget();

  createGUI(QLatin1String("kmixui.rc"));
}