KActionMenu *TabBar::setupHistoryActions() { MainWindow *w = rApp->mainWindow(); MainView *mv = qobject_cast<MainView *>(parent()); QAction *openLastClosedTabAction = w->actionByName(QL1S("open_last_closed_tab")); bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0); openLastClosedTabAction->setEnabled(closedTabsAvailable); KActionMenu *am = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this); am->setDelayed(false); am->setEnabled(closedTabsAvailable); if (am->menu()) am->menu()->clear(); if (!closedTabsAvailable) return am; for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i) { TabHistory item = mv->recentlyClosedTabs().at(i); KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this); a->setData(i); connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab())); am->addAction(a); } return am; }
void TabBar::setupHistoryActions() { MainWindow *w = Application::instance()->mainWindow(); MainView *mv = qobject_cast<MainView *>(parent()); QAction *openLastClosedTabAction = w->actionByName( QL1S("open_last_closed_tab") ); openLastClosedTabAction->setEnabled( mv->recentlyClosedTabs().size() > 0 ); // update closed tabs menu KActionMenu *am = qobject_cast<KActionMenu *>( w->actionByName( QL1S("closed_tab_menu") )); if (!am) return; bool isEnabled = ( mv->recentlyClosedTabs().size() > 0 ); am->setEnabled(isEnabled); if (am->menu()) am->menu()->clear(); if(!isEnabled) return; Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs()) { KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this); a->setData(item.url); connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab())); am->addAction(a); } }
void TwitterPostWidget::checkAnchor(const QUrl& url) { QString scheme = url.scheme(); TwitterApiMicroBlog* blog = qobject_cast<TwitterApiMicroBlog*>(currentAccount()->microblog()); TwitterApiAccount *account = qobject_cast<TwitterApiAccount*>(currentAccount()); if( scheme == "tag" ) { blog->searchBackend()->requestSearchResults(currentAccount(), KUrl::fromPunycode(url.host().toUtf8()), (int)TwitterSearch::ReferenceHashtag); } else if(scheme == "user") { KMenu menu; KAction * info = new KAction( KIcon("user-identity"), i18nc("Who is user", "Who is %1", url.host()), &menu ); KAction * from = new KAction(KIcon("edit-find-user"), i18nc("Posts from user", "Posts from %1",url.host()), &menu); KAction * to = new KAction(KIcon("meeting-attending"), i18nc("Replies to user", "Replies to %1", url.host()), &menu); KAction *cont = new KAction(KIcon("user-properties"),i18nc("Including user name", "Including %1", url.host()), &menu); KAction * openInBrowser = new KAction(KIcon("applications-internet"), i18nc("Open profile page in browser", "Open profile in browser"), &menu); from->setData(TwitterSearch::FromUser); to->setData(TwitterSearch::ToUser); cont->setData(TwitterSearch::ReferenceUser); menu.addAction(info); menu.addAction(from); menu.addAction(to); menu.addAction(cont); menu.addAction(openInBrowser); //Subscribe/UnSubscribe/Block bool isSubscribe = false; QString accountUsername = currentAccount()->username().toLower(); QString postUsername = url.host().toLower(); KAction *subscribe = 0, *block = 0, *replyTo = 0, *dMessage = 0; if(accountUsername != postUsername){ menu.addSeparator(); QMenu *actionsMenu = menu.addMenu(KIcon("applications-system"), i18n("Actions")); replyTo = new KAction(KIcon("edit-undo"), i18nc("Write a message to user attention", "Write to %1", url.host()), actionsMenu); actionsMenu->addAction(replyTo); if( account->friendsList().contains( url.host(), Qt::CaseInsensitive ) ){ dMessage = new KAction(KIcon("mail-message-new"), i18nc("Send direct message to user", "Send private message to %1", url.host()), actionsMenu); actionsMenu->addAction(dMessage); isSubscribe = false;//It's UnSubscribe subscribe = new KAction( KIcon("list-remove-user"), i18nc("Unfollow user", "Unfollow %1", url.host()), actionsMenu); } else { isSubscribe = true; subscribe = new KAction( KIcon("list-add-user"), i18nc("Follow user", "Follow %1", url.host()), actionsMenu); } block = new KAction( KIcon("dialog-cancel"), i18nc("Block user", "Block %1", url.host()), actionsMenu); actionsMenu->addAction(subscribe); actionsMenu->addAction(block); } QAction * ret = menu.exec(QCursor::pos()); if(ret == 0) return; if(ret == info) { TwitterApiWhoisWidget *wd = new TwitterApiWhoisWidget(account, url.host(), currentPost(), this); wd->show(QCursor::pos()); return; } else if(ret == subscribe){ if(isSubscribe) { blog->createFriendship(currentAccount(), url.host()); } else { blog->destroyFriendship(currentAccount(), url.host()); } return; }else if(ret == block){ blog->blockUser(currentAccount(), url.host()); return; } else if(ret == openInBrowser){ Choqok::openUrl( QUrl( currentAccount()->microblog()->profileUrl(currentAccount(), url.host()) ) ); return; } else if(ret == replyTo){ emit reply( QString("@%1").arg(url.host()), QString() ); return; } else if(ret == dMessage){ blog->showDirectMessageDialog(account,url.host()); return; } int type = ret->data().toInt(); blog->searchBackend()->requestSearchResults(currentAccount(), url.host(), type); } else TwitterApiPostWidget::checkAnchor(url); }
MediaWidget::MediaWidget(KMenu *menu_, KToolBar *toolBar, KActionCollection *collection, QWidget *parent) : QWidget(parent), menu(menu_), displayMode(NormalMode), automaticResize(ResizeOff), blockBackendUpdates(false), muted(false), screenSaverSuspended(false), showElapsedTime(true) { dummySource.reset(new MediaSource()); source = dummySource.data(); QBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); QPalette palette = QWidget::palette(); palette.setColor(backgroundRole(), Qt::black); setPalette(palette); setAutoFillBackground(true); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); backend = VlcMediaWidget::createVlcMediaWidget(this); if (backend == NULL) { backend = new DummyMediaWidget(this); } backend->connectToMediaWidget(this); layout->addWidget(backend); osdWidget = new OsdWidget(this); actionPrevious = new KAction(KIcon(QLatin1String("media-skip-backward")), i18n("Previous"), this); actionPrevious->setShortcut(KShortcut(Qt::Key_PageUp, Qt::Key_MediaPrevious)); connect(actionPrevious, SIGNAL(triggered()), this, SLOT(previous())); toolBar->addAction(collection->addAction(QLatin1String("controls_previous"), actionPrevious)); menu->addAction(actionPrevious); actionPlayPause = new KAction(this); actionPlayPause->setShortcut(KShortcut(Qt::Key_Space, Qt::Key_MediaPlay)); textPlay = i18n("Play"); textPause = i18n("Pause"); iconPlay = KIcon(QLatin1String("media-playback-start")); iconPause = KIcon(QLatin1String("media-playback-pause")); connect(actionPlayPause, SIGNAL(triggered(bool)), this, SLOT(pausedChanged(bool))); toolBar->addAction(collection->addAction(QLatin1String("controls_play_pause"), actionPlayPause)); menu->addAction(actionPlayPause); actionStop = new KAction(KIcon(QLatin1String("media-playback-stop")), i18n("Stop"), this); actionStop->setShortcut(KShortcut(Qt::Key_Backspace, Qt::Key_MediaStop)); connect(actionStop, SIGNAL(triggered()), this, SLOT(stop())); toolBar->addAction(collection->addAction(QLatin1String("controls_stop"), actionStop)); menu->addAction(actionStop); actionNext = new KAction(KIcon(QLatin1String("media-skip-forward")), i18n("Next"), this); actionNext->setShortcut(KShortcut(Qt::Key_PageDown, Qt::Key_MediaNext)); connect(actionNext, SIGNAL(triggered()), this, SLOT(next())); toolBar->addAction(collection->addAction(QLatin1String("controls_next"), actionNext)); menu->addAction(actionNext); menu->addSeparator(); fullScreenAction = new KAction(KIcon(QLatin1String("view-fullscreen")), i18nc("'Playback' menu", "Full Screen Mode"), this); fullScreenAction->setShortcut(Qt::Key_F); connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); menu->addAction(collection->addAction(QLatin1String("view_fullscreen"), fullScreenAction)); minimalModeAction = new KAction(KIcon(QLatin1String("view-fullscreen")), i18nc("'Playback' menu", "Minimal Mode"), this); minimalModeAction->setShortcut(Qt::Key_Period); connect(minimalModeAction, SIGNAL(triggered()), this, SLOT(toggleMinimalMode())); menu->addAction(collection->addAction(QLatin1String("view_minimal_mode"), minimalModeAction)); audioStreamBox = new KComboBox(toolBar); connect(audioStreamBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentAudioStreamChanged(int))); toolBar->addWidget(audioStreamBox); audioStreamModel = new QStringListModel(toolBar); audioStreamBox->setModel(audioStreamModel); subtitleBox = new KComboBox(toolBar); textSubtitlesOff = i18nc("subtitle selection entry", "off"); connect(subtitleBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentSubtitleChanged(int))); toolBar->addWidget(subtitleBox); subtitleModel = new QStringListModel(toolBar); subtitleBox->setModel(subtitleModel); KMenu *audioMenu = new KMenu(i18nc("'Playback' menu", "Audio"), this); KAction *action = new KAction(KIcon(QLatin1String("audio-volume-high")), i18nc("'Audio' menu", "Increase Volume"), this); action->setShortcut(KShortcut(Qt::Key_Plus, Qt::Key_VolumeUp)); connect(action, SIGNAL(triggered()), this, SLOT(increaseVolume())); audioMenu->addAction(collection->addAction(QLatin1String("controls_increase_volume"), action)); action = new KAction(KIcon(QLatin1String("audio-volume-low")), i18nc("'Audio' menu", "Decrease Volume"), this); action->setShortcut(KShortcut(Qt::Key_Minus, Qt::Key_VolumeDown)); connect(action, SIGNAL(triggered()), this, SLOT(decreaseVolume())); audioMenu->addAction(collection->addAction(QLatin1String("controls_decrease_volume"), action)); muteAction = new KAction(i18nc("'Audio' menu", "Mute Volume"), this); mutedIcon = KIcon(QLatin1String("audio-volume-muted")); unmutedIcon = KIcon(QLatin1String("audio-volume-medium")); muteAction->setIcon(unmutedIcon); muteAction->setShortcut(KShortcut(Qt::Key_M, Qt::Key_VolumeMute)); connect(muteAction, SIGNAL(triggered()), this, SLOT(mutedChanged())); toolBar->addAction(collection->addAction(QLatin1String("controls_mute_volume"), muteAction)); audioMenu->addAction(muteAction); menu->addMenu(audioMenu); KMenu *videoMenu = new KMenu(i18nc("'Playback' menu", "Video"), this); menu->addMenu(videoMenu); menu->addSeparator(); deinterlaceAction = new KAction(KIcon(QLatin1String("format-justify-center")), i18nc("'Video' menu", "Deinterlace"), this); deinterlaceAction->setCheckable(true); deinterlaceAction->setChecked( KGlobal::config()->group("MediaObject").readEntry("Deinterlace", true)); deinterlaceAction->setShortcut(Qt::Key_I); connect(deinterlaceAction, SIGNAL(toggled(bool)), this, SLOT(deinterlacingChanged(bool))); backend->setDeinterlacing(deinterlaceAction->isChecked()); videoMenu->addAction(collection->addAction(QLatin1String("controls_deinterlace"), deinterlaceAction)); KMenu *aspectMenu = new KMenu(i18nc("'Video' menu", "Aspect Ratio"), this); QActionGroup *aspectGroup = new QActionGroup(this); connect(aspectGroup, SIGNAL(triggered(QAction*)), this, SLOT(aspectRatioChanged(QAction*))); action = new KAction(i18nc("'Aspect Ratio' menu", "Automatic"), aspectGroup); action->setCheckable(true); action->setChecked(true); action->setData(AspectRatioAuto); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_auto"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "Fit to Window"), aspectGroup); action->setCheckable(true); action->setData(AspectRatioWidget); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_widget"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "4:3"), aspectGroup); action->setCheckable(true); action->setData(AspectRatio4_3); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_4_3"), action)); action = new KAction(i18nc("'Aspect Ratio' menu", "16:9"), aspectGroup); action->setCheckable(true); action->setData(AspectRatio16_9); aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_16_9"), action)); // Changes aspect ratio "a la VLC" currentAspectRatio=AspectRatioAuto; action = new KAction(KIcon(QLatin1String("chainAspectRatio")), i18nc("'Aspect Ratio' menu", "Chain ratio"), this); action->setShortcut(Qt::CTRL+Qt::Key_A); connect(action, SIGNAL(triggered()), this, SLOT(chainAspectRatio())); aspectMenu->addAction(collection->addAction(QLatin1String("chainAspectRatio"), action)); // Switches scale "a la VLC" currentAspectRatio=AspectRatioAuto; action = new KAction(KIcon(QLatin1String("switchScale")), i18nc("'Aspect Ratio' menu", "Switch scale"), this); action->setShortcut(Qt::SHIFT+Qt::Key_O); connect(action, SIGNAL(triggered()), this, SLOT(switchScale())); aspectMenu->addAction(collection->addAction(QLatin1String("switchScale"), action)); videoMenu->addMenu(aspectMenu); KMenu *autoResizeMenu = new KMenu(i18n("Automatic Resize"), this); QActionGroup *autoResizeGroup = new QActionGroup(this); // we need an event even if you select the currently selected item autoResizeGroup->setExclusive(false); connect(autoResizeGroup, SIGNAL(triggered(QAction*)), this, SLOT(autoResizeTriggered(QAction*))); action = new KAction(i18nc("automatic resize", "Off"), autoResizeGroup); action->setCheckable(true); action->setData(0); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_off"), action)); action = new KAction(i18nc("automatic resize", "Original Size"), autoResizeGroup); action->setCheckable(true); action->setData(1); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_original"), action)); action = new KAction(i18nc("automatic resize", "Double Size"), autoResizeGroup); action->setCheckable(true); action->setData(2); autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_double"), action)); int autoResizeFactor = KGlobal::config()->group("MediaObject").readEntry("AutoResizeFactor", 0); switch (autoResizeFactor) { case 1: automaticResize = OriginalSize; autoResizeGroup->actions().at(1)->setChecked(true); break; case 2: automaticResize = DoubleSize; autoResizeGroup->actions().at(2)->setChecked(true); break; default: automaticResize = ResizeOff; autoResizeGroup->actions().at(0)->setChecked(true); break; } videoMenu->addMenu(autoResizeMenu); action = new KAction(i18n("Volume Slider"), this); volumeSlider = new QSlider(toolBar); volumeSlider->setFocusPolicy(Qt::NoFocus); volumeSlider->setOrientation(Qt::Horizontal); volumeSlider->setRange(0, 100); volumeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); volumeSlider->setToolTip(action->text()); volumeSlider->setValue(KGlobal::config()->group("MediaObject").readEntry("Volume", 100)); connect(volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int))); backend->setVolume(volumeSlider->value()); action->setDefaultWidget(volumeSlider); toolBar->addAction(collection->addAction(QLatin1String("controls_volume_slider"), action)); jumpToPositionAction = new KAction(KIcon(QLatin1String("go-jump")), i18nc("@action:inmenu", "Jump to Position..."), this); jumpToPositionAction->setShortcut(Qt::CTRL + Qt::Key_J); connect(jumpToPositionAction, SIGNAL(triggered()), this, SLOT(jumpToPosition())); menu->addAction(collection->addAction(QLatin1String("controls_jump_to_position"), jumpToPositionAction)); navigationMenu = new KMenu(i18nc("playback menu", "Skip"), this); menu->addMenu(navigationMenu); menu->addSeparator(); int shortSkipDuration = Configuration::instance()->getShortSkipDuration(); int longSkipDuration = Configuration::instance()->getLongSkipDuration(); connect(Configuration::instance(), SIGNAL(shortSkipDurationChanged(int)), this, SLOT(shortSkipDurationChanged(int))); connect(Configuration::instance(), SIGNAL(longSkipDurationChanged(int)), this, SLOT(longSkipDurationChanged(int))); longSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")), i18nc("submenu of 'Skip'", "Skip %1s Backward", longSkipDuration), this); longSkipBackwardAction->setShortcut(Qt::SHIFT + Qt::Key_Left); connect(longSkipBackwardAction, SIGNAL(triggered()), this, SLOT(longSkipBackward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_long_skip_backward"), longSkipBackwardAction)); shortSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")), i18nc("submenu of 'Skip'", "Skip %1s Backward", shortSkipDuration), this); shortSkipBackwardAction->setShortcut(Qt::Key_Left); connect(shortSkipBackwardAction, SIGNAL(triggered()), this, SLOT(shortSkipBackward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_skip_backward"), shortSkipBackwardAction)); shortSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")), i18nc("submenu of 'Skip'", "Skip %1s Forward", shortSkipDuration), this); shortSkipForwardAction->setShortcut(Qt::Key_Right); connect(shortSkipForwardAction, SIGNAL(triggered()), this, SLOT(shortSkipForward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_skip_forward"), shortSkipForwardAction)); longSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")), i18nc("submenu of 'Skip'", "Skip %1s Forward", longSkipDuration), this); longSkipForwardAction->setShortcut(Qt::SHIFT + Qt::Key_Right); connect(longSkipForwardAction, SIGNAL(triggered()), this, SLOT(longSkipForward())); navigationMenu->addAction( collection->addAction(QLatin1String("controls_long_skip_forward"), longSkipForwardAction)); toolBar->addAction(KIcon(QLatin1String("player-time")), i18n("Seek Slider"))->setEnabled(false); action = new KAction(i18n("Seek Slider"), this); seekSlider = new SeekSlider(toolBar); seekSlider->setFocusPolicy(Qt::NoFocus); seekSlider->setOrientation(Qt::Horizontal); seekSlider->setToolTip(action->text()); connect(seekSlider, SIGNAL(valueChanged(int)), this, SLOT(seek(int))); action->setDefaultWidget(seekSlider); toolBar->addAction(collection->addAction(QLatin1String("controls_position_slider"), action)); menuAction = new KAction(KIcon(QLatin1String("media-optical-video")), i18nc("dvd navigation", "DVD Menu"), this); connect(menuAction, SIGNAL(triggered()), this, SLOT(toggleMenu())); menu->addAction(collection->addAction(QLatin1String("controls_toggle_menu"), menuAction)); titleMenu = new KMenu(i18nc("dvd navigation", "Title"), this); titleGroup = new QActionGroup(this); connect(titleGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentTitleChanged(QAction*))); menu->addMenu(titleMenu); chapterMenu = new KMenu(i18nc("dvd navigation", "Chapter"), this); chapterGroup = new QActionGroup(this); connect(chapterGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentChapterChanged(QAction*))); menu->addMenu(chapterMenu); angleMenu = new KMenu(i18nc("dvd navigation", "Angle"), this); angleGroup = new QActionGroup(this); connect(angleGroup, SIGNAL(triggered(QAction*)), this, SLOT(currentAngleChanged(QAction*))); menu->addMenu(angleMenu); action = new KAction(i18n("Switch between elapsed and remaining time display"), this); timeButton = new QPushButton(toolBar); timeButton->setFocusPolicy(Qt::NoFocus); timeButton->setToolTip(action->text()); connect(timeButton, SIGNAL(clicked(bool)), this, SLOT(timeButtonClicked())); action->setDefaultWidget(timeButton); toolBar->addAction(collection->addAction(QLatin1String("controls_time_button"), action)); QTimer *timer = new QTimer(this); timer->start(50000); connect(timer, SIGNAL(timeout()), this, SLOT(checkScreenSaver())); }
void WebView::contextMenuEvent(QContextMenuEvent *event) { m_contextMenuHitResult = page()->mainFrame()->hitTestContent(event->pos()); if (m_contextMenuHitResult.isContentEditable()) { // Check to see if handled by speller if (popupSpellMenu(event)) return; } WebWindow *webwin = m_parentTab->webWindow(); KMenu menu(this); KAction *sendByMailAction = new KAction(&menu); sendByMailAction->setIcon(KIcon("mail-send")); connect(sendByMailAction, SIGNAL(triggered(bool)), this, SLOT(sendByMail())); // Choose right context int resultHit = 0; if (m_contextMenuHitResult.linkUrl().isEmpty()) resultHit = WebView::EmptySelection; else resultHit = WebView::LinkSelection; if (!m_contextMenuHitResult.pixmap().isNull()) resultHit |= WebView::ImageSelection; if (m_contextMenuHitResult.isContentSelected()) resultHit = WebView::TextSelection; // -------------------------------------------------------------------------------- // Ok, let's start filling up the menu... // is content editable? Add PASTE if (m_contextMenuHitResult.isContentEditable()) { menu.addAction(pageAction(KWebPage::Paste)); menu.addSeparator(); } QAction *a; // EMPTY PAGE ACTIONS ------------------------------------------------------------- if (resultHit == WebView::EmptySelection) { // send by mail: page url sendByMailAction->setData(page()->currentFrame()->url()); sendByMailAction->setText(i18n("Share page URL")); // navigation QWebHistory *history = page()->history(); if (history->canGoBack()) { menu.addAction(pageAction(KWebPage::Back)); } if (history->canGoForward()) { menu.addAction(pageAction(KWebPage::Forward)); } menu.addAction(pageAction(KWebPage::Reload)); menu.addSeparator(); // Frame KActionMenu *frameMenu = new KActionMenu(i18n("Current Frame"), &menu); frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow)); a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), &menu); connect(a, SIGNAL(triggered()), m_parentTab, SLOT(printFrame())); frameMenu->addAction(a); menu.addAction(frameMenu); menu.addSeparator(); // Page Actions menu.addAction(pageAction(KWebPage::SelectAll)); if (webwin) menu.addAction(webwin->actionByName(KStandardAction::name(KStandardAction::Save))); if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList()) { a = new KAction(KIcon("kget"), i18n("List All Links"), &menu); connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet())); menu.addAction(a); } if (webwin) { menu.addAction(webwin->actionByName("page_source")); menu.addAction(webwin->actionByName("web_inspector")); } } // LINK ACTIONS ------------------------------------------------------------------- if (resultHit & WebView::LinkSelection) { // send by mail: link url sendByMailAction->setData(m_contextMenuHitResult.linkUrl()); sendByMailAction->setText(i18n("Share link")); a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), &menu); a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); menu.addAction(a); a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), &menu); a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); if (!m_parentTab->isWebApp()) { a = new KAction(KIcon("view-media-artist"), i18n("Open in Private &Window"), &menu); a->setData(m_contextMenuHitResult.linkUrl()); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInPrivateWindow())); menu.addAction(a); }
void MainWindow::setupActions() { KAction *newDownloadAction = actionCollection()->addAction("new_download"); newDownloadAction->setText(i18n("&New Download...")); newDownloadAction->setIcon(KIcon("document-new")); newDownloadAction->setShortcuts(KShortcut("Ctrl+N")); newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the list")); connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer())); KAction *openAction = actionCollection()->addAction("import_transfers"); openAction->setText(i18n("&Import Transfers...")); openAction->setIcon(KIcon("document-open")); openAction->setShortcuts(KShortcut("Ctrl+I")); openAction->setHelpText(i18n("Imports a list of transfers")); connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers())); KAction *exportAction = actionCollection()->addAction("export_transfers"); exportAction->setText(i18n("&Export Transfers List...")); exportAction->setIcon(KIcon("document-export")); exportAction->setShortcuts(KShortcut("Ctrl+E")); exportAction->setHelpText(i18n("Exports the current transfers into a file")); connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers())); KAction *createMetalinkAction = actionCollection()->addAction("create_metalink"); createMetalinkAction->setText(i18n("&Create a Metalink...")); createMetalinkAction->setIcon(KIcon("journal-new")); createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves it on disk")); connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink())); KAction *priorityTop = actionCollection()->addAction("priority_top"); priorityTop->setText(i18n("Top Priority")); priorityTop->setIcon(KIcon("arrow-up-double")); priorityTop->setShortcuts(KShortcut("Ctrl+PgUp")); priorityTop->setHelpText(i18n("Download selected transfer first")); connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop())); KAction *priorityBottom = actionCollection()->addAction("priority_bottom"); priorityBottom->setText(i18n("Least Priority")); priorityBottom->setIcon(KIcon("arrow-down-double")); priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown")); priorityBottom->setHelpText(i18n("Download selected transfer last")); connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom())); KAction *priorityUp = actionCollection()->addAction("priority_up"); priorityUp->setText(i18n("Increase Priority")); priorityUp->setIcon(KIcon("arrow-up")); priorityUp->setShortcuts(KShortcut("Ctrl+Up")); priorityUp->setHelpText(i18n("Increase priority for selected transfer")); connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp())); KAction *priorityDown = actionCollection()->addAction("priority_down"); priorityDown->setText(i18n("Decrease Priority")); priorityDown->setIcon(KIcon("arrow-down")); priorityDown->setShortcuts(KShortcut("Ctrl+Down")); priorityDown->setHelpText(i18n("Decrease priority for selected transfer")); connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown())); //FIXME: Not needed maybe because the normal delete already deletes groups? KAction *deleteGroupAction = actionCollection()->addAction("delete_groups"); deleteGroupAction->setText(i18n("Delete Group")); deleteGroupAction->setIcon(KIcon("edit-delete")); deleteGroupAction->setHelpText(i18n("Delete selected group")); connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup())); KAction *renameGroupAction = actionCollection()->addAction("rename_groups"); renameGroupAction->setText(i18n("Rename Group...")); renameGroupAction->setIcon(KIcon("edit-rename")); connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup())); KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups"); setIconGroupAction->setText(i18n("Set Icon...")); setIconGroupAction->setIcon(KIcon("preferences-desktop-icons")); setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected group")); connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup())); m_autoPasteAction = new KToggleAction(KIcon("edit-paste"), i18n("Auto-Paste Mode"), actionCollection()); actionCollection()->addAction("auto_paste", m_autoPasteAction); m_autoPasteAction->setChecked(Settings::autoPaste()); m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode " "on and off.\nWhen set, KGet will periodically scan " "the clipboard for URLs and paste them automatically.")); connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste())); m_konquerorIntegration = new KToggleAction(KIcon("konqueror"), i18n("Use KGet as Konqueror Download Manager"), actionCollection()); actionCollection()->addAction("konqueror_integration", m_konquerorIntegration); connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool))); m_konquerorIntegration->setChecked(Settings::konquerorIntegration()); // local - Destroys all sub-windows and exits KStandardAction::quit(this, SLOT(slotQuit()), actionCollection()); // local - Standard configure actions KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection()); m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection()); m_menubarAction->setChecked(!menuBar()->isHidden()); // Transfer related actions actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_viewsContainer, SLOT(selectAll())); KAction *deleteSelectedAction = actionCollection()->addAction("delete_selected_download"); deleteSelectedAction->setText(i18nc("delete selected transfer item", "Remove Selected")); deleteSelectedAction->setIcon(KIcon("edit-delete")); deleteSelectedAction->setShortcuts(KShortcut("Del")); deleteSelectedAction->setHelpText(i18n("Removes selected transfer and deletes files from disk if it's not finished")); connect(deleteSelectedAction, SIGNAL(triggered()), SLOT(slotDeleteSelected())); KAction *deleteAllFinishedAction = actionCollection()->addAction("delete_all_finished"); deleteAllFinishedAction->setText(i18nc("delete all finished transfers", "Remove All Finished")); deleteAllFinishedAction->setIcon(KIcon("edit-clear-list")); deleteAllFinishedAction->setHelpText(i18n("Removes all finished transfers and leaves all files on disk")); connect(deleteAllFinishedAction, SIGNAL(triggered()), SLOT(slotDeleteFinished())); KAction *deleteSelectedIncludingFilesAction = actionCollection()->addAction("delete_selected_download_including_files"); deleteSelectedIncludingFilesAction->setText(i18nc("delete selected transfer item and files", "Remove Selected and Delete Files")); deleteSelectedIncludingFilesAction->setIcon(KIcon("edit-delete")); deleteSelectedIncludingFilesAction->setHelpText(i18n("Removes selected transfer and deletes files from disk in any case")); connect(deleteSelectedIncludingFilesAction, SIGNAL(triggered()), SLOT(slotDeleteSelectedIncludingFiles())); KAction *redownloadSelectedAction = actionCollection()->addAction("redownload_selected_download"); redownloadSelectedAction->setText(i18nc("redownload selected transfer item", "Redownload Selected")); redownloadSelectedAction->setIcon(KIcon("view-refresh")); connect(redownloadSelectedAction, SIGNAL(triggered()), SLOT(slotRedownloadSelected())); KAction *startAllAction = actionCollection()->addAction("start_all_download"); startAllAction->setText(i18n("Start All")); startAllAction->setIcon(KIcon("media-seek-forward")); startAllAction->setShortcuts(KShortcut("Ctrl+R")); startAllAction->setHelpText(i18n("Starts / resumes all transfers")); connect(startAllAction, SIGNAL(triggered()), SLOT(slotStartAllDownload())); KAction *startSelectedAction = actionCollection()->addAction("start_selected_download"); startSelectedAction->setText(i18n("Start Selected")); startSelectedAction->setIcon(KIcon("media-playback-start")); startSelectedAction->setHelpText(i18n("Starts / resumes selected transfer")); connect(startSelectedAction, SIGNAL(triggered()), SLOT(slotStartSelectedDownload())); KAction *stopAllAction = actionCollection()->addAction("stop_all_download"); stopAllAction->setText(i18n("Pause All")); stopAllAction->setIcon(KIcon("media-playback-pause")); stopAllAction->setShortcuts(KShortcut("Ctrl+P")); stopAllAction->setHelpText(i18n("Pauses all transfers")); connect(stopAllAction, SIGNAL(triggered()), SLOT(slotStopAllDownload())); KAction *stopSelectedAction = actionCollection()->addAction("stop_selected_download"); stopSelectedAction->setText(i18n("Stop Selected")); stopSelectedAction->setIcon(KIcon("media-playback-pause")); stopSelectedAction->setHelpText(i18n("Pauses selected transfer")); connect(stopSelectedAction, SIGNAL(triggered()), SLOT(slotStopSelectedDownload())); KActionMenu *startActionMenu = new KActionMenu(KIcon("media-playback-start"), i18n("Start"), actionCollection()); actionCollection()->addAction("start_menu", startActionMenu); startActionMenu->setDelayed(true); startActionMenu->addAction(startSelectedAction); startActionMenu->addAction(startAllAction); connect(startActionMenu, SIGNAL(triggered()), SLOT(slotStartDownload())); KActionMenu *stopActionMenu = new KActionMenu(KIcon("media-playback-pause"), i18n("Pause"), actionCollection()); actionCollection()->addAction("stop_menu", stopActionMenu); stopActionMenu->setDelayed(true); stopActionMenu->addAction(stopSelectedAction); stopActionMenu->addAction(stopAllAction); connect(stopActionMenu, SIGNAL(triggered()), SLOT(slotStopDownload())); KAction *openDestAction = actionCollection()->addAction("transfer_open_dest"); openDestAction->setText(i18n("Open Destination")); openDestAction->setIcon(KIcon("document-open")); connect(openDestAction, SIGNAL(triggered()), SLOT(slotTransfersOpenDest())); KAction *openFileAction = actionCollection()->addAction("transfer_open_file"); openFileAction->setText(i18n("Open File")); openFileAction->setIcon(KIcon("document-open")); connect(openFileAction, SIGNAL(triggered()), SLOT(slotTransfersOpenFile())); KAction *showDetailsAction = new KToggleAction(KIcon("document-properties"), i18n("Show Details"), actionCollection()); actionCollection()->addAction("transfer_show_details", showDetailsAction); connect(showDetailsAction, SIGNAL(triggered()), SLOT(slotTransfersShowDetails())); KAction *copyUrlAction = actionCollection()->addAction("transfer_copy_source_url"); copyUrlAction->setText(i18n("Copy URL to Clipboard")); copyUrlAction->setIcon(KIcon("edit-copy")); connect(copyUrlAction, SIGNAL(triggered()), SLOT(slotTransfersCopySourceUrl())); KAction *transferHistoryAction = actionCollection()->addAction("transfer_history"); transferHistoryAction->setText(i18n("&Transfer History")); transferHistoryAction->setIcon(KIcon("view-history")); transferHistoryAction->setShortcuts(KShortcut("Ctrl+H")); connect(transferHistoryAction, SIGNAL(triggered()), SLOT(slotTransferHistory())); KAction *transferGroupSettingsAction = actionCollection()->addAction("transfer_group_settings"); transferGroupSettingsAction->setText(i18n("&Group Settings")); transferGroupSettingsAction->setIcon(KIcon("preferences-system")); transferGroupSettingsAction->setShortcuts(KShortcut("Ctrl+G")); connect(transferGroupSettingsAction, SIGNAL(triggered()), SLOT(slotTransferGroupSettings())); KAction *transferSettingsAction = actionCollection()->addAction("transfer_settings"); transferSettingsAction->setText(i18n("&Transfer Settings")); transferSettingsAction->setIcon(KIcon("preferences-system")); transferSettingsAction->setShortcuts(KShortcut("Ctrl+T")); connect(transferSettingsAction, SIGNAL(triggered()), SLOT(slotTransferSettings())); KAction *listLinksAction = actionCollection()->addAction("import_links"); listLinksAction->setText(i18n("Import &Links...")); listLinksAction->setIcon(KIcon("view-list-text")); listLinksAction->setShortcuts(KShortcut("Ctrl+L")); connect(listLinksAction, SIGNAL(triggered()), SLOT(slotShowListLinks())); //create the download finished actions which can be displayed in the toolbar KSelectAction *downloadFinishedActions = new KSelectAction(i18n("After downloads finished action"), this);//TODO maybe with name?? actionCollection()->addAction("download_finished_actions", downloadFinishedActions); downloadFinishedActions->setHelpText(i18n("Choose an action that is executed after all downloads have been finished.")); KAction *noAction = downloadFinishedActions->addAction(i18n("No Action")); connect(noAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(noAction); KAction *quitAction = downloadFinishedActions->addAction(i18n("Quit KGet")); quitAction->setData(KGet::Quit); connect(quitAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(quitAction); #ifdef HAVE_KWORKSPACE KAction *shutdownAction = downloadFinishedActions->addAction(i18n("Turn Off Computer")); shutdownAction->setData(KGet::Shutdown); connect(shutdownAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(shutdownAction); KAction *hibernateAction = downloadFinishedActions->addAction(i18n("Hibernate Computer")); hibernateAction->setData(KGet::Hibernate); connect(hibernateAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(hibernateAction); KAction *suspendAction = downloadFinishedActions->addAction(i18n("Suspend Computer")); suspendAction->setData(KGet::Suspend); connect(suspendAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions())); downloadFinishedActions->addAction(suspendAction); #endif if (Settings::afterFinishActionEnabled()) { downloadFinishedActions->setCurrentItem(Settings::afterFinishAction() + 1); } else { downloadFinishedActions->setCurrentItem(0); } }
void MainWindow::setupActions() { kDebug() << "setup actions..."; // this let shortcuts work.. actionCollection()->addAssociatedWidget(this); KAction *a; // new window action a = new KAction(KIcon("window-new"), i18n("&New Window"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N)); actionCollection()->addAction(QL1S("new_window"), a); connect(a, SIGNAL(triggered(bool)), Application::instance(), SLOT(newWindow())); // Standard Actions KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); KStandardAction::print(this, SLOT(printRequested()), actionCollection()); KStandardAction::quit(this , SLOT(close()), actionCollection()); a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection()); KShortcut findShortcut = KStandardShortcut::find(); findShortcut.setAlternate(Qt::Key_Slash); a->setShortcut(findShortcut); KStandardAction::findNext(this, SLOT(findNext()) , actionCollection()); KStandardAction::findPrev(this, SLOT(findPrevious()) , actionCollection()); a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection()); KShortcut fullScreenShortcut = KStandardShortcut::fullScreen(); fullScreenShortcut.setAlternate(Qt::Key_F11); a->setShortcut(fullScreenShortcut); a = actionCollection()->addAction(KStandardAction::Home); connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(homePage(Qt::MouseButtons, Qt::KeyboardModifiers))); KStandardAction::preferences(this, SLOT(preferences()), actionCollection()); a = KStandardAction::redisplay(m_view, SLOT(webReload()), actionCollection()); a->setText(i18n("Reload")); KShortcut reloadShortcut = KStandardShortcut::reload(); reloadShortcut.setAlternate(Qt::CTRL + Qt::Key_R); a->setShortcut(reloadShortcut); a = new KAction(KIcon("process-stop"), i18n("&Stop"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period)); actionCollection()->addAction(QL1S("stop"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(webStop())); // stop reload Action m_stopReloadAction = new KAction(this); actionCollection()->addAction(QL1S("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(browserLoading(bool))); browserLoading(false); //first init for blank start page a = new KAction(i18n("Open Location"), this); KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L); openLocationShortcut.setAlternate(Qt::Key_F6); a->setShortcut(openLocationShortcut); actionCollection()->addAction(QL1S("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation())); // set zoom bar actions m_zoomBar->setupActions(this); // tab list m_tabListMenu = new KMenu(); m_tabListMenu->addAction("hack"); // necessary to show the menu on the right side the first time connect(m_tabListMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowTabListMenu())); connect(m_tabListMenu, SIGNAL(triggered(QAction*)), this, SLOT(openActionTab(QAction*))); KActionMenu *tabAction = new KActionMenu(i18n("Tab List"), this); tabAction->setMenu(m_tabListMenu); tabAction->setIcon(KIcon("document-multiple")); tabAction->setDelayed(false); actionCollection()->addAction(QL1S("tab_list"), tabAction); // =============================== Tools Actions ================================= a = new KAction(i18n("View Page S&ource"), this); a->setIcon(KIcon("application-xhtml+xml")); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_U)); actionCollection()->addAction(QL1S("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource())); a = Application::instance()->privateBrowsingAction(); a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_P); actionCollection()->addAction(QL1S("private_browsing"), a); a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this); a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Delete); actionCollection()->addAction(QL1S("clear_private_data"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData())); // ========================= History related actions ============================== a = actionCollection()->addAction(KStandardAction::Back); connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openPrevious(Qt::MouseButtons, Qt::KeyboardModifiers))); m_historyBackMenu = new KMenu(this); a->setMenu(m_historyBackMenu); connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *))); a = actionCollection()->addAction(KStandardAction::Forward); connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openNext(Qt::MouseButtons, Qt::KeyboardModifiers))); // ============================== General Tab Actions ==================================== a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T)); actionCollection()->addAction(QL1S("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this); actionCollection()->addAction(QL1S("reload_all_tabs"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); actionCollection()->addAction(QL1S("show_next_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); actionCollection()->addAction(QL1S("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); actionCollection()->addAction(QL1S("open_last_closed_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openLastClosedTab())); // Closed Tabs Menu KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this); closedTabsMenu->setDelayed(false); actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu); // shortcuts for quickly switching to a tab for( int i = 1; i <= 9; i++ ) { a = new KAction(i18n("Switch to Tab %1", i), this); a->setShortcut(KShortcut( QString("Alt+%1").arg(i) )); a->setData( QVariant(i) ); actionCollection()->addAction(QL1S(("switch_tab_" + QString::number(i)).toAscii()), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(switchToTab())); } // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcuts( KStandardShortcut::close() ); actionCollection()->addAction(QL1S("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab())); a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this); actionCollection()->addAction(QL1S("clone_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab())); a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this); actionCollection()->addAction(QL1S("close_other_tabs"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs())); a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this); actionCollection()->addAction(QL1S("reload_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab())); a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this); actionCollection()->addAction(QL1S("detach_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab())); // Bookmark Menu KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); bmMenu->setIcon(KIcon("bookmarks")); bmMenu->setDelayed(false); bmMenu->setShortcutConfigurable(true); bmMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_B) ); actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu); // ---------------- Encodings ----------------------------------- a = new KAction(KIcon("character-set"), i18n("Set Encoding"), this); actionCollection()->addAction(QL1S("encodings"), a); a->setMenu(m_encodingMenu); connect(m_encodingMenu, SIGNAL(aboutToShow()), this, SLOT(populateEncodingMenu())); connect(m_encodingMenu, SIGNAL(triggered(QAction *)), this, SLOT(setEncoding(QAction *))); }