Commit d8a2084b authored by Daniel Teske's avatar Daniel Teske
Browse files

Port to kio/bookmark changes.


svn path=/trunk/KDE/kdebase/apps/; revision=593982
parent d0db6613
......@@ -93,10 +93,6 @@ void KEBApp::createActions() {
(void) KStdAction::paste(actn, SLOT( slotPaste() ), actionCollection());
(void) KStdAction::print(actn, SLOT( slotPrint() ), actionCollection());
// settings menu
KToggleAction* actnShowNS = new KToggleAction(i18n("&Show Netscape Bookmarks in Konqueror"), actionCollection(), "settings_showNS");
connect(actnShowNS, SIGNAL( triggered() ), actn, SLOT( slotShowNS() ));
// actions
KAction* actnDelete = new KAction(KIcon("editdelete"), i18n("&Delete"), actionCollection(), "delete");
actnDelete->setShortcut(Qt::Key_Delete);
......@@ -470,14 +466,6 @@ void ActionsImpl::slotDelayedPrint() {
/* -------------------------------------- */
void ActionsImpl::slotShowNS() {
KEBApp::self()->bkInfo()->commitChanges();
bool shown = KEBApp::self()->nsShown();
CurrentMgr::self()->mgr()->setShowNSBookmarks(shown);
// TODO - need to force a save here
CurrentMgr::self()->reloadConfig();
}
void ActionsImpl::slotCancelFavIconUpdates() {
FavIconsItrHolder::self()->cancelAllItrs();
}
......
......@@ -47,7 +47,6 @@ public Q_SLOTS:
void slotSort();
void slotSetAsToolbar();
void slotOpenLink();
void slotShowNS();
void slotTestSelection();
void slotTestAll();
void slotCancelAllTests();
......
......@@ -76,7 +76,6 @@
<Menu name="settings"><text>&amp;Settings</text>
<Action name="settings_saveonclose" append="save_merge"/>
<!-- <Action name="settings_splitview" append="save_merge"/> -->
<Action name="settings_showNS" append="save_merge"/>
</Menu>
</MenuBar>
......
......@@ -128,7 +128,6 @@ bool CurrentMgr::managerSave() { return mgr()->save(); }
void CurrentMgr::saveAs(const QString &fileName) { mgr()->saveAs(fileName); }
void CurrentMgr::setUpdate(bool update) { mgr()->setUpdate(update); }
QString CurrentMgr::path() const { return mgr()->path(); }
bool CurrentMgr::showNSBookmarks() const { return mgr()->showNSBookmarks(); }
void CurrentMgr::createManager(const QString &filename) {
if (m_mgr) {
......@@ -445,13 +444,6 @@ void KEBApp::resetActions() {
if (!m_readOnly)
stateChanged("notreadonly");
getToggleAction("settings_showNS")
->setChecked(CurrentMgr::self()->showNSBookmarks());
}
bool KEBApp::nsShown() const {
return getToggleAction("settings_showNS")->isChecked();
}
void KEBApp::selectionChanged()
......@@ -460,6 +452,9 @@ void KEBApp::selectionChanged()
}
void KEBApp::updateActions() {
// FIXME if nothing is selected in the item view, the folder in the group view
// is selected.
// Change setActionsEnabled() and firstSelected() to match that
resetActions();
setActionsEnabled(mBookmarkListView->getSelectionAbilities());
}
......
......@@ -74,7 +74,6 @@ public:
static KBookmark bookmarkAt(const QString & a);
KBookmarkManager* mgr() const { return m_mgr; }
bool showNSBookmarks() const;
QString path() const;
void createManager(const QString &filename);
......
......@@ -82,7 +82,7 @@
#include <kaboutdata.h>
#include <kbookmarkbar.h>
#include <ktoolbar.h>
#include <kbookmarkmenu.h>
#include <konqbookmarkmenu.h>
#include <kcmultidialog.h>
#include <kdebug.h>
#include <kedittoolbar.h>
......@@ -210,7 +210,7 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, bool openInitialURL, con
m_paMoveFiles = 0;
m_paDelete = 0;
m_paNewDir = 0;
m_bookmarkBarActionCollection = 0;
m_bookmarkBarInitialized = false;
KonqExtendedBookmarkOwner *extOwner = new KonqExtendedBookmarkOwner( this );
m_pBookmarksOwner = extOwner;
......@@ -369,11 +369,11 @@ QWidget * KonqMainWindow::createContainer( QWidget *parent, int index, const QDo
return 0;
}
if ( !m_bookmarkBarActionCollection )
if ( !m_bookmarkBarInitialized )
{
// The actual menu needs a different action collection, so that the bookmarks
// don't appear in kedittoolbar
m_bookmarkBarActionCollection = new KActionCollection( static_cast<QWidget *>(this) );
m_bookmarkBarInitialized = true;
DelayedInitializer *initializer = new DelayedInitializer( QEvent::Show, res );
connect( initializer, SIGNAL( initialize() ), this, SLOT(initBookmarkBar()) );
}
......@@ -389,13 +389,7 @@ void KonqMainWindow::initBookmarkBar()
if (!bar) return;
delete m_paBookmarkBar;
m_paBookmarkBar = new KBookmarkBar( KonqBookmarkManager::self(), m_pBookmarksOwner, bar, m_bookmarkBarActionCollection, this );
connect( m_paBookmarkBar,
SIGNAL( aboutToShowContextMenu(const KBookmark &, QMenu*) ),
this, SLOT( slotFillContextMenu(const KBookmark &, QMenu*) ));
connect( m_paBookmarkBar,
SIGNAL( openBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ));
m_paBookmarkBar = new KBookmarkBar( KonqBookmarkManager::self(), m_pBookmarksOwner, bar, this );
// hide if empty
if (bar->actions().count() == 0 )
......@@ -2622,16 +2616,6 @@ void KonqMainWindow::slotPopupNewTab()
popupNewTab(newTabsInFront, openAfterCurrentPage);
}
void KonqMainWindow::slotPopupNewTabRight()
{
bool newTabsInFront = KonqSettings::newTabsInFront();
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
newTabsInFront = !newTabsInFront;
popupNewTab(newTabsInFront, false);
}
void KonqMainWindow::popupNewTab(bool infront, bool openAfterCurrentPage)
{
kDebug(1202) << "KonqMainWindow::popupNewTab()" << endl;
......@@ -3925,20 +3909,16 @@ void KonqMainWindow::initActions()
"Clears the content of the location bar." ) );
// Bookmarks menu
m_pamBookmarks = new KActionMenu( i18n( "&Bookmarks" ), actionCollection(), "bookmarks" );
//m_pamBookmarks->setDelayed( false );
m_pamBookmarks = new KonqBookmarkActionMenu(KonqBookmarkManager::self()->root(),
i18n( "&Bookmarks" ),
actionCollection(),
"bookmarks" );
// The actual menu needs a different action collection, so that the bookmarks
// 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 );
connect( m_pBookmarkMenu,
SIGNAL( aboutToShowContextMenu(const KBookmark &, QMenu*) ),
this, SLOT( slotFillContextMenu(const KBookmark &, QMenu*) ));
connect( m_pBookmarkMenu,
SIGNAL( openBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT( slotOpenBookmark(KBookmark, Qt::MouseButtons, Qt::KeyboardModifiers) ));
m_pBookmarkMenu = new KonqBookmarkMenu( KonqBookmarkManager::self(), m_pBookmarksOwner, m_pamBookmarks, m_bookmarksActionCollection );
KAction *addBookmark = actionCollection()->action("add_bookmark");
if (addBookmark)
......@@ -4022,31 +4002,9 @@ void KonqMainWindow::initActions()
m_paLinkView->setToolTip( i18n("Sets the view as 'linked'. A linked view follows folder changes made in other linked views.") );
}
void KonqMainWindow::slotFillContextMenu( const KBookmark &bk, QMenu * pm )
{
kDebug() << "KonqMainWindow::slotFillContextMenu(bk, pm == " << pm << ")" << endl;
popupItems.clear();
popupUrlArgs = KParts::URLArgs();
if ( bk.isGroup() )
{
KBookmarkGroup grp = bk.toGroup();
QList<KUrl> list = grp.groupUrlList();
QList<KUrl>::Iterator it = list.begin();
for (; it != list.end(); ++it )
popupItems.append( new KFileItem( (*it), QString(), KFileItem::Unknown) );
pm->insertItem( SmallIcon("tab_new"), i18n( "Open Folder in Tabs" ), this, SLOT( slotPopupNewTabRight() ) );
}
else
{
popupItems.append( new KFileItem( bk.url(), QString(), KFileItem::Unknown) );
pm->insertItem( SmallIcon("window_new"), i18n( "Open in New Window" ), this, SLOT( slotPopupNewWindow() ) );
pm->insertItem( SmallIcon("tab_new"), i18n( "Open in New Tab" ), this, SLOT( slotPopupNewTabRight() ) );
}
}
void KonqMainWindow::slotOpenBookmark( KBookmark bm, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
void KonqExtendedBookmarkOwner::openBookmark(KBookmark bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km)
{
kDebug(1202) << "KonqMainWindow::slotOpenBookmark(" << bm.url().prettyUrl() << ", " << buttons << ", " << modifiers << ")" << endl;
kDebug(1202) << "KonqExtendedBookmarkOwner::openBookmark(" << bm.url().prettyUrl() << ", " << km << ", " << mb << ")" << endl;
const QString url = bm.url().url();
......@@ -4054,23 +4012,23 @@ void KonqMainWindow::slotOpenBookmark( KBookmark bm, Qt::MouseButtons buttons, Q
req.newTab = true;
req.newTabInFront = KonqSettings::newTabsInFront();
if (modifiers & Qt::ShiftModifier)
if (km & Qt::ShiftModifier)
req.newTabInFront = !req.newTabInFront;
if( modifiers & Qt::ControlModifier ) // Ctrl Left/MMB
openFilteredUrl( url, req);
else if( buttons & Qt::MidButton )
if( km & Qt::ControlModifier ) // Ctrl Left/MMB
m_pKonqMainWindow->openFilteredUrl( url, req);
else if( mb & Qt::MidButton )
{
if(KonqSettings::mmbOpensTab())
openFilteredUrl( url, req);
m_pKonqMainWindow->openFilteredUrl( url, req);
else
{
KUrl finalURL = KonqMisc::konqFilteredURL( this, url );
KUrl finalURL = KonqMisc::konqFilteredURL( m_pKonqMainWindow, url );
KonqMisc::createNewWindow( finalURL.url() );
}
}
else
openFilteredUrl( url, false );
m_pKonqMainWindow->openFilteredUrl( url, false );
}
void KonqMainWindow::slotMoveTabLeft()
......@@ -4553,6 +4511,53 @@ QString KonqExtendedBookmarkOwner::currentTitle() const
return m_pKonqMainWindow->currentTitle();
}
void KonqExtendedBookmarkOwner::openInNewTab(KBookmark bm)
{
bool newTabsInFront = KonqSettings::newTabsInFront();
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
newTabsInFront = !newTabsInFront;
KonqOpenURLRequest req;
req.newTab = true;
req.newTabInFront = newTabsInFront;
req.openAfterCurrentPage = false;
req.args = KParts::URLArgs();
m_pKonqMainWindow->openUrl( 0, bm.url(), QString(), req );
}
void KonqExtendedBookmarkOwner::openFolderinTabs(KBookmark bm)
{
bool newTabsInFront = KonqSettings::newTabsInFront();
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
newTabsInFront = !newTabsInFront;
KonqOpenURLRequest req;
req.newTab = true;
req.newTabInFront = false;
req.openAfterCurrentPage = false;
req.args = KParts::URLArgs();
KBookmarkGroup grp = bm.toGroup();
QList<KUrl> list = grp.groupUrlList();
QList<KUrl>::Iterator it = list.begin();
QList<KUrl>::Iterator end = list.end();
--end;
for (; it != end; ++it )
{
m_pKonqMainWindow->openUrl( 0, *it, QString(), req );
}
if ( newTabsInFront )
{
req.newTabInFront = true;
}
m_pKonqMainWindow->openUrl( 0, *end, QString(), req );
}
void KonqExtendedBookmarkOwner::openInNewWindow(KBookmark bm)
{
KonqMisc::createNewWindow( bm.url(), KParts::URLArgs() );
}
QString KonqMainWindow::currentTitle() const
{
return m_currentView ? m_currentView->caption() : QString();
......
......@@ -57,6 +57,7 @@ class KAction;
class KActionCollection;
class KActionMenu;
class KBookmarkMenu;
class KonqBookmarkActionMenu;
class KCMultiDialog;
class KHistoryCombo;
class KNewMenu;
......@@ -335,10 +336,6 @@ Q_SIGNALS:
public Q_SLOTS:
void slotCtrlTabPressed();
// for KBookmarkMenu and KBookmarkBar
void slotFillContextMenu( const KBookmark &, QMenu * );
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 );
void slotPopupMenu( KXMLGUIClient *client, const QPoint &_global, const KUrl &_url, const KParts::URLArgs &_args, KParts::BrowserExtension::PopupFlags f, mode_t mode );
......@@ -445,7 +442,6 @@ protected Q_SLOTS:
void slotPopupNewWindow();
void slotPopupThisWindow();
void slotPopupNewTab();
void slotPopupNewTabRight();
void slotPopupPasteTo();
void slotRemoveView();
......@@ -615,7 +611,7 @@ private: // members
KAction *m_paPrint;
KActionMenu *m_pamBookmarks;
KonqBookmarkActionMenu *m_pamBookmarks;
KToolBarPopupAction *m_paUp;
KToolBarPopupAction *m_paBack;
......@@ -700,7 +696,7 @@ private: // members
KBookmarkMenu* m_pBookmarkMenu;
KonqExtendedBookmarkOwner *m_pBookmarksOwner;
KActionCollection* m_bookmarksActionCollection;
KActionCollection* m_bookmarkBarActionCollection;
bool m_bookmarkBarInitialized;
KonqViewManager *m_pViewManager;
KonqFrameBase* m_pChildFrame;
......
......@@ -21,14 +21,22 @@
#ifndef __konq_mainwindow_p_h__
#define __konq_mainwindow_p_h__
class KonqExtendedBookmarkOwner : public KBookmarkOwner
class KonqExtendedBookmarkOwner : public QObject, public KonqBookmarkOwner
{
Q_OBJECT
public:
KonqExtendedBookmarkOwner(KonqMainWindow *);
virtual QString currentTitle() const;
virtual QString currentUrl() const;
virtual bool supportsTabs() const;
virtual QList<QPair<QString, QString> > currentBookmarkList() const;
virtual void openBookmark(KBookmark bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km);
virtual void openInNewTab(KBookmark bm);
virtual void openInNewWindow(KBookmark bm);
virtual void openFolderinTabs(KBookmark bm);
Q_SIGNALS:
void openBookmarkSignal(KBookmark bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km);
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