Commit 8e98adaf authored by Daniel Teske's avatar Daniel Teske
Browse files

Ported konqueror to new KBookmarkMenu/Owner API


svn path=/trunk/KDE/kdebase/konqueror/; revision=580944
parent da281bd0
......@@ -211,10 +211,6 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, bool openInitialURL, con
m_bookmarkBarActionCollection = 0;
KonqExtendedBookmarkOwner *extOwner = new KonqExtendedBookmarkOwner( this );
m_pBookmarksOwner = extOwner;
connect( extOwner,
SIGNAL( signalFillBookmarksList(KExtendedBookmarkOwner::QStringPairList &) ),
extOwner,
SLOT( slotFillBookmarksList(KExtendedBookmarkOwner::QStringPairList &) ) );
// init history-manager, load history, get completion object
if ( !s_pCompletion ) {
......@@ -395,8 +391,8 @@ void KonqMainWindow::initBookmarkBar()
SIGNAL( aboutToShowContextMenu(const KBookmark &, QMenu*) ),
this, SLOT( slotFillContextMenu(const KBookmark &, QMenu*) ));
connect( m_paBookmarkBar,
SIGNAL( openBookmark(const QString &, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmarkUrl(const QString &, Qt::MouseButtons, Qt::KeyboardModifiers) ));
SIGNAL( openBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ));
// hide if empty
if (bar->actions().count() == 0 )
......@@ -3925,13 +3921,13 @@ void KonqMainWindow::initActions()
// don't appear in kedittoolbar
m_bookmarksActionCollection = new KActionCollection( static_cast<QWidget*>( this ) );
m_pBookmarkMenu = new KBookmarkMenu( KonqBookmarkManager::self(), m_pBookmarksOwner, m_pamBookmarks->menu(), m_bookmarksActionCollection, true );
m_pBookmarkMenu = new KBookmarkMenu( KonqBookmarkManager::self(), m_pBookmarksOwner, m_pamBookmarks->menu(), m_bookmarksActionCollection );
connect( m_pBookmarkMenu,
SIGNAL( aboutToShowContextMenu(const KBookmark &, QMenu*) ),
this, SLOT( slotFillContextMenu(const KBookmark &, QMenu*) ));
connect( m_pBookmarkMenu,
SIGNAL( openBookmark(const QString &, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmarkUrl(const QString &, Qt::MouseButtons, Qt::KeyboardModifiers) ));
SIGNAL( openBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ));
KAction *addBookmark = actionCollection()->action("add_bookmark");
if (addBookmark)
......@@ -4037,31 +4033,33 @@ void KonqMainWindow::slotFillContextMenu( const KBookmark &bk, QMenu * pm )
}
}
void KonqMainWindow::slotOpenBookmarkUrl( const QString & url, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
void KonqMainWindow::slotOpenBookmark( KBookmark bm, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
{
kDebug(1202) << "KonqMainWindow::slotOpenBookmarkUrl(" << url << ", " << buttons << ", " << modifiers << ")" << endl;
kDebug(1202) << "KonqMainWindow::slotOpenBookmark(" << bm.url().prettyUrl() << ", " << buttons << ", " << modifiers << ")" << endl;
KonqOpenURLRequest req;
req.newTab = true;
req.newTabInFront = KonqSettings::newTabsInFront();
QString url = bm.url();
if (modifiers & Qt::ShiftModifier)
req.newTabInFront = !req.newTabInFront;
KonqOpenURLRequest req;
req.newTab = true;
req.newTabInFront = KonqSettings::newTabsInFront();
if( modifiers & Qt::ControlModifier ) // Ctrl Left/MMB
openFilteredUrl( url, req);
else if( buttons & Qt::MidButton )
{
if(KonqSettings::mmbOpensTab())
openFilteredUrl( url, req);
else
if (modifiers & Qt::ShiftModifier)
req.newTabInFront = !req.newTabInFront;
if( modifiers & Qt::ControlModifier ) // Ctrl Left/MMB
openFilteredUrl( url, req);
else if( buttons & Qt::MidButton )
{
if(KonqSettings::mmbOpensTab())
openFilteredUrl( url, req);
else
{
KUrl finalURL = KonqMisc::konqFilteredURL( this, url );
KonqMisc::createNewWindow( finalURL.url() );
KUrl finalURL = KonqMisc::konqFilteredURL( this, url );
KonqMisc::createNewWindow( finalURL.url() );
}
}
else
openFilteredUrl( url, false );
}
else
openFilteredUrl( url, false );
}
void KonqMainWindow::slotMoveTabLeft()
......@@ -4457,11 +4455,6 @@ void KonqMainWindow::disableActionsNoView()
updateLocalPropsActions();
}
void KonqExtendedBookmarkOwner::openBookmarkURL( const QString & /*url*/ )
{
// Do nothing, we catch the signal
}
void KonqMainWindow::setCaption( const QString &caption )
{
// KParts sends us empty captions when activating a brand new part
......@@ -4490,7 +4483,7 @@ void KonqMainWindow::show()
KParts::MainWindow::show();
}
QString KonqExtendedBookmarkOwner::currentURL() const
QString KonqExtendedBookmarkOwner::currentUrl() const
{
return m_pKonqMainWindow->currentURL();
}
......@@ -4518,11 +4511,17 @@ QString KonqMainWindow::currentURL() const
return url;
}
void KonqExtendedBookmarkOwner::slotFillBookmarksList( KExtendedBookmarkOwner::QStringPairList & list )
bool KonqExtendedBookmarkOwner::supportsTabs() const
{
return true;
}
QList<QPair<QString, QString> > KonqExtendedBookmarkOwner::currentBookmarkList() const
{
QList<QPair<QString, QString> > list;
KonqFrameBase *docContainer = m_pKonqMainWindow->viewManager()->docContainer();
if (docContainer == 0) return;
if (docContainer->frameType() != "Tabs") return;
if (docContainer == 0) return QList<QPair<QString, QString> >();
if (docContainer->frameType() != "Tabs") return QList<QPair<QString, QString> >();
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(docContainer);
......@@ -4535,6 +4534,7 @@ void KonqExtendedBookmarkOwner::slotFillBookmarksList( KExtendedBookmarkOwner::Q
list << qMakePair( frame->activeChildView()->caption(),
frame->activeChildView()->url().url() );
}
return list;
}
QString KonqExtendedBookmarkOwner::currentTitle() const
......
......@@ -336,7 +336,7 @@ public Q_SLOTS:
// for KBookmarkMenu and KBookmarkBar
void slotFillContextMenu( const KBookmark &, QMenu * );
void slotOpenBookmarkUrl( const QString & url, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
void slotOpenBookmark( KBookmark, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
void slotPopupMenu( const QPoint &_global, const KUrl &_url, const QString &_mimeType, mode_t mode );
void slotPopupMenu( KXMLGUIClient *client, const QPoint &_global, const KUrl &_url, const QString &_mimeType, mode_t mode );
......
......@@ -21,18 +21,15 @@
#ifndef __konq_mainwindow_p_h__
#define __konq_mainwindow_p_h__
class KonqExtendedBookmarkOwner : public KExtendedBookmarkOwner
class KonqExtendedBookmarkOwner : public KBookmarkOwner
{
Q_OBJECT
public:
KonqExtendedBookmarkOwner(KonqMainWindow *);
// for KBookmarkOwner
virtual void openBookmarkURL( const QString & _url );
virtual QString currentTitle() const;
virtual QString currentURL() const;
public Q_SLOTS:
// for KExtendedBookmarkOwner
void slotFillBookmarksList( KExtendedBookmarkOwner::QStringPairList & list );
virtual QString currentUrl() const;
virtual bool supportsTabs() const;
virtual QList<QPair<QString, QString> > currentBookmarkList() const;
private:
KonqMainWindow *m_pKonqMainWindow;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment