mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
akregator: remove internal browser support
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
bcb18eae8f
commit
47455da734
14 changed files with 33 additions and 324 deletions
|
@ -3,67 +3,19 @@
|
|||
<author>Gary Cramblitt</author>
|
||||
<class>Akregator::SettingsBrowser</class>
|
||||
<widget class="QWidget" name="Akregator::SettingsBrowser">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,1">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="LMBlabel">
|
||||
<property name="text">
|
||||
<string>Left mouse click:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KComboBox" name="kcfg_LMBBehaviour">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in Background Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in External Browser</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="MMBlabel">
|
||||
<property name="text">
|
||||
<string>Middle mouse click:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="KComboBox" name="kcfg_MMBBehaviour">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in Background Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Open in External Browser</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>334</width>
|
||||
<height>169</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="externalBrowserGroupBox">
|
||||
<property name="title">
|
||||
<string>External Browsing</string>
|
||||
<string>Browser</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="1" column="1">
|
||||
|
@ -96,38 +48,11 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="tabsGroupBox">
|
||||
<property name="title">
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_AlwaysShowTabBar">
|
||||
<property name="text">
|
||||
<string>Always show the tab bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_CloseButtonOnTabs">
|
||||
<property name="text">
|
||||
<string>Show close button on each tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="kcfg_NewWindowInTab">
|
||||
<property name="text">
|
||||
<string>Open links in new tab instead of in new window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
|
@ -144,11 +69,6 @@
|
|||
<extends>QLineEdit</extends>
|
||||
<header>klineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>kcombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -183,9 +183,8 @@
|
|||
</entry>
|
||||
<entry key="LMB Behaviour" type="Enum" >
|
||||
<whatsthis>What the click with left mouse button should do.</whatsthis>
|
||||
<default>OpenInInternalBrowser</default>
|
||||
<default>OpenInExternalBrowser</default>
|
||||
<choices>
|
||||
<choice name="OpenInInternalBrowser" />
|
||||
<choice name="OpenInBackground" />
|
||||
<choice name="OpenInExternalBrowser" />
|
||||
</choices>
|
||||
|
@ -194,7 +193,6 @@
|
|||
<whatsthis>What the click with middle mouse button should do.</whatsthis>
|
||||
<default>OpenInExternalBrowser</default>
|
||||
<choices>
|
||||
<choice name="OpenInInternalBrowser" />
|
||||
<choice name="OpenInBackground" />
|
||||
<choice name="OpenInExternalBrowser" />
|
||||
</choices>
|
||||
|
|
|
@ -42,7 +42,6 @@ set(akregatorprivate_LIB_SRCS
|
|||
fetchqueue.cpp
|
||||
frame.cpp
|
||||
framemanager.cpp
|
||||
browserrun.cpp
|
||||
openurlrequest.cpp
|
||||
actionmanager.cpp
|
||||
actions.cpp
|
||||
|
|
|
@ -280,12 +280,6 @@ void ActionManagerImpl::initMainWidget(MainWidget* mainWidget)
|
|||
connect(sqf, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotToggleShowQuickFilter()));
|
||||
sqf->setChecked( Settings::showQuickFilter() );
|
||||
|
||||
action = coll->addAction("article_open" );
|
||||
action->setIcon(KIcon("tab-new"));
|
||||
action->setText(i18n("Open in Tab"));
|
||||
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticles()));
|
||||
action->setShortcuts(KShortcut( "Shift+Return" ));
|
||||
|
||||
action = coll->addAction("article_open_in_background" );
|
||||
action->setIcon(KIcon("tab-new"));
|
||||
action->setText(i18n("Open in Background Tab"));
|
||||
|
|
|
@ -152,9 +152,6 @@ void ArticleViewer::slotOpenUrlRequestDelayed(const KUrl& url, const KParts::Ope
|
|||
{
|
||||
switch (Settings::lMBBehaviour())
|
||||
{
|
||||
case Settings::EnumLMBBehaviour::OpenInExternalBrowser:
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
break;
|
||||
case Settings::EnumLMBBehaviour::OpenInBackground:
|
||||
req.setOpenInBackground(true);
|
||||
break;
|
||||
|
@ -166,9 +163,6 @@ void ArticleViewer::slotOpenUrlRequestDelayed(const KUrl& url, const KParts::Ope
|
|||
{
|
||||
switch (Settings::mMBBehaviour())
|
||||
{
|
||||
case Settings::EnumMMBBehaviour::OpenInExternalBrowser:
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
break;
|
||||
case Settings::EnumMMBBehaviour::OpenInBackground:
|
||||
req.setOpenInBackground(true);
|
||||
break;
|
||||
|
@ -267,7 +261,6 @@ void ArticleViewer::slotOpenLinkInBackgroundTab()
|
|||
void ArticleViewer::slotOpenLinkInBrowser()
|
||||
{
|
||||
OpenUrlRequest req(m_url);
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
emit signalOpenUrlRequest(req);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
This file is part of Akregator.
|
||||
|
||||
Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of Qt, and distribute the resulting executable,
|
||||
without including the source code for Qt in the source distribution.
|
||||
*/
|
||||
|
||||
#include "browserrun.h"
|
||||
#include "openurlrequest.h"
|
||||
#include "frame.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
namespace Akregator {
|
||||
|
||||
BrowserRun::BrowserRun(const OpenUrlRequest& request, QWidget* parent)
|
||||
: KParts::BrowserRun(request.url(), request.args(), request.browserArgs(), 0L, parent, /*removeReferrer=*/false, /*trustedSource=*/false, /*hideErrorDialog=*/true), m_request(request)
|
||||
{
|
||||
setEnableExternalBrowser(false);
|
||||
m_window = parent; // remove member and use KRun::window() instead once we can depend on kdelibs >= 4.10
|
||||
}
|
||||
|
||||
BrowserRun::~BrowserRun()
|
||||
{}
|
||||
|
||||
void BrowserRun::foundMimeType(const QString& type)
|
||||
{
|
||||
KParts::OpenUrlArguments args = m_request.args();
|
||||
args.setMimeType( type );
|
||||
m_request.setArgs( args );
|
||||
m_request.setWasHandled( false );
|
||||
|
||||
emit signalFoundMimeType( m_request );
|
||||
|
||||
if ( m_request.wasHandled() ) {
|
||||
setFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
KService::Ptr selectedService;
|
||||
if ( handleNonEmbeddable( type, &selectedService ) == KParts::BrowserRun::NotHandled ) {
|
||||
if ( selectedService ) {
|
||||
KRun::setPreferredService( selectedService->desktopEntryName() );
|
||||
KRun::foundMimeType( type );
|
||||
} else {
|
||||
KRun::displayOpenWithDialog( url(), m_window, false, suggestedFileName() );
|
||||
setFinished(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Akregator
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
This file is part of Akregator.
|
||||
|
||||
Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of Qt, and distribute the resulting executable,
|
||||
without including the source code for Qt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef AKREGATOR_BROWSERRUN_H
|
||||
#define AKREGATOR_BROWSERRUN_H
|
||||
|
||||
#include <kparts/browserrun.h>
|
||||
|
||||
#include "openurlrequest.h"
|
||||
|
||||
namespace Akregator
|
||||
{
|
||||
|
||||
class BrowserRun : public KParts::BrowserRun
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BrowserRun(const OpenUrlRequest& request, QWidget* parent);
|
||||
~BrowserRun();
|
||||
|
||||
signals:
|
||||
|
||||
void signalFoundMimeType(Akregator::OpenUrlRequest& request);
|
||||
|
||||
private:
|
||||
/* reimp */ void foundMimeType(const QString& type);
|
||||
|
||||
private:
|
||||
OpenUrlRequest m_request;
|
||||
QWidget* m_window;
|
||||
};
|
||||
|
||||
} // namespace Akregator
|
||||
|
||||
#endif // AKREGATOR_BROWSERRUN_H
|
||||
|
||||
// vim: set et ts=4 sts=4 sw=4:
|
|
@ -26,7 +26,6 @@
|
|||
#include "akregatorconfig.h"
|
||||
#include "frame.h"
|
||||
#include "actionmanager.h"
|
||||
#include "browserrun.h"
|
||||
#include "openurlrequest.h"
|
||||
|
||||
#include <kaction.h>
|
||||
|
@ -36,6 +35,7 @@
|
|||
#include <kconfiggroup.h>
|
||||
#include <ktoolinvocation.h>
|
||||
#include <kparts/event.h>
|
||||
#include <krun.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtGui/QApplication>
|
||||
|
@ -274,8 +274,10 @@ void FrameManager::openUrl(OpenUrlRequest& request)
|
|||
emit signalSelectFrame(request.frameId());
|
||||
}
|
||||
|
||||
void FrameManager::openInExternalBrowser(const OpenUrlRequest& request)
|
||||
void FrameManager::slotOpenUrlRequest(OpenUrlRequest& request )
|
||||
{
|
||||
kDebug() <<"FrameManager::slotOpenUrlRequest():" << request.debugInfo();
|
||||
|
||||
KUrl url = request.url();
|
||||
if (!url.isValid())
|
||||
return;
|
||||
|
@ -299,40 +301,6 @@ void FrameManager::openInExternalBrowser(const OpenUrlRequest& request)
|
|||
KRun::runUrl(url, request.args().mimeType(), 0 /*window*/, false, false);
|
||||
}
|
||||
|
||||
void FrameManager::slotOpenUrlRequest(OpenUrlRequest& request, bool useOpenInBackgroundSetting )
|
||||
{
|
||||
kDebug() <<"FrameManager::slotOpenUrlRequest():" << request.debugInfo();
|
||||
|
||||
if (request.options() == OpenUrlRequest::ExternalBrowser)
|
||||
{
|
||||
openInExternalBrowser(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if( useOpenInBackgroundSetting ) {
|
||||
// Honour user's preference for foreground/background tabs
|
||||
if (request.options() == OpenUrlRequest::NewTab ||
|
||||
request.browserArgs().newTab())
|
||||
{
|
||||
request.setOpenInBackground(Settings::lMBBehaviour() ==
|
||||
Settings::EnumLMBBehaviour::OpenInBackground);
|
||||
}
|
||||
}
|
||||
|
||||
// if no service type is set, determine it using BrowserRun.
|
||||
if (request.args().mimeType().isEmpty())
|
||||
{
|
||||
BrowserRun* run = new BrowserRun(request, m_mainWin);
|
||||
connect(run, SIGNAL(signalFoundMimeType(Akregator::OpenUrlRequest&)),
|
||||
this, SLOT(openUrl(Akregator::OpenUrlRequest&)) );
|
||||
}
|
||||
else // serviceType is already set, so we open the page synchronously.
|
||||
{
|
||||
openUrl(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FrameManager::slotBrowserBackAboutToShow()
|
||||
{
|
||||
if (m_currentFrame)
|
||||
|
|
|
@ -64,7 +64,7 @@ class AKREGATOR_EXPORT FrameManager : public QObject
|
|||
void slotRemoveFrame(int frameId);
|
||||
|
||||
void slotChangeFrame(int frameId);
|
||||
void slotOpenUrlRequest(Akregator::OpenUrlRequest& request,bool useOpenInBackgroundSetting = true );
|
||||
void slotOpenUrlRequest(Akregator::OpenUrlRequest& request);
|
||||
|
||||
void slotBrowserBack();
|
||||
void slotBrowserForward();
|
||||
|
@ -97,11 +97,6 @@ class AKREGATOR_EXPORT FrameManager : public QObject
|
|||
void signalLoadingProgress(int);
|
||||
void signalStatusText(const QString&);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void openInExternalBrowser(const OpenUrlRequest& request);
|
||||
|
||||
private slots:
|
||||
void openUrl(Akregator::OpenUrlRequest& request);
|
||||
void slotSetStarted(Akregator::Frame* frame);
|
||||
|
|
|
@ -727,9 +727,6 @@ void Akregator::MainWidget::slotMouseButtonPressed(int button, const KUrl& url)
|
|||
|
||||
switch (Settings::mMBBehaviour())
|
||||
{
|
||||
case Settings::EnumMMBBehaviour::OpenInExternalBrowser:
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
break;
|
||||
case Settings::EnumMMBBehaviour::OpenInBackground:
|
||||
req.setOptions(OpenUrlRequest::NewTab);
|
||||
req.setOpenInBackground(true);
|
||||
|
@ -754,7 +751,6 @@ void Akregator::MainWidget::slotOpenHomepage()
|
|||
if (url.isValid())
|
||||
{
|
||||
OpenUrlRequest req(feed->htmlUrl());
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
Kernel::self()->frameManager()->slotOpenUrlRequest(req);
|
||||
}
|
||||
}
|
||||
|
@ -772,34 +768,10 @@ void Akregator::MainWidget::slotOpenArticleInBrowser(const Akregator::Article& a
|
|||
if (!article.isNull() && article.link().isValid())
|
||||
{
|
||||
OpenUrlRequest req(article.link());
|
||||
req.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
Kernel::self()->frameManager()->slotOpenUrlRequest(req);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Akregator::MainWidget::openSelectedArticles( bool openInBackground )
|
||||
{
|
||||
const QList<Article> articles = m_selectionController->selectedArticles();
|
||||
|
||||
Q_FOREACH( const Akregator::Article& article, articles )
|
||||
{
|
||||
const KUrl url = article.link();
|
||||
if ( !url.isValid() )
|
||||
continue;
|
||||
|
||||
OpenUrlRequest req( url );
|
||||
req.setOptions( OpenUrlRequest::NewTab );
|
||||
if( openInBackground ) {
|
||||
req.setOpenInBackground( true );
|
||||
Kernel::self()->frameManager()->slotOpenUrlRequest( req, false /*don't use settings for open in background*/ );
|
||||
} else {
|
||||
Kernel::self()->frameManager()->slotOpenUrlRequest( req );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Akregator::MainWidget::slotCopyLinkAddress()
|
||||
{
|
||||
const Article article = m_selectionController->currentArticle();
|
||||
|
@ -1036,15 +1008,21 @@ void MainWidget::slotNetworkStatusChanged(Solid::Networking::Status status)
|
|||
}
|
||||
}
|
||||
|
||||
void Akregator::MainWidget::slotOpenSelectedArticles()
|
||||
{
|
||||
openSelectedArticles( false );
|
||||
}
|
||||
|
||||
|
||||
void Akregator::MainWidget::slotOpenSelectedArticlesInBackground()
|
||||
{
|
||||
openSelectedArticles( true );
|
||||
const QList<Article> articles = m_selectionController->selectedArticles();
|
||||
|
||||
Q_FOREACH( const Akregator::Article& article, articles )
|
||||
{
|
||||
const KUrl url = article.link();
|
||||
if ( !url.isValid() )
|
||||
continue;
|
||||
|
||||
OpenUrlRequest req( url );
|
||||
req.setOptions( OpenUrlRequest::NewTab );
|
||||
req.setOpenInBackground( true );
|
||||
Kernel::self()->frameManager()->slotOpenUrlRequest( req );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -129,7 +129,6 @@ class AKREGATORPART_EXPORT MainWidget : public QWidget
|
|||
void slotOpenSelectedArticlesInBrowser();
|
||||
|
||||
/** opens current article in new tab, background/foreground depends on settings TODO: use selected instead of current? */
|
||||
void slotOpenSelectedArticles();
|
||||
void slotOpenSelectedArticlesInBackground();
|
||||
|
||||
void slotOnShutdown();
|
||||
|
@ -237,9 +236,6 @@ class AKREGATORPART_EXPORT MainWidget : public QWidget
|
|||
private:
|
||||
void deleteExpiredArticles( const boost::shared_ptr<FeedList>& feedList );
|
||||
|
||||
/** opens current article in new tab, background/foreground depends on settings TODO: use selected instead of current? */
|
||||
void openSelectedArticles(bool openInBackground);
|
||||
|
||||
AbstractSelectionController* m_selectionController;
|
||||
boost::shared_ptr<FeedList> m_feedList;
|
||||
|
||||
|
|
|
@ -89,8 +89,6 @@ OpenUrlRequest::Options OpenUrlRequest::options() const
|
|||
{
|
||||
if (Settings::newWindowInTab())
|
||||
return (NewTab);
|
||||
else
|
||||
return (ExternalBrowser);
|
||||
}
|
||||
|
||||
return m_options;
|
||||
|
|
|
@ -50,8 +50,7 @@ class AKREGATOR_EXPORT OpenUrlRequest
|
|||
enum Options
|
||||
{
|
||||
None=0, /**< no explicit options, use default */
|
||||
NewTab, /**< open in new tab */
|
||||
ExternalBrowser /**< open in external browser */
|
||||
NewTab=1 /**< open in new tab */
|
||||
};
|
||||
|
||||
explicit OpenUrlRequest(const KUrl& url=KUrl());
|
||||
|
|
|
@ -368,7 +368,6 @@ void TabWidget::slotDetachTab()
|
|||
{
|
||||
OpenUrlRequest request;
|
||||
request.setUrl(frame->url());
|
||||
request.setOptions(OpenUrlRequest::ExternalBrowser);
|
||||
emit signalOpenUrlRequest(request);
|
||||
slotCloseTab();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue