+
+ GeneralSettings* generalSettings = GeneralSettings::self();
+ const bool firstRun = (generalSettings->version() < 200);
+ if (firstRun) {
+ generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
+ }
+
+ setAcceptDrops(true);
+
+ viewTab.splitter = new QSplitter(this);
+ viewTab.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()));
+
+ viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter);
+
+ m_activeViewContainer = viewTab.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(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,QPoint)),
+ this, SLOT(openTabContextMenu(int,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(viewTab.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) {
+ createControlButton();
+ }