-void DolphinMainWindow::slotToolBarMenuButtonDeleted()
-{
- m_openToolBarMenuButton = 0;
- m_updateToolBarTimer->start();
-}
-
-void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize)
-{
- if (m_openToolBarMenuButton) {
- m_openToolBarMenuButton->setIconSize(iconSize);
- }
-}
-
-void DolphinMainWindow::init()
-{
- DolphinSettings& settings = DolphinSettings::instance();
-
- // Check whether Dolphin runs the first time. If yes then
- // a proper default window size is given at the end of DolphinMainWindow::init().
- GeneralSettings* generalSettings = settings.generalSettings();
- const bool firstRun = generalSettings->firstRun();
- if (firstRun) {
- generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
- }
-
- setAcceptDrops(true);
-
- m_viewTab[m_tabIndex].splitter = new QSplitter(this);
- m_viewTab[m_tabIndex].splitter->setChildrenCollapsible(false);
-
- setupActions();
-
- const KUrl homeUrl(generalSettings->homeUrl());
- setUrlAsCaption(homeUrl);
- m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
- connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
- connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
-
- m_viewTab[m_tabIndex].primaryView = createViewContainer(homeUrl, m_viewTab[m_tabIndex].splitter);
-
- m_activeViewContainer = m_viewTab[m_tabIndex].primaryView;
- connectViewSignals(m_activeViewContainer);
- DolphinView* view = m_activeViewContainer->view();
- m_activeViewContainer->show();
- m_actionHandler->setCurrentView(view);
-
- m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
- connect(this, SIGNAL(urlChanged(const KUrl&)),
- m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
-
- m_tabBar = new KTabBar(this);
- m_tabBar->setMovable(true);
- m_tabBar->setTabsClosable(true);
- connect(m_tabBar, SIGNAL(currentChanged(int)),
- this, SLOT(setActiveTab(int)));
- connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
- this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(contextMenu(int, const QPoint&)),
- this, SLOT(openTabContextMenu(int, const QPoint&)));
- connect(m_tabBar, SIGNAL(newTabRequest()),
- this, SLOT(openNewTab()));
- connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
- this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
- connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
- this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(tabMoved(int, int)),
- this, SLOT(slotTabMoved(int, int)));
- connect(m_tabBar, SIGNAL(receivedDropEvent(int, QDropEvent*)),
- this, SLOT(tabDropEvent(int, QDropEvent*)));
-
- m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open
-
- QWidget* centralWidget = new QWidget(this);
- m_centralWidgetLayout = new QVBoxLayout(centralWidget);
- m_centralWidgetLayout->setSpacing(0);
- m_centralWidgetLayout->setMargin(0);
- m_centralWidgetLayout->addWidget(m_tabBar);
- m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter, 1);
-
- setCentralWidget(centralWidget);
- setupDockWidgets();
- emit urlChanged(homeUrl);
-
- setupGUI(Keys | Save | Create | ToolBar);
- stateChanged("new_file");
-
- QClipboard* clipboard = QApplication::clipboard();
- connect(clipboard, SIGNAL(dataChanged()),
- this, SLOT(updatePasteAction()));
-
- if (generalSettings->splitView()) {
- toggleSplitView();
- }
- updateEditActions();
- updateViewActions();
- updateGoActions();
-
- QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
- showFilterBarAction->setChecked(generalSettings->filterBar());
-
- if (firstRun) {
- menuBar()->setVisible(false);
- // Assure a proper default size if Dolphin runs the first time
- resize(750, 500);
- }
-
- const bool showMenu = !menuBar()->isHidden();
- QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
- showMenuBarAction->setChecked(showMenu); // workaround for bug #171080
- if (!showMenu) {
- createToolBarMenuButton();
- }
-}
-