this, SLOT(activeViewChanged(DolphinViewContainer*)));
connect(m_tabWidget, SIGNAL(tabCountChanged(int)),
this, SLOT(tabCountChanged(int)));
+ connect(m_tabWidget, SIGNAL(currentUrlChanged(KUrl)),
+ this, SLOT(setUrlAsCaption(KUrl)));
setCentralWidget(m_tabWidget);
setupActions();
updatePasteAction();
updateViewActions();
updateGoActions();
- setUrlAsCaption(url);
emit urlChanged(url);
}
updateGoActions();
const KUrl url = viewContainer->url();
- setUrlAsCaption(url);
-
emit urlChanged(url);
}
actionCollection()->action("activate_prev_tab")->setEnabled(enableTabActions);
}
+void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
+{
+ QString caption;
+ if (!url.isLocalFile()) {
+ caption.append(url.protocol() + " - ");
+ if (url.hasHost()) {
+ caption.append(url.host() + " - ");
+ }
+ }
+
+ const QString fileName = url.fileName().isEmpty() ? "/" : url.fileName();
+ caption.append(fileName);
+
+ setCaption(caption);
+}
+
void DolphinMainWindow::setupActions()
{
// setup 'File' menu
return installed;
}
-void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
-{
- QString caption;
- if (!url.isLocalFile()) {
- caption.append(url.protocol() + " - ");
- if (url.hasHost()) {
- caption.append(url.host() + " - ");
- }
- }
-
- const QString fileName = url.fileName().isEmpty() ? "/" : url.fileName();
- caption.append(fileName);
-
- setCaption(caption);
-}
-
void DolphinMainWindow::createPanelAction(const KIcon& icon,
const QKeySequence& shortcut,
QAction* dockAction,
*/
void tabCountChanged(int count);
+ /**
+ * Sets the window caption to url.fileName() if this is non-empty,
+ * "/" if the URL is "file:///", and url.protocol() otherwise.
+ */
+ void setUrlAsCaption(const KUrl& url);
+
private:
void setupActions();
void setupDockWidgets();
bool isKompareInstalled() const;
- /**
- * Sets the window caption to url.fileName() if this is non-empty,
- * "/" if the URL is "file:///", and url.protocol() otherwise.
- */
- void setUrlAsCaption(const KUrl& url);
-
/**
* Creates an action for showing/hiding a panel, that is accessible
* in "Configure toolbars..." and "Configure shortcuts...". This is necessary
m_primaryViewContainer = createViewContainer(primaryUrl);
connect(m_primaryViewContainer->view(), SIGNAL(urlChanged(KUrl)),
this, SIGNAL(activeViewUrlChanged(KUrl)));
+ connect(m_primaryViewContainer->view(), SIGNAL(redirection(KUrl,KUrl)),
+ this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
m_splitter->addWidget(m_primaryViewContainer);
m_primaryViewContainer->show();
if (newActiveView != oldActiveView) {
disconnect(oldActiveView, SIGNAL(urlChanged(KUrl)),
this, SIGNAL(activeViewUrlChanged(KUrl)));
+ disconnect(oldActiveView, SIGNAL(redirection(KUrl,KUrl)),
+ this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
connect(newActiveView, SIGNAL(urlChanged(KUrl)),
this, SIGNAL(activeViewUrlChanged(KUrl)));
+ connect(newActiveView, SIGNAL(redirection(KUrl,KUrl)),
+ this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
}
emit activeViewUrlChanged(activeViewContainer()->url());
emit activeViewChanged(activeViewContainer());
}
+void DolphinTabPage::slotViewUrlRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+{
+ Q_UNUSED(oldUrl);
+
+ emit activeViewUrlChanged(newUrl);
+}
+
DolphinViewContainer* DolphinTabPage::createViewContainer(const KUrl& url) const
{
DolphinViewContainer* container = new DolphinViewContainer(url, m_splitter);
*/
void slotViewActivated();
+ /**
+ * Handles the view url redirection event.
+ *
+ * It emits the activeViewUrlChanged signal with the url \a newUrl.
+ */
+ void slotViewUrlRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+
private:
/**
* Creates a new view container and does the default initialization.
if (index >= 0) {
tabBar()->setTabText(index, tabName(url));
tabBar()->setTabIcon(index, KIcon(KMimeType::iconNameForUrl(url)));
+
+ // Emit the currentUrlChanged signal if the url of the current tab has been changed.
+ if (index == currentIndex()) {
+ emit currentUrlChanged(url);
+ }
}
}
void DolphinTabWidget::currentTabChanged(int index)
{
- emit activeViewChanged(tabPageAt(index)->activeViewContainer());
+ DolphinViewContainer* viewContainer = tabPageAt(index)->activeViewContainer();
+ emit activeViewChanged(viewContainer);
+ emit currentUrlChanged(viewContainer->url());
}
void DolphinTabWidget::tabInserted(int index)
*/
void rememberClosedTab(const KUrl& url, const QByteArray& state);
+ /**
+ * Is emitted when the url of the current tab has been changed. This signal
+ * is also emitted when the active view has been changed.
+ */
+ void currentUrlChanged(const KUrl& url);
+
public slots:
/**
* Opens a new view with the current URL that is part of a tab and activates