bool KonqSidebarTree::overrideShortcut(const QKeyEvent* e) { const int key = e->key() | e->modifiers(); if (key == Qt::Key_F2) { slotRename(); return true; } else if (key == Qt::Key_Delete) { kDebug() << "delete key -> trash"; slotTrash(); return true; } else if (key == (Qt::SHIFT | Qt::Key_Delete)) { kDebug() << "shift+delete -> delete"; slotDelete(); return true; } else if (KStandardShortcut::copy().contains(key)) { kDebug() << "copy"; emit copy(); return true; } else if (KStandardShortcut::cut().contains(key)) { kDebug() << "cut"; emit cut(); return true; } else if (KStandardShortcut::paste().contains(key)) { kDebug() << "paste"; emit paste(); return true; } return false; }
void KonqSessionDlg::slotRename(KUrl dirpathTo) { if ( !d->m_pListView->currentIndex().isValid() ) return; KUrl dirpathFrom = d->m_pModel->itemForIndex( d->m_pListView->currentIndex()).url(); dirpathTo = (dirpathTo == KUrl()) ? dirpathFrom : dirpathTo; KIO::RenameDialog dlg(this, i18nc("@title:window", "Rename Session"), dirpathFrom, dirpathTo, KIO::RenameDialog_Mode(0)); if(dlg.exec() == KIO::R_RENAME) { dirpathTo = dlg.newDestUrl(); QDir dir(dirpathTo.path()); if(dir.exists()) slotRename(dirpathTo); else { QDir dir(KStandardDirs::locateLocal("appdata", "sessions/")); dir.rename(dirpathFrom.fileName(), dlg.newDestUrl().fileName()); } } }
void KonqSidebarTree::showToplevelContextMenu() { KonqSidebarTreeTopLevelItem *item = 0; KonqSidebarTreeItem *treeItem = currentItem(); if (treeItem && treeItem->isTopLevelItem()) item = static_cast<KonqSidebarTreeTopLevelItem *>(treeItem); if (!m_collection) { m_collection = new KActionCollection( this, "bookmark actions" ); (void) new KAction( i18n("&Create New Folder..."), "folder_new", 0, this, SLOT( slotCreateFolder() ), m_collection, "create_folder"); (void) new KAction( i18n("Delete Folder"), "editdelete", 0, this, SLOT( slotDelete() ), m_collection, "delete_folder"); (void) new KAction( i18n("Rename"), 0, this, SLOT( slotRename() ), m_collection, "rename"); (void) new KAction( i18n("Delete Link"), "editdelete", 0, this, SLOT( slotDelete() ), m_collection, "delete_link"); (void) new KAction( i18n("Properties"), "edit", 0, this, SLOT( slotProperties() ), m_collection, "item_properties"); (void) new KAction( i18n("Open in New Window"), "window_new", 0, this, SLOT( slotOpenNewWindow() ), m_collection, "open_window"); (void) new KAction( i18n("Open in New Tab"), "tab_new", 0, this, SLOT( slotOpenTab() ), m_collection, "open_tab"); (void) new KAction( i18n("Copy Link Address"), "editcopy", 0, this, SLOT( slotCopyLocation() ), m_collection, "copy_location"); } QPopupMenu *menu = new QPopupMenu; if (item) { if (item->isTopLevelGroup()) { m_collection->action("rename")->plug(menu); m_collection->action("delete_folder")->plug(menu); menu->insertSeparator(); m_collection->action("create_folder")->plug(menu); } else { if (tabSupport()) m_collection->action("open_tab")->plug(menu); m_collection->action("open_window")->plug(menu); m_collection->action("copy_location")->plug(menu); menu->insertSeparator(); m_collection->action("rename")->plug(menu); m_collection->action("delete_link")->plug(menu); } menu->insertSeparator(); m_collection->action("item_properties")->plug(menu); } else { m_collection->action("create_folder")->plug(menu); } m_currentTopLevelItem = item; menu->exec( QCursor::pos() ); delete menu; m_currentTopLevelItem = 0; }
DialogRenamePlaylist::DialogRenamePlaylist(QTabWidget *tw, int index, QWidget *parent) : QDialog(parent),indexTab(index), tabWidget(tw), ui(new Ui::DialogRenamePlaylist) { ui->setupUi(this); name = ""; cancelflag = false; ui->lineEdit->setText(QDateTime::currentDateTime().toString("d-MM-yy h-mm-s")); setWindowTitle(tr("Имя плэлиста")); connect(ui->pushButtonRename, SIGNAL(clicked()), SLOT(slotRename())); connect(ui->pushButtonCancel, SIGNAL(clicked()), SLOT(slotCancel())); }
KonqSessionDlg::KonqSessionDlg( KonqViewManager *manager, QWidget *parent ) : KDialog( parent ) , d( new KonqSessionDlgPrivate( manager, this ) ) { d->layout()->setMargin( 0 ); setMainWidget( d ); setObjectName( QLatin1String( "konq_session_dialog" ) ); setModal( true ); setCaption( i18nc( "@title:window", "Manage Sessions" ) ); setButtons( BTN_OPEN | Close ); setDefaultButton( Close ); setButtonGuiItem( BTN_OPEN, KGuiItem( i18n( "&Open" ), "document-open" ) ); d->m_pSaveCurrentButton->setIcon(KIcon("document-save")); d->m_pRenameButton->setIcon(KIcon("edit-rename")); d->m_pDeleteButton->setIcon(KIcon("edit-delete")); d->m_pNewButton->setIcon(KIcon("document-new")); QString dir = KStandardDirs::locateLocal("appdata", "sessions/"); d->m_pModel = new KDirModel(d->m_pListView); d->m_pModel->sort(QDir::Name); d->m_pModel->dirLister()->setDirOnlyMode(true); d->m_pModel->dirLister()->openUrl(dir); d->m_pListView->setModel(d->m_pModel); d->m_pListView->setMinimumSize( d->m_pListView->sizeHint() ); connect( d->m_pListView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), this, SLOT( slotSelectionChanged() ) ); enableButton( BTN_OPEN, d->m_pListView->currentIndex().isValid() ); slotSelectionChanged(); d->m_pOpenTabsInsideCurrentWindow->setChecked( KonqSettings::openTabsInsideCurrentWindow()); connect( this,SIGNAL(user1Clicked()),SLOT(slotOpen())); connect( d->m_pNewButton, SIGNAL(clicked()),SLOT(slotNew())); connect( d->m_pSaveCurrentButton, SIGNAL(clicked()),SLOT(slotSave())); connect( d->m_pRenameButton, SIGNAL(clicked()),SLOT(slotRename())); connect( d->m_pDeleteButton, SIGNAL(clicked()),SLOT(slotDelete())); resize( sizeHint() ); }
/** * Popup menu item selected. */ void ActivityPage::slotMenuSelection(QAction* action) { ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action); switch(sel) { case ListPopupMenu::mt_New_Activity: slotNewActivity(); break; case ListPopupMenu::mt_Delete: slotDelete(); break; case ListPopupMenu::mt_Rename: slotRename(); break; default: uDebug() << "MenuType " << ListPopupMenu::toString(sel) << " not implemented"; } }
EqualizerPresetManager::EqualizerPresetManager( QWidget *parent ) : KDialog( parent ) { setCaption( i18n("Presets") ); setModal( true ); setButtons( Ok | Cancel | Default ); setDefaultButton( Ok ); showButtonSeparator( true ); QWidget *mainWidget = new QWidget( this ); setMainWidget( mainWidget ); QHBoxLayout *mainLayout = new QHBoxLayout( mainWidget, 0, spacingHint() ); m_presetsView = new K3ListView( mainWidget ); m_presetsView->setObjectName( "presetListView" ); m_presetsView->addColumn( i18n( "Presets" ) ); m_presetsView->setFullWidth( true ); connect(m_presetsView, SIGNAL( selectionChanged() ), SLOT( updateButtonState() )); connect(m_presetsView, SIGNAL( doubleClicked ( Q3ListViewItem*, const QPoint&, int ) ), SLOT( slotRename() )); mainLayout->addWidget( m_presetsView ); QVBoxLayout* buttonsLayout = new QVBoxLayout( mainLayout ); m_renameBtn = new QPushButton( i18n("&Rename"), mainWidget, "renameBtn" ); m_deleteBtn = new QPushButton( i18n("&Delete"), mainWidget, "deleteBtn" ); buttonsLayout->addWidget( m_renameBtn ); buttonsLayout->addWidget( m_deleteBtn ); connect(m_renameBtn, SIGNAL( clicked() ), SLOT( slotRename() )); connect(m_deleteBtn, SIGNAL( clicked() ), SLOT( slotDelete() )); connect(this, SIGNAL( defaultClicked() ), SLOT( slotDefault() )); QSpacerItem* spacer = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); buttonsLayout->addItem( spacer ); updateButtonState(); resize( QSize(300, 250).expandedTo(minimumSizeHint()) ); }
void ItemXML::contextMenu(QPopupMenu& _menu) { _menu.insertItem("Set Name", this, SLOT(slotRename())); _menu.insertSeparator(); }
// 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() )); }
void StorageServiceManagerMainWindow::setupActions() { KActionCollection *ac = actionCollection(); KStandardAction::quit(this, &StorageServiceManagerMainWindow::close, ac); mAuthenticate = ac->addAction(QStringLiteral("authenticate"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAuthenticate())); mAuthenticate->setText(i18n("Authenticate...")); mCreateFolder = ac->addAction(QStringLiteral("create_folder"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotCreateFolder())); mCreateFolder->setText(i18n("Create Folder...")); mCreateFolder->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); mRefreshList = ac->addAction(QStringLiteral("refresh_list"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRefreshList())); mRefreshList->setText(i18n("Refresh List")); mRefreshList->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); ac->setDefaultShortcut(mRefreshList, QKeySequence(Qt::Key_F5)); mAccountInfo = ac->addAction(QStringLiteral("account_info"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAccountInfo())); mAccountInfo->setText(i18n("Account Info...")); mUploadFile = ac->addAction(QStringLiteral("upload_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotUploadFile())); mUploadFile->setText(i18n("Upload File...")); mDelete = ac->addAction(QStringLiteral("delete"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDelete())); ac->setDefaultShortcut(mDelete, QKeySequence(Qt::Key_Delete)); mDelete->setText(i18n("Delete...")); mDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); mDownloadFile = ac->addAction(QStringLiteral("download_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDownloadFile())); mDownloadFile->setText(i18n("Download File...")); mDownloadFile->setIcon(QIcon::fromTheme(QStringLiteral("download"))); mShowLog = ac->addAction(QStringLiteral("show_log"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotShowLog())); mShowLog->setText(i18n("Show Log...")); mLogout = ac->addAction(QStringLiteral("logout"), this, SLOT(slotLogout())); mLogout->setText(i18n("Logout")); mShutdownAllServices = ac->addAction(QStringLiteral("shutdown_all_services"), this, SLOT(slotShutdownAllServices())); mShutdownAllServices->setText(i18n("Shutdown All Services")); mRefreshAll = ac->addAction(QStringLiteral("refresh_all"), this, SLOT(slotRefreshAll())); mRefreshAll->setText(i18n("Refresh All")); ac->setDefaultShortcut(mRefreshAll, QKeySequence(Qt::CTRL + Qt::Key_F5)); mRenameItem = ac->addAction(QStringLiteral("rename"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRename())); mRenameItem->setText(i18n("Rename...")); ac->setDefaultShortcut(mRenameItem, QKeySequence(Qt::Key_F2)); KStandardAction::preferences(this, &StorageServiceManagerMainWindow::slotConfigure, ac); KStandardAction::configureNotifications(this, &StorageServiceManagerMainWindow::slotShowNotificationOptions, ac); // options_configure_notifications }
KexiProjectNavigator::KexiProjectNavigator(QWidget* parent, Features features) : QWidget(parent) , d(new Private(features)) { d->actions = new KActionCollection(this); setObjectName("KexiProjectNavigator"); setWindowTitle(i18n("Project Navigator")); setWindowIcon(KexiMainWindowIface::global()->thisWidget()->windowIcon()); QVBoxLayout *lyr = new QVBoxLayout(this); lyr->setContentsMargins( KDialog::marginHint() / 2, KDialog::marginHint() / 2, KDialog::marginHint() / 2, KDialog::marginHint() / 2); lyr->setSpacing(KDialog::marginHint() / 2); KexiFlowLayout *buttons_flyr = new KexiFlowLayout(lyr); d->list = new KexiProjectTreeView(this); d->model = new KexiProjectModel(); d->list->setModel(d->model); KexiProjectItemDelegate *delegate = new KexiProjectItemDelegate(d->list); d->list->setItemDelegate(delegate); lyr->addWidget(d->list); connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)), SLOT(slotSettingsChanged(int))); slotSettingsChanged(0); d->list->header()->hide(); d->list->setAllColumnsShowFocus(true); d->list->setAlternatingRowColors(true); connect(d->list, SIGNAL(pressed(QModelIndex)), this,SLOT(slotSelectionChanged(QModelIndex))); KConfigGroup mainWindowGroup = KGlobal::config()->group("MainWindow"); if ((d->features & SingleClickOpensItemOptionEnabled) && mainWindowGroup.readEntry("SingleClickOpensItem", false)) { connect(d->list, SIGNAL(activate(QModelIndex)), this, SLOT(slotExecuteItem(QModelIndex))); } else { connect(d->list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotExecuteItem(QModelIndex))); } // actions d->openAction = addAction("open_object", koIcon("document-open"), i18n("&Open"), i18n("Open object"), i18n("Opens object selected in the list."), SLOT(slotOpenObject())); KexiSmallToolButton *btn; if (d->features & Toolbar) { btn = new KexiSmallToolButton(d->openAction, this); buttons_flyr->addWidget(btn); } if (KexiMainWindowIface::global() && KexiMainWindowIface::global()->userMode()) { //! @todo some of these actions can be supported once we deliver ACLs... d->deleteAction = 0; d->renameAction = 0; d->designAction = 0; d->editTextAction = 0; d->newObjectAction = 0; } else { d->deleteAction = addAction("edit_delete", koIcon("edit-delete"), i18n("&Delete..."), i18n("Delete object"), i18n("Deletes the object selected in the list."), SLOT(slotRemove())); d->renameAction = addAction("edit_rename", koIcon("edit-rename"), i18n("&Rename..."), i18n("Rename object"), i18n("Renames the object selected in the list."), SLOT(slotRename())); //! @todo enable, doesn't work now: d->renameAction->setShortcut(KShortcut(Qt::Key_F2)); #ifdef KEXI_SHOW_UNIMPLEMENTED //! @todo plugSharedAction("edit_cut",SLOT(slotCut())); //! @todo plugSharedAction("edit_copy",SLOT(slotCopy())); //! @todo plugSharedAction("edit_paste",SLOT(slotPaste())); #endif d->designAction = addAction("design_object", koIcon("document-properties"), i18n("&Design"), i18n("Design object"), i18n("Starts designing of the object selected in the list."), SLOT(slotDesignObject())); if (d->features & Toolbar) { btn = new KexiSmallToolButton(d->designAction, this); buttons_flyr->addWidget(btn); } d->editTextAction = addAction("editText_object", KIcon(), i18n("Design in &Text View"), i18n("Design object in text view"), i18n("Starts designing of the object in the list in text view."), SLOT(slotEditTextObject())); d->newObjectAction = addAction("new_object", koIcon("document-new"), QString(),QString(), QString(), SLOT(slotNewObject())); if (d->features & Toolbar) { d->deleteObjectToolButton = new KexiSmallToolButton(d->deleteAction, this); buttons_flyr->addWidget(d->deleteObjectToolButton); } } d->executeAction = addAction("data_execute", koIcon("system-run"), i18n("Execute"), //! @todo tooltip, what's this QString(), QString(), SLOT(slotExecuteObject())); d->actions->addAction("export_object", d->exportActionMenu = new KActionMenu(i18n("Export"), this)); d->dataExportToClipboardAction = addAction("exportToClipboardAsDataTable", koIcon("edit-copy"), i18nc("Export->To Clipboard as Data... ", "To &Clipboard..."), i18n("Export data to clipboard"), i18n("Exports data from the currently selected table or query to clipboard."), SLOT(slotExportToClipboardAsDataTable())); d->exportActionMenu->addAction(d->dataExportToClipboardAction); d->dataExportToFileAction = addAction("exportToFileAsDataTable", koIcon("table"), i18nc("Export->To File As Data &Table... ", "To &File As Data Table..."), i18n("Export data to a file"), i18n("Exports data from the currently selected table or query to a file."), SLOT(slotExportToFileAsDataTable())); d->exportActionMenu->addAction(d->dataExportToFileAction); #ifndef KEXI_NO_QUICK_PRINTING d->printAction = addAction("print_object", koIcon("document-print"), i18n("&Print..."), i18n("Print data"), i18n("Prints data from the currently selected table or query."), SLOT(slotPrintObject())); d->pageSetupAction = addAction("pageSetupForObject", koIconWanted("not yet in Oxygen 4.3", "document-page-setup"), i18n("Page Setup..."), i18n("Page setup for data"), i18n("Shows page setup for printing the active table or query."), SLOT(slotPageSetupForObject())); #endif if (KexiMainWindowIface::global() && KexiMainWindowIface::global()->userMode()) { //! @todo some of these actions can be supported once we deliver ACLs... d->partMenu = 0; } else { d->partMenu = new KexiGroupMenu(this, d->actions); } if (d->features & ContextMenus) { d->itemMenu = new KexiItemMenu(this, d->actions); } else { d->itemMenu = 0; } if (!(d->features & Writable)) { setReadOnly(true); } slotSelectionChanged(QModelIndex()); }
/** * Sets up the page. */ void ActivityPage::setupPage() { int margin = fontMetrics().height(); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(10); m_pActivityGB = new QGroupBox(i18n("Activities"), this); // vertical box layout for the activity lists, arrow buttons and the button box QVBoxLayout* listVBoxLayout = new QVBoxLayout(m_pActivityGB); listVBoxLayout->setMargin(margin); listVBoxLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* listHBoxLayout = new QHBoxLayout(); listHBoxLayout->setSpacing(10); listVBoxLayout->addItem(listHBoxLayout); m_pActivityLW = new QListWidget(m_pActivityGB); m_pActivityLW->setContextMenuPolicy(Qt::CustomContextMenu); listHBoxLayout->addWidget(m_pActivityLW); QVBoxLayout * buttonLayout = new QVBoxLayout(); listHBoxLayout->addItem(buttonLayout); m_pTopArrowB = new QToolButton(m_pActivityGB); m_pTopArrowB->setArrowType(Qt::UpArrow); m_pTopArrowB->setEnabled(false); m_pTopArrowB->setToolTip(i18n("Move selected item to the top")); buttonLayout->addWidget(m_pTopArrowB); m_pUpArrowB = new QToolButton(m_pActivityGB); m_pUpArrowB->setArrowType(Qt::UpArrow); m_pUpArrowB->setEnabled(false); m_pUpArrowB->setToolTip(i18n("Move selected item up")); buttonLayout->addWidget(m_pUpArrowB); m_pDownArrowB = new QToolButton(m_pActivityGB); m_pDownArrowB->setArrowType(Qt::DownArrow); m_pDownArrowB->setEnabled(false); m_pDownArrowB->setToolTip(i18n("Move selected item down")); buttonLayout->addWidget(m_pDownArrowB); m_pBottomArrowB = new QToolButton(m_pActivityGB); m_pBottomArrowB->setArrowType(Qt::DownArrow); m_pBottomArrowB->setEnabled(false); m_pBottomArrowB->setToolTip(i18n("Move selected item to the bottom")); buttonLayout->addWidget(m_pBottomArrowB); #if QT_VERSION >= 0x050000 QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pActivityGB); QPushButton* newActivity = buttonBox->addButton(i18n("New Activity..."), QDialogButtonBox::ActionRole); connect(newActivity, SIGNAL(clicked()), this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), QDialogButtonBox::ActionRole); connect(m_pDeleteActivityButton, SIGNAL(clicked()), this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), QDialogButtonBox::ActionRole); connect(m_pRenameButton, SIGNAL(clicked()), this, SLOT(slotRename())); #else KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pActivityGB); buttonBox->addButton(i18n("New Activity..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), KDialogButtonBox::ActionRole, this, SLOT(slotRename())); #endif listVBoxLayout->addWidget(buttonBox); mainLayout->addWidget(m_pActivityGB); //now fill activity list box QStringList list = m_pStateWidget->activities(); QStringList::ConstIterator end(list.end()); for(QStringList::ConstIterator it(list.begin()); it != end; ++it) { m_pActivityLW->addItem(*it); } //now setup the signals connect(m_pActivityLW, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotClicked(QListWidgetItem*))); connect(m_pActivityLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); connect(m_pTopArrowB, SIGNAL(clicked()), this, SLOT(slotTopClicked())); connect(m_pUpArrowB, SIGNAL(clicked()), this, SLOT(slotUpClicked())); connect(m_pDownArrowB, SIGNAL(clicked()), this, SLOT(slotDownClicked())); connect(m_pBottomArrowB, SIGNAL(clicked()), this, SLOT(slotBottomClicked())); connect(m_pActivityLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClicked(QListWidgetItem*))); enableWidgets(false); }
void ActivityPage::slotDoubleClicked(QListWidgetItem* item) { if (item) { slotRename(); } }