void FileBrowserWidget::setupToolbar() { KActionCollection *coll = m_dirOperator->actionCollection(); m_toolbar->addAction(coll->action("back")); m_toolbar->addAction(coll->action("forward")); QAction *action = new QAction(this); action->setIcon(QIcon::fromTheme("document-open")); action->setText(i18n("Open selected")); connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal())); m_toolbar->addAction(action); QAction *showOnlyLaTexFilesAction = new QAction(this); showOnlyLaTexFilesAction->setText(i18n("Show LaTeX Files Only")); showOnlyLaTexFilesAction->setCheckable(true); showOnlyLaTexFilesAction->setChecked(KileConfig::showLaTeXFilesOnly()); connect(showOnlyLaTexFilesAction, SIGNAL(triggered(bool)), this, SLOT(toggleShowLaTeXFilesOnly(bool))); // section for settings menu KActionMenu *optionsMenu = new KActionMenu(QIcon::fromTheme("configure"), i18n("Options"), this); optionsMenu->setDelayed(false); optionsMenu->addAction(m_dirOperator->actionCollection()->action("short view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("tree view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed tree view")); optionsMenu->addSeparator(); optionsMenu->addAction(showOnlyLaTexFilesAction); optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden")); m_toolbar->addSeparator(); m_toolbar->addAction(optionsMenu); }
KGet_plug_in::KGet_plug_in( QObject* parent, const char* name ) : Plugin( parent, name ) { QPixmap pix = KGlobal::iconLoader()->loadIcon("kget", KIcon::MainToolbar); KActionMenu *menu = new KActionMenu( i18n("Download Manager"), pix, actionCollection(), "kget_menu" ); menu->setDelayed( false ); connect( menu->popupMenu(), SIGNAL( aboutToShow() ), SLOT( showPopup() )); m_paToggleDropTarget=new KToggleAction(i18n("Show Drop Target"), KShortcut(), this, SLOT(slotShowDrop()), actionCollection(), "show_drop" ); menu->insert( m_paToggleDropTarget ); KAction *action = new KAction(i18n("List All Links"), KShortcut(), this, SLOT( slotShowLinks() ), actionCollection(), "show_links"); menu->insert( action ); p_dcopServer= new DCOPClient(); p_dcopServer->attach (); }
void FileBrowserWidget::setupToolbar() { KActionCollection *coll = m_dirOperator->actionCollection(); m_toolbar->addAction(coll->action("back")); m_toolbar->addAction(coll->action("forward")); KAction *action = new KAction(this); action->setIcon(SmallIcon("document-open")); action->setText(i18n("Open selected")); connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal())); m_toolbar->addAction(action); // section for settings menu KActionMenu *optionsMenu = new KActionMenu(KIcon("configure"), i18n("Options"), this); optionsMenu->setDelayed(false); optionsMenu->addAction(m_dirOperator->actionCollection()->action("short view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("tree view")); optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed tree view")); optionsMenu->addSeparator(); optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden")); m_toolbar->addSeparator(); m_toolbar->addAction(optionsMenu); }
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; }
/** * Constructor. Connect all of the object and the job control. */ KAudioCreator::KAudioCreator( QWidget* parent, const char* name) : KMainWindow(parent, name) { janusWidget = new KJanusWidget(this, name, KJanusWidget::Tabbed); setCentralWidget(janusWidget); QVBox *frame = janusWidget->addVBoxPage(i18n("&CD Tracks"), QString::null, SmallIcon("cdaudio_unmount", 32)); tracks = new TracksImp(frame, "Tracks"); ripper = new Ripper ( frame, "Rip" ); encoder = new Encoder( frame, "Encoder" ); frame = janusWidget->addVBoxPage( i18n("&Jobs"), QString::null, SmallIcon( "run", 32 ) ); jobQue = new JobQueImp( frame, "Que" ); resize(500, 440); /*KAction *eject = */new KAction( i18n("&Eject CD"), 0, tracks, SLOT( eject() ), actionCollection(), "eject" ); (void)new KAction( i18n("&Configure KAudioCreator..."), 0, this, SLOT( showSettings() ), actionCollection(), "configure_kaudiocreator" ); KAction *selectAll = new KAction( i18n( "Select &All Tracks"), 0, tracks, SLOT( selectAllTracks() ), actionCollection(), "select_all" ) ; KAction *deselectAll = new KAction( i18n( "Deselect &All Tracks"), 0, tracks, SLOT( deselectAllTracks() ), actionCollection(), "deselect_all" ); selectAll->setEnabled( false ); deselectAll->setEnabled( false ); KActionMenu *actActionMenu = new KActionMenu( i18n("Rip &Selection"), "rip", actionCollection(), "rip" ); actActionMenu->setDelayed(true); //needed for checking "all accounts" actActionMenu->setEnabled( false ); connect( actActionMenu, SIGNAL( activated() ), tracks, SLOT( startSession() ) ); ripMenu = actActionMenu->popupMenu(); connect( ripMenu, SIGNAL( activated(int) ), this, SLOT( slotRipSelection(int)) ); connect( ripMenu, SIGNAL( aboutToShow() ), this, SLOT( getRipMenu()) ); KAction *rip = new KAction( i18n( "Rip &Selection" ), 0, tracks, SLOT( startSession() ), actionCollection(), "rip_selected" ); rip->setEnabled( false ); connect( jobQue, SIGNAL( removeJob(int) ), this, SLOT( updateStatus() ) ); connect( jobQue, SIGNAL( removeJob(int) ), ripper, SLOT( removeJob(int) ) ); connect( jobQue, SIGNAL( removeJob(int) ), encoder, SLOT( removeJob(int)) ); connect( ripper, SIGNAL( updateProgress(int, int) ) , jobQue, SLOT( updateProgress(int,int) ) ); connect( ripper, SIGNAL( addJob(Job*, const QString &) ), jobQue, SLOT( addJob(Job*, const QString &)) ); connect( ripper, SIGNAL( eject(const QString &) ) , tracks, SLOT( ejectDevice(const QString &)) ); connect( ripper, SIGNAL( encodeWav(Job *) ) , encoder, SLOT( encodeWav(Job *)) ); connect( ripper, SIGNAL( jobsChanged() ) , this, SLOT( updateStatus() ) ); connect( encoder, SIGNAL( updateProgress(int, int) ) , jobQue, SLOT( updateProgress(int,int)) ); connect( encoder, SIGNAL( addJob(Job*, const QString&)), jobQue, SLOT( addJob(Job*, const QString &)) ); connect( encoder, SIGNAL( jobsChanged() ) , this, SLOT( updateStatus() ) ); connect( tracks, SIGNAL( hasCD(bool) ) , this, SLOT( hasCD(bool) ) ); connect( tracks, SIGNAL( ripTrack(Job *) ), ripper, SLOT( ripTrack(Job *)) ); connect( tracks, SIGNAL( hasTracks(bool) ), rip, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), actActionMenu, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), deselectAll, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), selectAll, SLOT( setEnabled(bool)) ); (void)new KAction(i18n("Remove &Completed Jobs"), 0, jobQue, SLOT(clearDoneJobs()), actionCollection(), "clear_done_jobs" ); KAction *edit = new KAction(i18n("&Edit Album..."), 0, tracks, SLOT(editInformation()), actionCollection(), "edit_cd"); connect(tracks, SIGNAL(hasCD(bool)), edit, SLOT(setEnabled(bool))); edit->setEnabled( false ); (void)new KAction(i18n("Encode &File..."), 0, this, SLOT(encodeFile()), actionCollection(), "encode_file"); KAction *cddb = new KAction(i18n("&CDDB Lookup"), 0, tracks, SLOT(performCDDB()), actionCollection(), "cddb_now"); connect(tracks, SIGNAL(hasCD(bool)), cddb, SLOT(setEnabled(bool))); cddb->setEnabled( false ); KStdAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection()); KStdAction::quit( this, SLOT(close()), actionCollection(), "quit" ); // Init statusbar statusBar()->insertItem(i18n("No Audio CD detected"), 0 ); hasCD(tracks->hasCD()); setupGUI(); }
void JuK::setupActions() { KActionCollection *collection = ActionCollection::actions(); // Setup KDE standard actions that JuK uses. KStandardAction::quit(this, SLOT(slotQuit()), collection); KStandardAction::undo(this, SLOT(slotUndo()), collection); KStandardAction::cut(collection); KStandardAction::copy(collection); KStandardAction::paste(collection); KAction *clear = KStandardAction::clear(collection); KStandardAction::selectAll(collection); KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection); // Setup the menu which handles the random play options. KActionMenu *actionMenu = collection->add<KActionMenu>("actionMenu"); actionMenu->setText(i18n("&Random Play")); actionMenu->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" ))); actionMenu->setDelayed(false); QActionGroup* randomPlayGroup = new QActionGroup(this); QAction *act = collection->add<KToggleAction>("disableRandomPlay"); act->setText(i18n("&Disable Random Play")); act->setIcon(KIcon( QLatin1String( "go-down" ))); act->setActionGroup(randomPlayGroup); actionMenu->addAction(act); m_randomPlayAction = collection->add<KToggleAction>("randomPlay"); m_randomPlayAction->setText(i18n("Use &Random Play")); m_randomPlayAction->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" ))); m_randomPlayAction->setActionGroup(randomPlayGroup); actionMenu->addAction(m_randomPlayAction); act = collection->add<KToggleAction>("albumRandomPlay"); act->setText(i18n("Use &Album Random Play")); act->setIcon(KIcon( QLatin1String( "media-playlist-shuffle" ))); act->setActionGroup(randomPlayGroup); connect(act, SIGNAL(triggered(bool)), SLOT(slotCheckAlbumNextAction(bool))); actionMenu->addAction(act); act = collection->addAction("removeFromPlaylist", clear, SLOT(clear())); act->setText(i18n("Remove From Playlist")); act->setIcon(KIcon( QLatin1String( "list-remove" ))); act = collection->add<KToggleAction>("crossfadeTracks"); act->setText(i18n("Crossfade Between Tracks")); connect(act, SIGNAL(triggered(bool)), m_player, SLOT(setCrossfadeEnabled(bool))); act = collection->addAction("play", m_player, SLOT(play())); act->setText(i18n("&Play")); act->setIcon(KIcon( QLatin1String( "media-playback-start" ))); act = collection->addAction("pause", m_player, SLOT(pause())); act->setText(i18n("P&ause")); act->setIcon(KIcon( QLatin1String( "media-playback-pause" ))); act = collection->addAction("stop", m_player, SLOT(stop())); act->setText(i18n("&Stop")); act->setIcon(KIcon( QLatin1String( "media-playback-stop" ))); act = new KToolBarPopupAction(KIcon( QLatin1String( "media-skip-backward") ), i18nc("previous track", "Previous" ), collection); collection->addAction("back", act); connect(act, SIGNAL(triggered(bool)), m_player, SLOT(back())); act = collection->addAction("forward", m_player, SLOT(forward())); act->setText(i18nc("next track", "&Next")); act->setIcon(KIcon( QLatin1String( "media-skip-forward" ))); act = collection->addAction("loopPlaylist"); act->setText(i18n("&Loop Playlist")); act->setCheckable(true); act = collection->add<KToggleAction>("resizeColumnsManually"); act->setText(i18n("&Resize Playlist Columns Manually")); // the following are not visible by default act = collection->addAction("mute", m_player, SLOT(mute())); act->setText(i18nc("silence playback", "Mute")); act->setIcon(KIcon( QLatin1String( "audio-volume-muted" ))); act = collection->addAction("volumeUp", m_player, SLOT(volumeUp())); act->setText(i18n("Volume Up")); act->setIcon(KIcon( QLatin1String( "audio-volume-high" ))); act = collection->addAction("volumeDown", m_player, SLOT(volumeDown())); act->setText(i18n("Volume Down")); act->setIcon(KIcon( QLatin1String( "audio-volume-low" ))); act = collection->addAction("playPause", m_player, SLOT(playPause())); act->setText(i18n("Play / Pause")); act->setIcon(KIcon( QLatin1String( "media-playback-start" ))); act = collection->addAction("seekForward", m_player, SLOT(seekForward())); act->setText(i18n("Seek Forward")); act->setIcon(KIcon( QLatin1String( "media-seek-forward" ))); act = collection->addAction("seekBack", m_player, SLOT(seekBack())); act->setText(i18n("Seek Back")); act->setIcon(KIcon( QLatin1String( "media-seek-backward" ))); act = collection->addAction("showHide", this, SLOT(slotShowHide())); act->setText(i18n("Show / Hide")); ////////////////////////////////////////////////// // settings menu ////////////////////////////////////////////////// m_toggleSplashAction = collection->add<KToggleAction>("showSplashScreen"); m_toggleSplashAction->setText(i18n("Show Splash Screen on Startup")); m_toggleSystemTrayAction = collection->add<KToggleAction>("toggleSystemTray"); m_toggleSystemTrayAction->setText(i18n("&Dock in System Tray")); connect(m_toggleSystemTrayAction, SIGNAL(triggered(bool)), SLOT(slotToggleSystemTray(bool))); m_toggleDockOnCloseAction = collection->add<KToggleAction>("dockOnClose"); m_toggleDockOnCloseAction->setText(i18n("&Stay in System Tray on Close")); m_togglePopupsAction = collection->add<KToggleAction>("togglePopups"); m_togglePopupsAction->setText(i18n("Popup &Track Announcement")); act = collection->add<KToggleAction>("saveUpcomingTracks"); act->setText(i18n("Save &Play Queue on Exit")); act = collection->addAction("tagGuesserConfig", this, SLOT(slotConfigureTagGuesser())); act->setText(i18n("&Tag Guesser...")); act = collection->addAction("fileRenamerConfig", this, SLOT(slotConfigureFileRenamer())); act->setText(i18n("&File Renamer...")); act = collection->addAction("scrobblerConfig", this, SLOT(slotConfigureScrobbling())); act->setText(i18n("&Configure scrobbling...")); ////////////////////////////////////////////////// // just in the toolbar ////////////////////////////////////////////////// collection->addAction("trackPositionAction", new TrackPositionAction(i18n("Track Position"), this)); collection->addAction("volumeAction", new VolumeAction(i18n("Volume"), this)); ActionCollection::actions()->addAssociatedWidget(this); foreach (QAction* action, ActionCollection::actions()->actions()) action->setShortcutContext(Qt::WidgetWithChildrenShortcut); }
void KMMainView::initActions() { KIconSelectAction *vact = new KIconSelectAction(i18n("&View"), 0, m_actions, "view_change"); QStringList iconlst; iconlst << "view_icon" << "view_detailed" << "view_tree"; vact->setItems(QStringList::split(',', i18n("&Icons,&List,&Tree"), false), iconlst); vact->setCurrentItem(0); connect(vact, SIGNAL(activated(int)), SLOT(slotChangeView(int))); KActionMenu *stateAct = new KActionMenu(i18n("Start/Stop Printer"), "kdeprint_printstate", m_actions, "printer_state_change"); stateAct->setDelayed(false); stateAct->insert( new KAction(i18n("&Start Printer"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_start")); stateAct->insert(new KAction(i18n("Sto&p Printer"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_stop")); stateAct = new KActionMenu(i18n("Enable/Disable Job Spooling"), "kdeprint_queuestate", m_actions, "printer_spool_change"); stateAct->setDelayed(false); stateAct->insert( new KAction(i18n("&Enable Job Spooling"), "kdeprint_enableprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_enable")); stateAct->insert( new KAction(i18n("&Disable Job Spooling"), "kdeprint_stopprinter", 0, this, SLOT(slotChangePrinterState()), m_actions, "printer_disable")); new KAction(i18n("&Remove"), "edittrash", 0, this, SLOT(slotRemove()), m_actions, "printer_remove"); new KAction(i18n("&Configure..."), "configure", 0, this, SLOT(slotConfigure()), m_actions, "printer_configure"); new KAction(i18n("Add &Printer/Class..."), "kdeprint_addprinter", 0, this, SLOT(slotAdd()), m_actions, "printer_add"); new KAction(i18n("Add &Special (pseudo) Printer..."), "kdeprint_addpseudo", 0, this, SLOT(slotAddSpecial()), m_actions, "printer_add_special"); new KAction(i18n("Set as &Local Default"), "kdeprint_defaulthard", 0, this, SLOT(slotHardDefault()), m_actions, "printer_hard_default"); new KAction(i18n("Set as &User Default"), "kdeprint_defaultsoft", 0, this, SLOT(slotSoftDefault()), m_actions, "printer_soft_default"); new KAction(i18n("&Test Printer..."), "kdeprint_testprinter", 0, this, SLOT(slotTest()), m_actions, "printer_test"); new KAction(i18n("Configure &Manager..."), "kdeprint_configmgr", 0, this, SLOT(slotManagerConfigure()), m_actions, "manager_configure"); new KAction(i18n("Initialize Manager/&View"), "reload", 0, this, SLOT(slotInit()), m_actions, "view_refresh"); KIconSelectAction *dact = new KIconSelectAction(i18n("&Orientation"), 0, m_actions, "orientation_change"); iconlst.clear(); iconlst << "view_top_bottom" << "view_left_right"; dact->setItems(QStringList::split(',', i18n("&Vertical,&Horizontal"), false), iconlst); dact->setCurrentItem(0); connect(dact, SIGNAL(activated(int)), SLOT(slotChangeDirection(int))); new KAction(i18n("R&estart Server"), "kdeprint_restartsrv", 0, this, SLOT(slotServerRestart()), m_actions, "server_restart"); new KAction(i18n("Configure &Server..."), "kdeprint_configsrv", 0, this, SLOT(slotServerConfigure()), m_actions, "server_configure"); KToggleAction *tact = new KToggleAction(i18n("Show &Toolbar"), 0, m_actions, "view_toolbar"); tact->setCheckedState(i18n("Hide &Toolbar")); connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleToolBar(bool))); tact = new KToggleAction(i18n("Show Me&nu Toolbar"), 0, m_actions, "view_menubar"); tact->setCheckedState(i18n("Hide Me&nu Toolbar")); connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleMenuBar(bool))); tact = new KToggleAction(i18n("Show Pr&inter Details"), "kdeprint_printer_infos", 0, m_actions, "view_printerinfos"); tact->setCheckedState(KGuiItem(i18n("Hide Pr&inter Details"), "kdeprint_printer_infos")); tact->setChecked(true); connect(tact, SIGNAL(toggled(bool)), SLOT(slotShowPrinterInfos(bool))); tact = new KToggleAction(i18n("Toggle Printer &Filtering"), "filter", 0, m_actions, "view_pfilter"); tact->setChecked(KMManager::self()->isFilterEnabled()); connect(tact, SIGNAL(toggled(bool)), SLOT(slotToggleFilter(bool))); new KAction(i18n("%1 &Handbook").arg("KDEPrint"), "contents", 0, this, SLOT(slotHelp()), m_actions, "invoke_help"); new KAction(i18n("%1 &Web Site").arg("KDEPrint"), "network", 0, this, SLOT(slotHelp()), m_actions, "invoke_web"); KActionMenu *mact = new KActionMenu(i18n("Pri&nter Tools"), "package_utilities", m_actions, "printer_tool"); mact->setDelayed(false); connect(mact->popupMenu(), SIGNAL(activated(int)), SLOT(slotToolSelected(int))); QStringList files = KGlobal::dirs()->findAllResources("data", "kdeprint/tools/*.desktop"); for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { KSimpleConfig conf(*it); conf.setGroup("Desktop Entry"); mact->popupMenu()->insertItem(conf.readEntry("Name", "Unnamed"), mact->popupMenu()->count()); m_toollist << conf.readEntry("X-KDE-Library"); } // add actions to the toolbar m_actions->action("printer_add")->plug(m_toolbar); m_actions->action("printer_add_special")->plug(m_toolbar); m_toolbar->insertLineSeparator(); m_actions->action("printer_state_change")->plug(m_toolbar); m_actions->action("printer_spool_change")->plug(m_toolbar); m_toolbar->insertSeparator(); m_actions->action("printer_hard_default")->plug(m_toolbar); m_actions->action("printer_soft_default")->plug(m_toolbar); m_actions->action("printer_remove")->plug(m_toolbar); m_toolbar->insertSeparator(); m_actions->action("printer_configure")->plug(m_toolbar); m_actions->action("printer_test")->plug(m_toolbar); m_actions->action("printer_tool")->plug(m_toolbar); m_pactionsindex = m_toolbar->insertSeparator(); m_toolbar->insertLineSeparator(); m_actions->action("server_restart")->plug(m_toolbar); m_actions->action("server_configure")->plug(m_toolbar); m_toolbar->insertLineSeparator(); m_actions->action("manager_configure")->plug(m_toolbar); m_actions->action("view_refresh")->plug(m_toolbar); m_toolbar->insertLineSeparator(); m_actions->action("view_printerinfos")->plug(m_toolbar); m_actions->action("view_change")->plug(m_toolbar); m_actions->action("orientation_change")->plug(m_toolbar); m_actions->action("view_pfilter")->plug(m_toolbar); // add actions to the menu bar QPopupMenu *menu = new QPopupMenu(this); m_actions->action("printer_add")->plug(menu); m_actions->action("printer_add_special")->plug(menu); // m_menubar->insertItem( i18n( "Add" ), menu ); m_menubar->insertButton("wizard", 0, true, i18n("Add")); m_menubar->getButton(0)->setPopup(menu, true); menu = new QPopupMenu(this); m_actions->action("printer_state_change")->plug(menu); m_actions->action("printer_spool_change")->plug(menu); menu->insertSeparator(); m_actions->action("printer_hard_default")->plug(menu); m_actions->action("printer_soft_default")->plug(menu); m_actions->action("printer_remove")->plug(menu); menu->insertSeparator(); m_actions->action("printer_configure")->plug(menu); m_actions->action("printer_test")->plug(menu); m_actions->action("printer_tool")->plug(menu); menu->insertSeparator(); // m_menubar->insertItem( i18n( "Printer" ), menu ); m_menubar->insertButton("printer1", 1, true, i18n("Printer")); m_menubar->getButton(1)->setPopup(menu, true); menu = new QPopupMenu(this); m_actions->action("server_restart")->plug(menu); m_actions->action("server_configure")->plug(menu); // m_menubar->insertItem( i18n( "Server" ), menu ); m_menubar->insertButton("misc", 2, true, i18n("Print Server")); m_menubar->getButton(2)->setPopup(menu, true); menu = new QPopupMenu(this); m_actions->action("manager_configure")->plug(menu); m_actions->action("view_refresh")->plug(menu); // m_menubar->insertItem( i18n( "Manager" ), menu ); m_menubar->insertButton("kdeprint_configmgr", 3, true, i18n("Print Manager")); m_menubar->getButton(3)->setPopup(menu, true); menu = new QPopupMenu(this); m_actions->action("view_printerinfos")->plug(menu); m_actions->action("view_change")->plug(menu); m_actions->action("orientation_change")->plug(menu); m_actions->action("view_toolbar")->plug(menu); m_actions->action("view_menubar")->plug(menu); menu->insertSeparator(); m_actions->action("view_pfilter")->plug(menu); // m_menubar->insertItem( i18n( "View" ), menu ); m_menubar->insertButton("view_remove", 4, true, i18n("View")); m_menubar->getButton(4)->setPopup(menu, true); // m_menubar->setMinimumHeight( m_menubar->heightForWidth( 1000 ) ); menu = new QPopupMenu(this); m_actions->action("invoke_help")->plug(menu); m_actions->action("invoke_web")->plug(menu); m_menubar->insertButton("help", 5, true, i18n("Documentation")); m_menubar->getButton(5)->setPopup(menu, true); loadPluginActions(); slotPrinterSelected(QString::null); }
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); } }
KateFileSelector::KateFileSelector( KateMainWindow *mainWindow, KateViewManager *viewManager, QWidget * parent, const char * name ) : QVBox (parent, name), mainwin(mainWindow), viewmanager(viewManager) { mActionCollection = new KActionCollection( this ); QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar ); KateFileSelectorToolBarParent *tbp=new KateFileSelectorToolBarParent(this); toolbar = new KateFileSelectorToolBar(tbp); tbp->setToolBar(toolbar); toolbar->setMovingEnabled(false); toolbar->setFlat(true); qInstallMsgHandler( oldHandler ); cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" ); cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion); cmbPath->setCompletionObject( cmpl ); cmbPath->setAutoDeleteCompletionObject( true ); cmbPath->listBox()->installEventFilter( this ); dir = new KDirOperator(KURL(), this, "operator"); dir->setView(KFile::/* Simple */Detail); dir->view()->setSelectionMode(KFile::Extended); connect ( dir, SIGNAL( viewChanged(KFileView *) ), this, SLOT( selectorViewChanged(KFileView *) ) ); setStretchFactor(dir, 2); KActionCollection *coll = dir->actionCollection(); // some shortcuts of diroperator that clashes with Kate coll->action( "delete" )->setShortcut( KShortcut( ALT + Key_Delete ) ); coll->action( "reload" )->setShortcut( KShortcut( ALT + Key_F5 ) ); coll->action( "back" )->setShortcut( KShortcut( ALT + SHIFT + Key_Left ) ); coll->action( "forward" )->setShortcut( KShortcut( ALT + SHIFT + Key_Right ) ); // some consistency - reset up for dir too coll->action( "up" )->setShortcut( KShortcut( ALT + SHIFT + Key_Up ) ); coll->action( "home" )->setShortcut( KShortcut( CTRL + ALT + Key_Home ) ); // bookmarks action! KActionMenu *acmBookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark", mActionCollection, "bookmarks" ); acmBookmarks->setDelayed( false ); bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() ); QHBox* filterBox = new QHBox(this); btnFilter = new QToolButton( filterBox ); btnFilter->setIconSet( SmallIconSet("filter" ) ); btnFilter->setToggleButton( true ); filter = new KHistoryCombo( true, filterBox, "filter"); filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); filterBox->setStretchFactor(filter, 2); connect( btnFilter, SIGNAL( clicked() ), this, SLOT( btnFilterClick() ) ); connect( filter, SIGNAL( activated(const QString&) ), SLOT( slotFilterChange(const QString&) ) ); connect( filter, SIGNAL( returnPressed(const QString&) ), filter, SLOT( addToHistory(const QString&) ) ); // kaction for the dir sync method acSyncDir = new KAction( i18n("Current Document Folder"), "curfiledir", 0, this, SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" ); toolbar->setIconText( KToolBar::IconOnly ); toolbar->setIconSize( 16 ); toolbar->setEnableContextMenu( false ); connect( cmbPath, SIGNAL( urlActivated( const KURL& )), this, SLOT( cmbPathActivated( const KURL& ) )); connect( cmbPath, SIGNAL( returnPressed( const QString& )), this, SLOT( cmbPathReturnPressed( const QString& ) )); connect(dir, SIGNAL(urlEntered(const KURL&)), this, SLOT(dirUrlEntered(const KURL&)) ); connect(dir, SIGNAL(finishedLoading()), this, SLOT(dirFinishedLoading()) ); // enable dir sync button if current doc has a valid URL connect ( viewmanager, SIGNAL( viewChanged() ), this, SLOT( kateViewChanged() ) ); // Connect the bookmark handler connect( bookmarkHandler, SIGNAL( openURL( const QString& )), this, SLOT( setDir( const QString& ) ) ); waitingUrl = QString::null; // whatsthis help QWhatsThis::add( cmbPath, i18n("<p>Here you can enter a path for a folder to display." "<p>To go to a folder previously entered, press the arrow on " "the right and choose one. <p>The entry has folder " "completion. Right-click to choose how completion should behave.") ); QWhatsThis::add( filter, i18n("<p>Here you can enter a name filter to limit which files are displayed." "<p>To clear the filter, toggle off the filter button to the left." "<p>To reapply the last filter used, toggle on the filter button." ) ); QWhatsThis::add( btnFilter, i18n("<p>This button clears the name filter when toggled off, or " "reapplies the last filter used when toggled on.") ); }
void KMJobViewer::initActions() { // job actions KAction *hact = new KAction(i18n("&Hold"),"stop",0,this,SLOT(slotHold()),actionCollection(),"job_hold"); KAction *ract = new KAction(i18n("&Resume"),"run",0,this,SLOT(slotResume()),actionCollection(),"job_resume"); KAction *dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,this,SLOT(slotRemove()),actionCollection(),"job_remove"); KAction *sact = new KAction(i18n("Res&tart"),"redo",0,this,SLOT(slotRestart()),actionCollection(),"job_restart"); KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move"); mact->setDelayed(false); connect(mact->popupMenu(),SIGNAL(activated(int)),SLOT(slotMove(int))); connect(mact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold())); connect(mact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release())); connect(mact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowMoveMenu())); KToggleAction *tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed"); tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted); connect(tact,SIGNAL(toggled(bool)),SLOT(slotShowCompleted(bool))); KToggleAction *uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs"); uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal")); connect(uact, SIGNAL(toggled(bool)), SLOT(slotUserOnly(bool))); m_userfield = new QLineEdit(0); m_userfield->setText(getenv("USER")); connect(m_userfield, SIGNAL(returnPressed()), SLOT(slotUserChanged())); connect(uact, SIGNAL(toggled(bool)), m_userfield, SLOT(setEnabled(bool))); m_userfield->setEnabled(false); m_userfield->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); KWidgetAction *ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username"); if (!m_pop) { m_pop = new QPopupMenu(this); connect(m_pop,SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold())); connect(m_pop,SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release())); hact->plug(m_pop); ract->plug(m_pop); m_pop->insertSeparator(); dact->plug(m_pop); mact->plug(m_pop); m_pop->insertSeparator(); sact->plug(m_pop); } // Filter actions KActionMenu *fact = new KActionMenu(i18n("&Select Printer"), "kdeprint_printer", actionCollection(), "filter_modify"); fact->setDelayed(false); connect(fact->popupMenu(),SIGNAL(activated(int)),SLOT(slotPrinterSelected(int))); connect(fact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold())); connect(fact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release())); connect(fact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowPrinterMenu())); if (!m_standalone) { KToolBar *toolbar = toolBar(); hact->plug(toolbar); ract->plug(toolbar); toolbar->insertSeparator(); dact->plug(toolbar); mact->plug(toolbar); toolbar->insertSeparator(); sact->plug(toolbar); toolbar->insertSeparator(); tact->plug(toolbar); uact->plug(toolbar); ufact->plug(toolbar); } else { // stand-alone application KStdAction::quit(kapp,SLOT(quit()),actionCollection()); KStdAction::close(this,SLOT(slotClose()),actionCollection()); KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection()); // refresh action new KAction(i18n("Refresh"),"reload",0,this,SLOT(slotRefresh()),actionCollection(),"refresh"); // create status bar KStatusBar *statusbar = statusBar(); m_stickybox = new QCheckBox( i18n( "Keep window permanent" ), statusbar ); statusbar->addWidget( m_stickybox, 1, false ); statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true); statusbar->setItemFixed(0); updateStatusBar(); createGUI(); } loadPluginActions(); slotSelectionChanged(); }
KexiReportView::KexiReportView(QWidget *parent) : KexiView(parent), m_preRenderer(0), m_reportDocument(0) //! @todo KEXI3, m_kexi(0), m_functions(0) { setObjectName("KexiReportDesigner_DataView"); m_reportView = new KReportView(this); layout()->addWidget(m_reportView); #ifndef KEXI_MOBILE m_pageSelector = new KexiRecordNavigator(*m_reportView->scrollArea(), m_reportView); m_pageSelector->setInsertingButtonVisible(false); m_pageSelector->setInsertingEnabled(false); m_pageSelector->setLabelText(xi18nc("Page selector label", "Page:")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonFirst, xi18n("Go to first page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonFirst, xi18n("Goes to first page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonPrevious, xi18n("Go to previous page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonPrevious, xi18n("Goes to previous page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonNext, xi18n("Go to next page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonNext, xi18n("Goes to next page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonLast, xi18n("Go to last page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonLast, xi18n("Goes to last page")); m_pageSelector->setNumberFieldToolTips(xi18n("Current page number"), xi18n("Number of pages")); m_pageSelector->setRecordHandler(this); #endif // -- setup local actions QList<QAction*> viewActions; QAction* a; #ifndef KEXI_MOBILE viewActions << (a = new QAction(koIcon("document-print"), xi18n("Print"), this)); a->setObjectName("print_report"); a->setToolTip(xi18n("Print report")); a->setWhatsThis(xi18n("Prints the current report.")); connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); KActionMenu *exportMenu = new KActionMenu(koIcon("document-export"), xi18nc("@title:menu","E&xport As"), this); exportMenu->setObjectName("report_export_as"); exportMenu->setDelayed(false); #endif #ifdef KEXI_MOBILE viewActions << (a = new QAction(xi18n("Export:"), this)); a->setEnabled(false); //!TODO this is a bit of a dirty way to add what looks like a label to the toolbar! // " ", not "", is said to be needed in maemo, the icon didn't display properly without it viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), xi18nc("open dialog to export as text document", "Text Document..."), this)); #endif a->setObjectName("export_as_text_document"); a->setToolTip(xi18n("Export the report as a text document (in OpenDocument Text format)")); a->setWhatsThis(xi18n("Exports the report as a text document (in OpenDocument Text format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsTextDocument())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("application-pdf"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-pdf"), xi18nc("Portable Document Format...", "PDF..."), this)); #endif a->setObjectName("export_as_pdf"); a->setToolTip(xi18n("Export as PDF")); a->setWhatsThis(xi18n("Exports the current report as PDF.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsPdf())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), xi18nc("open dialog to export as spreadsheet", "Spreadsheet..."), this)); #endif a->setObjectName("export_as_spreadsheet"); a->setToolTip(xi18n("Export the report as a spreadsheet (in OpenDocument Spreadsheet format)")); a->setWhatsThis(xi18n("Exports the report as a spreadsheet (in OpenDocument Spreadsheet format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsSpreadsheet())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("text-html"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("text-html"), xi18nc("open dialog to export as web page", "Web Page..."), this)); #endif a->setObjectName("export_as_web_page"); a->setToolTip(xi18n("Export the report as a web page (in HTML format)")); a->setWhatsThis(xi18n("Exports the report as a web page (in HTML format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsWebPage())); setViewActions(viewActions); #ifndef KEXI_MOBILE // setup main menu actions QList<QAction*> mainMenuActions; mainMenuActions << exportMenu; setMainMenuActions(mainMenuActions); connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage())); connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage())); connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage())); connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage())); #endif }
void JuK::setupActions() { ActionCollection::actions()->setWidget(this); KStdAction::quit(this, SLOT(slotQuit()), actions()); KStdAction::undo(this, SLOT(slotUndo()), actions()); KStdAction::cut(kapp, SLOT(cut()), actions()); KStdAction::copy(kapp, SLOT(copy()), actions()); KStdAction::paste(kapp, SLOT(paste()), actions()); KStdAction::clear(kapp, SLOT(clear()), actions()); KStdAction::selectAll(kapp, SLOT(selectAll()), actions()); new KAction(i18n("Remove From Playlist"), "edit_remove", 0, kapp, SLOT(clear()), actions(), "removeFromPlaylist"); KActionMenu *actionMenu = new KActionMenu(i18n("&Random Play"), "roll", actions(), "actionMenu"); actionMenu->setDelayed(false); KRadioAction *ka = new KRadioAction(i18n("&Disable Random Play"), "player_playlist", 0, actions(), "disableRandomPlay"); ka->setExclusiveGroup("randomPlayGroup"); actionMenu->insert(ka); m_randomPlayAction = new KRadioAction(i18n("Use &Random Play"), "roll", 0, actions(), "randomPlay"); m_randomPlayAction->setExclusiveGroup("randomPlayGroup"); actionMenu->insert(m_randomPlayAction); ka = new KRadioAction(i18n("Use &Album Random Play"), "roll", 0, actions(), "albumRandomPlay"); ka->setExclusiveGroup("randomPlayGroup"); connect(ka, SIGNAL(toggled(bool)), SLOT(slotCheckAlbumNextAction(bool))); actionMenu->insert(ka); new KAction(i18n("&Play"), "player_play", 0, m_player, SLOT(play()), actions(), "play"); new KAction(i18n("P&ause"), "player_pause", 0, m_player, SLOT(pause()), actions(), "pause"); new KAction(i18n("&Stop"), "player_stop", 0, m_player, SLOT(stop()), actions(), "stop"); new KToolBarPopupAction(i18n("previous track", "Previous"), "player_start", KShortcut(), m_player, SLOT(back()), actions(), "back"); new KAction(i18n("next track", "&Next"), "player_end", KShortcut(), m_player, SLOT(forward()), actions(), "forward"); new KToggleAction(i18n("&Loop Playlist"), 0, KShortcut(), actions(), "loopPlaylist"); KToggleAction *resizeColumnAction = new KToggleAction(i18n("&Resize Playlist Columns Manually"), KShortcut(), actions(), "resizeColumnsManually"); resizeColumnAction->setCheckedState(i18n("&Resize Column Headers Automatically")); // the following are not visible by default new KAction(i18n("Mute"), "mute", 0, m_player, SLOT(mute()), actions(), "mute"); new KAction(i18n("Volume Up"), "volumeUp", 0, m_player, SLOT(volumeUp()), actions(), "volumeUp"); new KAction(i18n("Volume Down"), "volumeDown", 0, m_player, SLOT(volumeDown()), actions(), "volumeDown"); new KAction(i18n("Play / Pause"), "playPause", 0, m_player, SLOT(playPause()), actions(), "playPause"); new KAction(i18n("Seek Forward"), "seekForward", 0, m_player, SLOT(seekForward()), actions(), "seekForward"); new KAction(i18n("Seek Back"), "seekBack", 0, m_player, SLOT(seekBack()), actions(), "seekBack"); ////////////////////////////////////////////////// // settings menu ////////////////////////////////////////////////// m_toggleSplashAction = new KToggleAction(i18n("Show Splash Screen on Startup"), KShortcut(), actions(), "showSplashScreen"); m_toggleSplashAction->setCheckedState(i18n("Hide Splash Screen on Startup")); m_toggleSystemTrayAction = new KToggleAction(i18n("&Dock in System Tray"), KShortcut(), actions(), "toggleSystemTray"); m_toggleDockOnCloseAction = new KToggleAction(i18n("&Stay in System Tray on Close"), KShortcut(), actions(), "dockOnClose"); m_togglePopupsAction = new KToggleAction(i18n("Popup &Track Announcement"), KShortcut(), this, 0, actions(), "togglePopups"); new KToggleAction(i18n("Save &Play Queue on Exit"), KShortcut(), this, 0, actions(), "saveUpcomingTracks"); connect(m_toggleSystemTrayAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleSystemTray(bool))); m_outputSelectAction = PlayerManager::playerSelectAction(actions()); if(m_outputSelectAction) m_outputSelectAction->setCurrentItem(0); new KAction(i18n("&Tag Guesser..."), 0, 0, this, SLOT(slotConfigureTagGuesser()), actions(), "tagGuesserConfig"); new KAction(i18n("&File Renamer..."), 0, 0, this, SLOT(slotConfigureFileRenamer()), actions(), "fileRenamerConfig"); KStdAction::keyBindings(this, SLOT(slotEditKeys()), actions()); ////////////////////////////////////////////////// // just in the toolbar ////////////////////////////////////////////////// m_sliderAction = new SliderAction(i18n("Track Position"), actions(), "trackPositionAction"); }
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 *))); }
FileBrowser::FileBrowser( const char * name, Medium * medium ) : QVBox( 0, name ) { KActionCollection *actionCollection; SearchPane *searchPane; KURL *location; // Try to keep filebrowser working even if not in a medium context // so if a medium object not passed in, keep earlier behavior if (!medium) { m_medium = 0; location = new KURL( Pana::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) ); KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location ); //KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes //if there is a problem so there is no point in using it anyways. //so... setting the diroperator to ~ is the least sucky option if ( !location->isLocalFile() || !currentFolder->isReadable() ) { delete location; location = new KURL( QDir::homeDirPath() ) ; } } else{ m_medium = medium; location = new KURL( m_medium->mountPoint() ); } KActionCollection* ac = new KActionCollection( this ); KStdAction::selectAll( this, SLOT( selectAll() ), ac, "filebrowser_select_all" ); KToolBar *toolbar = new Browser::ToolBar( this ); { //Filter LineEdit KToolBar* searchToolBar = new Browser::ToolBar( this ); KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar ); m_filter = new ClickLineEdit( i18n( "Enter search terms here" ), searchToolBar ); searchToolBar->setStretchableWidget( m_filter ); connect( button, SIGNAL(clicked()), m_filter, SLOT(clear()) ); QToolTip::add( button, i18n( "Clear search field" ) ); QToolTip::add( m_filter, i18n( "Enter space-separated terms to search in the directory-listing" ) ); } { //Directory Listing QVBox *container; QHBox *box; container = new QVBox( this ); container->setFrameStyle( m_filter->frameStyle() ); container->setMargin( 3 ); container->setSpacing( 2 ); container->setBackgroundMode( Qt::PaletteBase ); box = new QHBox( container ); box->setMargin( 3 ); box->setBackgroundMode( Qt::PaletteBase ); //folder selection combo box m_combo = new KURLComboBox( KURLComboBox::Directories, true, box, "path combo" ); if (!m_medium){ m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) ); m_combo->setAutoDeleteCompletionObject( true ); } m_combo->setMaxItems( 9 ); m_combo->setURLs( Pana::config( "Filebrowser" )->readPathListEntry( "Dir History" ) ); if (!m_medium) m_combo->lineEdit()->setText( location->path() ); else m_combo->lineEdit()->setText( "/" ); //The main widget with file listings and that m_dir = new MyDirOperator( *location, container, m_medium ); m_dir->setEnableDirHighlighting( true ); m_dir->setMode( KFile::Mode((int)KFile::Files | (int)KFile::Directory) ); //allow selection of multiple files + dirs m_dir->setOnlyDoubleClickSelectsFiles( true ); //Pana type settings m_dir->readConfig( Pana::config( "Filebrowser" ) ); m_dir->setView( KFile::Default ); //will set userconfigured view, will load URL m_dir->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); m_dir->setAcceptDrops( true ); //Automatically open folder after hovering above it...probably a good thing //but easily disabled by commenting this line out //Disabled for now because can't show . and .. folders. //TODO: Find out a way to fix this? //m_dir->setDropOptions( KFileView::AutoOpenDirs ); static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame ); static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 ); actionCollection = m_dir->actionCollection(); searchPane = new SearchPane( this ); setStretchFactor( container, 2 ); } { QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu(); menu->clear(); menu->insertItem( SmallIconSet( Pana::icon( "files" ) ), i18n( "&Load" ), MakePlaylist ); menu->insertItem( SmallIconSet( Pana::icon( "add_playlist" ) ), i18n( "&Append to Playlist" ), AppendToPlaylist ); menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Track" ), QueueTrack ); menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Tracks" ), QueueTracks ); menu->insertItem( SmallIconSet( Pana::icon( "save" ) ), i18n( "&Save as Playlist..." ), SavePlaylist ); menu->insertSeparator(); if (!m_medium) menu->insertItem( SmallIconSet( Pana::icon( "device" ) ), i18n( "&Transfer to Media Device" ), MediaDevice ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Organize Files..." ), OrganizeFiles ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Copy Files to Collection..." ), CopyToCollection ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Move Files to Collection..." ), MoveToCollection ); menu->insertItem( SmallIconSet( Pana::icon( "burn" ) ), i18n("Burn to CD..."), BurnCd ); menu->insertSeparator(); menu->insertItem( i18n( "&Select All Files" ), SelectAllFiles ); menu->insertSeparator(); actionCollection->action( "delete" )->setIcon( Pana::icon( "remove" ) ); actionCollection->action( "delete" )->plug( menu ); menu->insertSeparator(); menu->insertItem( SmallIconSet( Pana::icon( "info" ) ), i18n( "Edit Track &Information..." ), EditTags ); actionCollection->action( "properties" )->plug( menu ); menu->setItemEnabled( BurnCd, K3bExporter::isAvailable() ); connect( menu, SIGNAL(aboutToShow()), SLOT(prepareContextMenu()) ); connect( menu, SIGNAL(activated( int )), SLOT(contextMenuActivated( int )) ); } { KActionMenu *a; a = static_cast<KActionMenu*>( actionCollection->action( "sorting menu" ) ); a->setIcon( Pana::icon( "configure" ) ); a->setDelayed( false ); //TODO should be done by KDirOperator actionCollection->action( "delete" )->setShortcut( KShortcut( SHIFT + Key_Delete ) ); a = new KActionMenu( i18n("Bookmarks"), "bookmark", actionCollection, "bookmarks" ); a->setDelayed( false ); new KBookmarkHandler( m_dir, a->popupMenu() ); } { if ( KAction *a = actionCollection->action( "up" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "back" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "forward" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "home" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "reload" ) ) { a->setIcon( Pana::icon( "refresh" ) ); a->plug( toolbar ); } toolbar->insertLineSeparator(); if ( KAction *a = actionCollection->action( "short view" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "detailed view" ) ) a->plug( toolbar ); toolbar->insertLineSeparator(); if ( KAction *a = actionCollection->action( "sorting menu" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "bookmarks" ) ) a->plug( toolbar ); KAction *gotoCurrent = new KAction( i18n("Go To Current Track Folder"), Pana::icon( "music" ), 0, this, SLOT( gotoCurrentFolder() ), actionCollection ); gotoCurrent->plug( toolbar ); disconnect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( cdUp() ) ); connect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( myCdUp() ) ); disconnect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( home() ) ); connect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( myHome() ) ); } connect( m_filter, SIGNAL(textChanged( const QString& )), SLOT(setFilter( const QString& )) ); connect( m_combo, SIGNAL(urlActivated( const KURL& )), SLOT(setUrl( const KURL& )) ); connect( m_combo, SIGNAL(returnPressed( const QString& )), SLOT(setUrl( const QString& )) ); connect( m_dir, SIGNAL(viewChanged( KFileView* )), SLOT(slotViewChanged( KFileView* )) ); connect( m_dir, SIGNAL(fileSelected( const KFileItem* )), SLOT(activate( const KFileItem* )) ); connect( m_dir, SIGNAL(urlEntered( const KURL& )), SLOT(urlChanged( const KURL& )) ); connect( m_dir, SIGNAL(urlEntered( const KURL& )), searchPane, SLOT(urlChanged( const KURL& )) ); connect( m_dir, SIGNAL(dropped( const KFileItem*, QDropEvent*, const KURL::List& )), SLOT(dropped( const KFileItem*, QDropEvent*, const KURL::List& )) ); setSpacing( 4 ); setFocusProxy( m_dir ); //so the dirOperator is focused when we get focus events // Toolbar is more than 250px wide, BrowserBar doesn't allow that. -> Resizing issues. setMinimumWidth( 250 /* toolbar->sizeHint().width() */ ); }