/*! \brief Default constructor This is the default constructor for the main class of the application. It adds the standard actions and create the ATMOSphere's KCM. */ ATMOSphere::ATMOSphere() : KMainWindow( 0, "ATMOSphere" ) { // set the shell's ui resource file setXMLFile("atmosphereui.rc"); KStdAction::keyBindings(this, SLOT( slotConfigureKeys() ), actionCollection() ); KStdAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection()); KStdAction::configureToolbars(this, SLOT(slotConfigureToolBars()), actionCollection()); KStdAction::quit(this, SLOT(close()), actionCollection()); KStdAction::preferences(this, SLOT(setup()), actionCollection()); createGUI(); kcmDialog = new KCMultiDialog( KCMultiDialog::Plain, "ATMOSphere settings", this, "kcmDialog", true); kcmDialog->addModule("kcmatmosphere"); iv = new KIconView(this); setCentralWidget(iv); loadDevices(); connect(iv, SIGNAL( executed(QIconViewItem*) ), this, SLOT(deviceOpened(QIconViewItem*))); #ifdef HAVE_TFTP tftpServer = new TFTP::Server( QHostAddress() ); connect(tftpServer, SIGNAL( receivedFile(QIODevice*,const QString) ), this, SLOT(tftpFileReceived(QIODevice *, const QString))); connect(tftpServer, SIGNAL( sentFile(QIODevice*, QString) ), this, SLOT(tftpFileSent(QIODevice *, QString))); #endif }
void KBattleshipWindow::initActions() { KStdAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection()); m_gameServerConnect = new KAction(i18n("&Connect to Server..."), "connect_no", Key_F2, this, SLOT(slotServerConnect()), actionCollection(), "game_serverconnect"); m_gameNewServer = new KAction(i18n("&Start Server..."), "network", Key_F3, this, SLOT(slotNewServer()), actionCollection(), "game_newserver"); m_gameSingle = new KAction(i18n("S&ingle Player..."), "gear", Key_F4, this, SLOT(slotSinglePlayer()), actionCollection(), "game_singleplayer"); m_gameQuit = KStdGameAction::quit(this, SLOT(close()), actionCollection()); KStdGameAction::highscores(this, SLOT(slotHighscore()), actionCollection()); m_gameEnemyInfo = new KAction(i18n("&Enemy Info"), "view_text", Key_F11, this, SLOT(slotEnemyClientInfo()), actionCollection(), "game_enemyinfo"); m_configSound = new KToggleAction(i18n("&Play Sounds"), 0, actionCollection(), "options_configure_sound"); m_configGrid = new KToggleAction(i18n("&Show Grid"), 0, this, SLOT(slotShowGrid()), actionCollection(), "options_show_grid"); m_configGrid->setCheckedState(i18n("Hide Grid")); m_gameEnemyInfo->setEnabled(false); setupGUI( KMainWindow::Save | StatusBar | Keys | Create ); }
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); } }