MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); // Settings m_settings = new VSettings("org.hawaii.desktop"); connect(m_settings, SIGNAL(changed()), this, SLOT(settingsChanged())); // Connect signals connect(ui->actionNewTab, SIGNAL(triggered()), this, SLOT(slotNewTab())); connect(ui->actionNewWindow, SIGNAL(triggered()), this, SLOT(slotNewWindow())); connect(ui->actionCloseTab, SIGNAL(triggered()), this, SLOT(slotCloseCurrentTab())); connect(ui->actionOpenFileManager, SIGNAL(triggered()), this, SLOT(slotOpenFileManager())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste())); connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(slotFind())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int))); // Start with a tab slotNewTab(); }
KonqSidebarHistoryModule::KonqSidebarHistoryModule( KonqSidebarTree * parentTree, const char *name ) : QObject( 0L, name ), KonqSidebarTreeModule( parentTree ), m_dict( 349 ), m_topLevelItem( 0L ), m_dlg( 0L ), m_initialized( false ) { if ( !s_settings ) { sd.setObject( s_settings, new KonqSidebarHistorySettings( 0, "history settings" )); s_settings->readSettings( true ); } connect( s_settings, SIGNAL( settingsChanged() ), SLOT( slotSettingsChanged() )); m_dict.setAutoDelete( true ); m_currentTime = QDateTime::currentDateTime(); KConfig *kc = KGlobal::config(); KConfigGroupSaver cs( kc, "HistorySettings" ); m_sortsByName = kc->readEntry( "SortHistory", "byDate" ) == "byName"; KonqHistoryManager *manager = KonqHistoryManager::kself(); connect( manager, SIGNAL( loadingFinished() ), SLOT( slotCreateItems() )); connect( manager, SIGNAL( cleared() ), SLOT( clear() )); connect( manager, SIGNAL( entryAdded( const KonqHistoryEntry * ) ), SLOT( slotEntryAdded( const KonqHistoryEntry * ) )); connect( manager, SIGNAL( entryRemoved( const KonqHistoryEntry *) ), SLOT( slotEntryRemoved( const KonqHistoryEntry *) )); connect( parentTree, SIGNAL( expanded( QListViewItem * )), SLOT( slotItemExpanded( QListViewItem * ))); m_collection = new KActionCollection( this, "history actions" ); (void) new KAction( i18n("New &Window"), "window_new", 0, this, SLOT( slotNewWindow() ), m_collection, "open_new"); (void) new KAction( i18n("&Remove Entry"), "editdelete", 0, this, SLOT( slotRemoveEntry() ), m_collection, "remove"); (void) new KAction( i18n("C&lear History"), "history_clear", 0, this, SLOT( slotClearHistory() ), m_collection, "clear"); (void) new KAction( i18n("&Preferences..."), "configure", 0, this, SLOT( slotPreferences()), m_collection, "preferences"); KRadioAction *sort; sort = new KRadioAction( i18n("By &Name"), 0, this, SLOT( slotSortByName() ), m_collection, "byName"); sort->setExclusiveGroup("SortGroup"); sort->setChecked( m_sortsByName ); sort = new KRadioAction( i18n("By &Date"), 0, this, SLOT( slotSortByDate() ), m_collection, "byDate"); sort->setExclusiveGroup("SortGroup"); sort->setChecked( !m_sortsByName ); m_folderClosed = SmallIcon( "folder" ); m_folderOpen = SmallIcon( "folder_open" ); slotSettingsChanged(); // read the settings }
void QvvMainWindow::setupMenuBar() { /*--------------------------------------------------------------------*/ QMenu *menu; toolbar = new QToolBar( this ); toolbar->setVisible( opt_use_toolbar ? 1 : 0 ); menu = menuBar()->addMenu( tr("&File") ); QAction *action; /* action = menu->addAction(tr("Save layout...")); connect(action, SIGNAL(triggered()), this, SLOT(saveLayout())); action = menu->addAction(tr("Load layout...")); connect(action, SIGNAL(triggered()), this, SLOT(loadLayout())); action = menu->addAction(tr("Switch layout direction")); connect(action, SIGNAL(triggered()), this, SLOT(switchLayoutDirection())); menu->addSeparator(); */ action = menu->addAction( tr("&Reload directory"), this, SLOT(slotReloadDir()), Qt::Key_F5 ); action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Delete selected images"), this, SLOT(slotDeleteSelected()), Qt::Key_Delete ); //action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Quit"), this, SLOT(close()), Qt::AltModifier + Qt::Key_X ); action->setIcon( QIcon( ":/images/system-log-out.png" ) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&View")); action = menu->addAction( tr("&Toggle toolbar"), this, SLOT(slotToggleToolbar()) ); action = menu->addAction( tr("Enable &thumbnails") ); action->setCheckable( true ); action->setChecked( opt_thumbs ); action->setShortcut( Qt::Key_F6 ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotThumbs()) ); action = menu->addAction( tr("Show d&irectories only") ); action->setCheckable( true ); action->setChecked( opt_dirs_only ); action->setShortcut( Qt::AltModifier + Qt::Key_I ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotShowDirsOnly()) ); menu->addSeparator(); action = menu->addAction( tr("Sort by &Name"), this, SLOT(slotSortColumn1()), Qt::AltModifier + Qt::Key_N ); action = menu->addAction( tr("Sort by &Modify Time"), this, SLOT(slotSortColumn3()), Qt::AltModifier + Qt::Key_M ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Go")); action = menu->addAction( tr("Go to p&arent directory"), this, SLOT(slotGoUp()), Qt::Key_Backspace ); action->setIcon( QIcon( ":/images/go-up.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Change &directory"), this, SLOT(slotChangeDir()), Qt::AltModifier + Qt::Key_D ); action->setIcon( QIcon( ":/images/folder.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Go to &home directory"), this, SLOT(slotHomeDir()), Qt::AltModifier + Qt::Key_Home ); action->setIcon( QIcon( ":/images/go-home.png" ) ); toolbar->addAction( action ); menu->addSeparator(); action = menu->addAction( tr("Go to &Random image"), this, SLOT(slotRandomItem()), Qt::Key_Asterisk ); action = menu->addAction( tr("Activate current item"), this, SLOT(enterCurrent()), Qt::Key_Right ); action = menu->addAction( tr("Display all &selected images"), this, SLOT(enterAllSelected()), Qt::ControlModifier + Qt::Key_Right ); action->setIcon( QIcon( ":/images/view_all.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Window")); action = menu->addAction( tr("&New browser window"), this, SLOT(slotNewWindow()), Qt::Key_F3 ); action->setIcon( QIcon( ":/images/window-new.png" ) ); toolbar->addAction( action ); menu->addAction( tr("&Close window"), this, SLOT(close()), Qt::Key_F4 ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Settings")); action = menu->addAction( tr("Create thumbnails if needed") ); action->setCheckable( true ); action->setChecked( opt_create_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotCreateThumbs()) ); action = menu->addAction( tr("Create smooth thumbnails") ); action->setCheckable( true ); action->setChecked( opt_create_smooth_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotSmoothThumbs()) ); action = menu->addAction( tr("Create new thumbnails in JPEG for JPEGs") ); action->setCheckable( true ); action->setChecked( opt_create_jpeg_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotJPEGThumbs()) ); menu->addSeparator(); action = menu->addAction( tr("Use toolbar upon startup") ); action->setCheckable( true ); action->setChecked( opt_use_toolbar ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotUseToolbar()) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Help") ); action = menu->addAction( tr("&Help Contents"), this, SLOT(slotHelp()), Qt::Key_F1 ); action->setIcon( QIcon( ":/images/help-browser.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("&About"), this, SLOT(slotAbout()), Qt::AltModifier + Qt::Key_A ); action->setIcon( QIcon( ":/images/face-glasses.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ addToolBar( toolbar ); }