mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 08:51:24 +00:00
Ported konqueror's DCOP interfaces to DBus
svn path=/trunk/KDE/kdebase/konqueror/; revision=554173
This commit is contained in:
parent
1ff895659e
commit
08ac318fd3
|
@ -4,7 +4,7 @@ project(konqueror)
|
|||
set(libkonqueror_intern_KCFG_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/konq_settingsxt.kcfgc)
|
||||
kde4_add_kcfg_files(libkonqueror_intern_SRCS ${libkonqueror_intern_KCFG_SRCS})
|
||||
|
||||
add_subdirectory( client )
|
||||
#add_subdirectory( client )
|
||||
add_subdirectory( iconview )
|
||||
add_subdirectory( listview )
|
||||
|
||||
|
@ -14,13 +14,13 @@ endif(UNIX)
|
|||
|
||||
add_subdirectory( about )
|
||||
add_subdirectory( pics )
|
||||
add_subdirectory( sidebar )
|
||||
add_subdirectory( preloader )
|
||||
add_subdirectory( quickprint )
|
||||
add_subdirectory( remoteencodingplugin )
|
||||
add_subdirectory( kttsplugin )
|
||||
#add_subdirectory( sidebar )
|
||||
#add_subdirectory( preloader )
|
||||
#add_subdirectory( quickprint )
|
||||
#add_subdirectory( remoteencodingplugin )
|
||||
#add_subdirectory( kttsplugin )
|
||||
add_subdirectory( dirpart )
|
||||
add_subdirectory( settings )
|
||||
#add_subdirectory( settings )
|
||||
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/libkonq ${CMAKE_SOURCE_DIR}/workspace/kcontrol/input )
|
||||
add_subdirectory( tests )
|
||||
|
@ -28,11 +28,6 @@ add_subdirectory( tests )
|
|||
|
||||
########### next target ###############
|
||||
|
||||
#TODO: port those to DBUS
|
||||
# KonquerorIface.cc
|
||||
# KonqMainWindowIface.cc
|
||||
# KonqViewIface.cc
|
||||
|
||||
set(konqueror_KDEINIT_SRCS ${libkonqueror_intern_SRCS}
|
||||
konq_main.cc
|
||||
konq_guiclients.cc
|
||||
|
@ -50,7 +45,11 @@ set(konqueror_KDEINIT_SRCS ${libkonqueror_intern_SRCS}
|
|||
konq_browseriface.cc
|
||||
delayedinitializer.cc
|
||||
konq_mainwindow.cc
|
||||
konq_extensionmanager.cc )
|
||||
konq_extensionmanager.cc
|
||||
KonquerorAdaptor.cpp
|
||||
KonqMainWindowAdaptor.cpp
|
||||
KonqViewAdaptor.cpp
|
||||
)
|
||||
|
||||
kde4_automoc(${konqueror_KDEINIT_SRCS})
|
||||
|
||||
|
@ -70,7 +69,6 @@ install(TARGETS konqueror DESTINATION bin)
|
|||
install_files( ${APPLNK_INSTALL_DIR}/.hidden FILES konqfilemgr.desktop )
|
||||
install_files( ${XDG_APPS_DIR} FILES kfmclient.desktop kfmclient_dir.desktop kfmclient_html.desktop kfmclient_war.desktop konqbrowser.desktop konquerorsu.desktop Home.desktop )
|
||||
install_files( ${KCFG_INSTALL_DIR} FILES konqueror.kcfg )
|
||||
install_files( /include FILES KonquerorIface.h )
|
||||
install_files( ${APPLNK_INSTALL_DIR} FILES konqueror.desktop )
|
||||
install_files( ${DATA_INSTALL_DIR}/konqueror FILES konqueror.rc konq-simplebrowser.rc )
|
||||
|
||||
|
@ -130,13 +128,6 @@ install(FILES profile_simplebrowser.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}$
|
|||
# konq_extensionmanager.cc
|
||||
#
|
||||
#konqueror_la_PCH = AUTO
|
||||
#
|
||||
#noinst_HEADERS = KonqMainWindowIface.h KonqViewIface.h delayedinitializer.h \
|
||||
# konq_actions.h konq_browseriface.h konq_combo.h konq_factory.h \
|
||||
# konq_frame.h konq_tabs.h konq_guiclients.h konq_main.h konq_mainwindow.h \
|
||||
# konq_misc.h konq_openurlrequest.h konq_profiledlg.h konq_run.h \
|
||||
# konq_view.h konq_viewmgr.h konq_extensionmanager.h version.h
|
||||
#
|
||||
#konqueror_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
|
||||
#konqueror_la_LIBADD = ../libkonq/libkonq.la libkonqueror_intern.la $(LIBMALLOC) $(LIB_KUTILS)
|
||||
#
|
||||
|
|
93
konqueror/KonqMainWindowAdaptor.cpp
Normal file
93
konqueror/KonqMainWindowAdaptor.cpp
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000, 2006 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "KonqMainWindowAdaptor.h"
|
||||
#include "KonqViewAdaptor.h"
|
||||
#include "konq_view.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kstartupinfo.h>
|
||||
#include <kwin.h>
|
||||
|
||||
KonqMainWindowAdaptor::KonqMainWindowAdaptor( KonqMainWindow * mainWindow )
|
||||
: QDBusAbstractAdaptor( mainWindow ), m_pMainWindow( mainWindow )
|
||||
{
|
||||
// m_dcopActionProxy = new KDCOPActionProxy( mainWindow->actionCollection(), this );
|
||||
}
|
||||
|
||||
KonqMainWindowAdaptor::~KonqMainWindowAdaptor()
|
||||
{
|
||||
// delete m_dcopActionProxy;
|
||||
}
|
||||
|
||||
void KonqMainWindowAdaptor::openUrl( const QString& url, bool tempFile )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url, false, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowAdaptor::newTab( const QString& url, bool tempFile )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url, true, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowAdaptor::newTabASN( const QString& url, const QByteArray& startup_id, bool tempFile )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
KStartupInfo::setNewStartupId( m_pMainWindow, startup_id );
|
||||
#endif
|
||||
m_pMainWindow->openFilteredUrl( url, true, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowAdaptor::reload()
|
||||
{
|
||||
m_pMainWindow->slotReload();
|
||||
}
|
||||
|
||||
QDBusObjectPath KonqMainWindowAdaptor::currentView()
|
||||
{
|
||||
kDebug() << k_funcinfo << endl;
|
||||
KonqView *view = m_pMainWindow->currentView();
|
||||
if ( !view )
|
||||
return QDBusObjectPath();
|
||||
|
||||
return QDBusObjectPath( view->dbusObjectPath() );
|
||||
}
|
||||
|
||||
QDBusObjectPath KonqMainWindowAdaptor::currentPart()
|
||||
{
|
||||
KonqView *view = m_pMainWindow->currentView();
|
||||
if ( !view )
|
||||
return QDBusObjectPath();
|
||||
|
||||
return QDBusObjectPath( view->partObjectPath() );
|
||||
}
|
||||
|
||||
bool KonqMainWindowAdaptor::windowCanBeUsedForTab()
|
||||
{
|
||||
KWin::WindowInfo winfo = KWin::windowInfo( m_pMainWindow->winId(), NET::WMDesktop );
|
||||
if( !winfo.isOnCurrentDesktop() )
|
||||
return false; // this window shows on different desktop
|
||||
if( KonqMainWindow::isPreloaded() )
|
||||
return false; // we want a tab in an already shown window
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#include "KonqMainWindowAdaptor.moc"
|
83
konqueror/KonqMainWindowAdaptor.h
Normal file
83
konqueror/KonqMainWindowAdaptor.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000, 2006 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonqMainWindowAdaptor_h__
|
||||
#define __KonqMainWindowAdaptor_h__
|
||||
|
||||
#include <dbus/qdbus.h>
|
||||
|
||||
class KonqMainWindow;
|
||||
|
||||
/**
|
||||
* DBUS interface for a konqueror main window
|
||||
*/
|
||||
class KonqMainWindowAdaptor : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror.MainWindow")
|
||||
|
||||
public:
|
||||
|
||||
KonqMainWindowAdaptor( KonqMainWindow * mainWindow );
|
||||
~KonqMainWindowAdaptor();
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
* Open a url in this window
|
||||
* @param url the url to open
|
||||
* @param tempFile whether to delete the file after use, usually this is false
|
||||
*/
|
||||
void openUrl( const QString& url, bool tempFile );
|
||||
/**
|
||||
* Open a url in a new tab in this window
|
||||
* @param url the url to open
|
||||
* @param tempFile whether to delete the file after use, usually this is false
|
||||
*/
|
||||
void newTab( const QString& url, bool tempFile );
|
||||
|
||||
void newTabASN( const QString& url, const QByteArray& startup_id, bool tempFile );
|
||||
|
||||
/**
|
||||
* Reloads the current view.
|
||||
*/
|
||||
void reload();
|
||||
|
||||
/**
|
||||
* @return reference to the current KonqView
|
||||
*/
|
||||
QDBusObjectPath currentView();
|
||||
/**
|
||||
* @return reference to the current part
|
||||
*/
|
||||
QDBusObjectPath currentPart();
|
||||
|
||||
/**
|
||||
* Used by kfmclient when searching a window to open a tab within
|
||||
*/
|
||||
bool windowCanBeUsedForTab();
|
||||
|
||||
private:
|
||||
|
||||
KonqMainWindow * m_pMainWindow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "KonqMainWindowIface.h"
|
||||
#include "KonqViewIface.h"
|
||||
#include "konq_view.h"
|
||||
|
||||
|
||||
#include <dcopclient.h>
|
||||
#include <kapplication.h>
|
||||
#include <kdcopactionproxy.h>
|
||||
#include <kdcoppropertyproxy.h>
|
||||
#include <kdebug.h>
|
||||
#include <kstartupinfo.h>
|
||||
#include <kwin.h>
|
||||
|
||||
KonqMainWindowIface::KonqMainWindowIface( KonqMainWindow * mainWindow )
|
||||
:
|
||||
// ARGL I hate this "virtual public DCOPObject" stuff!
|
||||
DCOPObject( mainWindow->objectName().toUtf8() ),
|
||||
KMainWindowInterface( mainWindow ), m_pMainWindow( mainWindow )
|
||||
{
|
||||
m_dcopActionProxy = new KDCOPActionProxy( mainWindow->actionCollection(), this );
|
||||
}
|
||||
|
||||
KonqMainWindowIface::~KonqMainWindowIface()
|
||||
{
|
||||
delete m_dcopActionProxy;
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::openURL( QString url )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url );
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::newTab( QString url )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url, true );
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::openURL( QString url, bool tempFile )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url, false, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::newTab( QString url, bool tempFile )
|
||||
{
|
||||
m_pMainWindow->openFilteredUrl( url, true, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::newTabASN( QString url, const DCOPCString& startup_id, bool tempFile )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
KStartupInfo::setNewStartupId( m_pMainWindow, startup_id );
|
||||
#endif
|
||||
m_pMainWindow->openFilteredUrl( url, true, tempFile );
|
||||
}
|
||||
|
||||
void KonqMainWindowIface::reload()
|
||||
{
|
||||
m_pMainWindow->slotReload();
|
||||
}
|
||||
|
||||
DCOPRef KonqMainWindowIface::currentView()
|
||||
{
|
||||
DCOPRef res;
|
||||
|
||||
KonqView *view = m_pMainWindow->currentView();
|
||||
if ( !view )
|
||||
return res;
|
||||
|
||||
return DCOPRef( kapp->dcopClient()->appId(), view->dcopObject()->objId() );
|
||||
}
|
||||
|
||||
DCOPRef KonqMainWindowIface::currentPart()
|
||||
{
|
||||
DCOPRef res;
|
||||
|
||||
KonqView *view = m_pMainWindow->currentView();
|
||||
if ( !view )
|
||||
return res;
|
||||
|
||||
return view->dcopObject()->part();
|
||||
}
|
||||
|
||||
DCOPRef KonqMainWindowIface::action( const DCOPCString &name )
|
||||
{
|
||||
return DCOPRef( kapp->dcopClient()->appId(), m_dcopActionProxy->actionObjectId( name ) );
|
||||
}
|
||||
|
||||
DCOPCStringList KonqMainWindowIface::actions()
|
||||
{
|
||||
DCOPCStringList res;
|
||||
QList<KAction *> lst = m_dcopActionProxy->actions();
|
||||
QList<KAction *>::ConstIterator it = lst.begin();
|
||||
QList<KAction *>::ConstIterator end = lst.end();
|
||||
for (; it != end; ++it )
|
||||
res.append( (*it)->name() );
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QMap<DCOPCString,DCOPRef> KonqMainWindowIface::actionMap()
|
||||
{
|
||||
return m_dcopActionProxy->actionMap();
|
||||
}
|
||||
|
||||
DCOPCStringList KonqMainWindowIface::functionsDynamic()
|
||||
{
|
||||
return DCOPObject::functionsDynamic() + KDCOPPropertyProxy::functions( m_pMainWindow );
|
||||
}
|
||||
|
||||
bool KonqMainWindowIface::processDynamic( const DCOPCString &fun, const QByteArray &data, DCOPCString &replyType, QByteArray &replyData )
|
||||
{
|
||||
if ( KDCOPPropertyProxy::isPropertyRequest( fun, m_pMainWindow ) )
|
||||
return KDCOPPropertyProxy::processPropertyRequest( fun, data, replyType, replyData, m_pMainWindow );
|
||||
|
||||
return DCOPObject::processDynamic( fun, data, replyType, replyData );
|
||||
}
|
||||
|
||||
bool KonqMainWindowIface::windowCanBeUsedForTab()
|
||||
{
|
||||
KWin::WindowInfo winfo = KWin::windowInfo( m_pMainWindow->winId(), NET::WMDesktop );
|
||||
if( !winfo.isOnCurrentDesktop() )
|
||||
return false; // this window shows on different desktop
|
||||
if( KonqMainWindow::isPreloaded() )
|
||||
return false; // we want a tab in an already shown window
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonqMainWindowIface_h__
|
||||
#define __KonqMainWindowIface_h__
|
||||
|
||||
#include <dcopobject.h>
|
||||
#include <dcopref.h>
|
||||
#include <kmainwindowiface.h>
|
||||
|
||||
class KonqMainWindow;
|
||||
class KDCOPActionProxy;
|
||||
|
||||
/**
|
||||
* DCOP interface for a konqueror main window
|
||||
*/
|
||||
class KonqMainWindowIface : public KMainWindowInterface
|
||||
{
|
||||
K_DCOP
|
||||
public:
|
||||
|
||||
KonqMainWindowIface( KonqMainWindow * mainWindow );
|
||||
~KonqMainWindowIface();
|
||||
|
||||
k_dcop:
|
||||
|
||||
void openURL( QString url );
|
||||
void newTab( QString url );
|
||||
|
||||
void openURL( QString url, bool tempFile );
|
||||
void newTab( QString url, bool tempFile );
|
||||
|
||||
void newTabASN( QString url, const DCOPCString& startup_id, bool tempFile );
|
||||
|
||||
/**
|
||||
* Reloads the current view.
|
||||
*/
|
||||
void reload();
|
||||
|
||||
/**
|
||||
* @return reference to the current KonqView
|
||||
*/
|
||||
DCOPRef currentView();
|
||||
/**
|
||||
* @return reference to the current part
|
||||
*/
|
||||
DCOPRef currentPart();
|
||||
|
||||
DCOPRef action( const DCOPCString &name );
|
||||
DCOPCStringList actions();
|
||||
QMap<DCOPCString,DCOPRef> actionMap();
|
||||
|
||||
/**
|
||||
* Used by kfmclient when searching a window to open a tab within
|
||||
*/
|
||||
bool windowCanBeUsedForTab();
|
||||
|
||||
public:
|
||||
virtual DCOPCStringList functionsDynamic();
|
||||
virtual bool processDynamic( const DCOPCString &fun, const QByteArray &data, DCOPCString &replyType, QByteArray &replyData );
|
||||
|
||||
private:
|
||||
|
||||
KonqMainWindow * m_pMainWindow;
|
||||
KDCOPActionProxy *m_dcopActionProxy;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
120
konqueror/KonqViewAdaptor.cpp
Normal file
120
konqueror/KonqViewAdaptor.cpp
Normal file
|
@ -0,0 +1,120 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000, 2006 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "KonqViewAdaptor.h"
|
||||
#include "konq_view.h"
|
||||
|
||||
KonqViewAdaptor::KonqViewAdaptor( KonqView * view )
|
||||
: m_pView ( view )
|
||||
{
|
||||
}
|
||||
|
||||
KonqViewAdaptor::~KonqViewAdaptor()
|
||||
{
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::openUrl( const QString& url, const QString & locationBarURL, const QString & nameFilter )
|
||||
{
|
||||
m_pView->openURL( KUrl(url), locationBarURL, nameFilter );
|
||||
}
|
||||
|
||||
bool KonqViewAdaptor::changeViewMode( const QString &serviceType,
|
||||
const QString &serviceName )
|
||||
{
|
||||
return m_pView->changeViewMode( serviceType, serviceName );
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::lockHistory()
|
||||
|
||||
{
|
||||
m_pView->lockHistory();
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::stop()
|
||||
{
|
||||
m_pView->stop();
|
||||
}
|
||||
|
||||
QString KonqViewAdaptor::url()
|
||||
{
|
||||
return m_pView->url().url();
|
||||
}
|
||||
|
||||
QString KonqViewAdaptor::locationBarURL()
|
||||
{
|
||||
return m_pView->locationBarURL();
|
||||
}
|
||||
|
||||
QString KonqViewAdaptor::serviceType()
|
||||
{
|
||||
return m_pView->serviceType();
|
||||
}
|
||||
|
||||
QStringList KonqViewAdaptor::serviceTypes()
|
||||
{
|
||||
return m_pView->serviceTypes();
|
||||
}
|
||||
|
||||
QDBusObjectPath KonqViewAdaptor::part()
|
||||
{
|
||||
return QDBusObjectPath( m_pView->partObjectPath() );
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::enablePopupMenu( bool b )
|
||||
{
|
||||
m_pView->enablePopupMenu( b );
|
||||
}
|
||||
|
||||
uint KonqViewAdaptor::historyLength()const
|
||||
{
|
||||
return m_pView->historyLength();
|
||||
}
|
||||
|
||||
bool KonqViewAdaptor::allowHTML() const
|
||||
{
|
||||
return m_pView->allowHTML();
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::goForward()
|
||||
{
|
||||
m_pView->go(-1);
|
||||
}
|
||||
|
||||
void KonqViewAdaptor::goBack()
|
||||
{
|
||||
m_pView->go(+1);
|
||||
}
|
||||
|
||||
bool KonqViewAdaptor::isPopupMenuEnabled() const
|
||||
{
|
||||
return m_pView->isPopupMenuEnabled();
|
||||
}
|
||||
|
||||
bool KonqViewAdaptor::canGoBack()const
|
||||
{
|
||||
return m_pView->canGoBack();
|
||||
}
|
||||
|
||||
bool KonqViewAdaptor::canGoForward()const
|
||||
{
|
||||
return m_pView->canGoForward();
|
||||
}
|
||||
|
||||
#include "KonqViewAdaptor.moc"
|
134
konqueror/KonqViewAdaptor.h
Normal file
134
konqueror/KonqViewAdaptor.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000, 2006 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonqViewAdaptor_h__
|
||||
#define __KonqViewAdaptor_h__
|
||||
|
||||
#include <QStringList>
|
||||
#include <dbus/qdbus.h>
|
||||
|
||||
class KonqView;
|
||||
|
||||
/**
|
||||
* DBus interface for a konqueror view
|
||||
*/
|
||||
class KonqViewAdaptor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror.View")
|
||||
|
||||
public:
|
||||
|
||||
KonqViewAdaptor( KonqView * view );
|
||||
~KonqViewAdaptor();
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
* Displays another URL, but without changing the view mode
|
||||
* (Make sure the part can display this URL)
|
||||
*/
|
||||
void openUrl( const QString& url,
|
||||
const QString& locationBarURL,
|
||||
const QString& nameFilter );
|
||||
|
||||
/**
|
||||
* Change the type of view (i.e. loads a new konqueror view)
|
||||
* @param serviceType the service type we want to show
|
||||
* @param serviceName allows to enforce a particular service to be chosen,
|
||||
* @see KonqFactory.
|
||||
*/
|
||||
bool changeViewMode( const QString &serviceType,
|
||||
const QString &serviceName );
|
||||
|
||||
/**
|
||||
* Call this to prevent next openUrl() call from changing history lists
|
||||
* Used when the same URL is reloaded (for instance with another view mode)
|
||||
*/
|
||||
void lockHistory();
|
||||
|
||||
/**
|
||||
* Stop loading
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Retrieve view's URL
|
||||
*/
|
||||
QString url();
|
||||
|
||||
/**
|
||||
* Get view's location bar URL, i.e. the one that the view signals
|
||||
* It can be different from url(), for instance if we display a index.html
|
||||
*/
|
||||
QString locationBarURL();
|
||||
|
||||
/**
|
||||
* @return the servicetype this view is currently displaying
|
||||
*/
|
||||
QString serviceType();
|
||||
|
||||
/**
|
||||
* @return the servicetypes this view is capable to display
|
||||
*/
|
||||
QStringList serviceTypes();
|
||||
|
||||
/**
|
||||
* @return the part embedded into this view
|
||||
*/
|
||||
QDBusObjectPath part();
|
||||
|
||||
/**
|
||||
* Enable/Disable the context popup menu for this view.
|
||||
*/
|
||||
void enablePopupMenu( bool b );
|
||||
|
||||
|
||||
bool isPopupMenuEnabled() const;
|
||||
|
||||
/*
|
||||
* Return length of history
|
||||
*/
|
||||
uint historyLength()const;
|
||||
/*
|
||||
* Return true if "Use index HTML" is checked
|
||||
*/
|
||||
bool allowHTML() const;
|
||||
|
||||
/*
|
||||
* Move forward in history "-1"
|
||||
*/
|
||||
void goForward();
|
||||
/*
|
||||
* Move back in history "+1"
|
||||
*/
|
||||
void goBack();
|
||||
|
||||
bool canGoBack()const;
|
||||
bool canGoForward()const;
|
||||
|
||||
private:
|
||||
|
||||
KonqView * m_pView;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "KonqViewIface.h"
|
||||
#include "konq_view.h"
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <dcopclient.h>
|
||||
|
||||
KonqViewIface::KonqViewIface( KonqView * view )
|
||||
: DCOPObject( DCOPCString( view->objectName().toUtf8() ) ), m_pView ( view )
|
||||
{
|
||||
}
|
||||
|
||||
KonqViewIface::~KonqViewIface()
|
||||
{
|
||||
}
|
||||
|
||||
void KonqViewIface::openURL( QString url, const QString & locationBarURL, const QString & nameFilter )
|
||||
{
|
||||
KUrl u(url);
|
||||
m_pView->openURL( u, locationBarURL, nameFilter );
|
||||
}
|
||||
|
||||
bool KonqViewIface::changeViewMode( const QString &serviceType,
|
||||
const QString &serviceName )
|
||||
{
|
||||
return m_pView->changeViewMode( serviceType, serviceName );
|
||||
}
|
||||
|
||||
void KonqViewIface::lockHistory()
|
||||
|
||||
{
|
||||
m_pView->lockHistory();
|
||||
}
|
||||
|
||||
void KonqViewIface::stop()
|
||||
{
|
||||
m_pView->stop();
|
||||
}
|
||||
|
||||
QString KonqViewIface::url()
|
||||
{
|
||||
return m_pView->url().url();
|
||||
}
|
||||
|
||||
QString KonqViewIface::locationBarURL()
|
||||
{
|
||||
return m_pView->locationBarURL();
|
||||
}
|
||||
|
||||
QString KonqViewIface::serviceType()
|
||||
{
|
||||
return m_pView->serviceType();
|
||||
}
|
||||
|
||||
QStringList KonqViewIface::serviceTypes()
|
||||
{
|
||||
return m_pView->serviceTypes();
|
||||
}
|
||||
|
||||
DCOPRef KonqViewIface::part()
|
||||
{
|
||||
DCOPRef res;
|
||||
|
||||
KParts::ReadOnlyPart *part = m_pView->part();
|
||||
|
||||
if ( !part )
|
||||
return res;
|
||||
|
||||
QVariant dcopProperty = part->property( "dcopObjectId" );
|
||||
|
||||
if ( dcopProperty.type() != QVariant::CString )
|
||||
return res;
|
||||
|
||||
res.setRef( kapp->dcopClient()->appId(), dcopProperty.toCString() );
|
||||
return res;
|
||||
}
|
||||
|
||||
void KonqViewIface::enablePopupMenu( bool b )
|
||||
{
|
||||
m_pView->enablePopupMenu( b );
|
||||
}
|
||||
|
||||
uint KonqViewIface::historyLength()const
|
||||
{
|
||||
return m_pView->historyLength();
|
||||
}
|
||||
|
||||
bool KonqViewIface::allowHTML() const
|
||||
{
|
||||
return m_pView->allowHTML();
|
||||
}
|
||||
|
||||
void KonqViewIface::goForward()
|
||||
{
|
||||
m_pView->go(-1);
|
||||
}
|
||||
|
||||
void KonqViewIface::goBack()
|
||||
{
|
||||
m_pView->go(+1);
|
||||
}
|
||||
|
||||
bool KonqViewIface::isPopupMenuEnabled() const
|
||||
{
|
||||
return m_pView->isPopupMenuEnabled();
|
||||
}
|
||||
|
||||
bool KonqViewIface::canGoBack()const
|
||||
{
|
||||
return m_pView->canGoBack();
|
||||
}
|
||||
|
||||
bool KonqViewIface::canGoForward()const
|
||||
{
|
||||
return m_pView->canGoForward();
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonqViewIface_h__
|
||||
#define __KonqViewIface_h__
|
||||
|
||||
#include <dcopobject.h>
|
||||
#include <QStringList>
|
||||
#include <dcopref.h>
|
||||
|
||||
class KonqView;
|
||||
|
||||
/**
|
||||
* DCOP interface for a konqueror main window
|
||||
*/
|
||||
class KonqViewIface : virtual public DCOPObject
|
||||
{
|
||||
K_DCOP
|
||||
public:
|
||||
|
||||
KonqViewIface( KonqView * view );
|
||||
~KonqViewIface();
|
||||
|
||||
k_dcop:
|
||||
|
||||
/**
|
||||
* Displays another URL, but without changing the view mode
|
||||
* (Make sure the part can display this URL)
|
||||
*/
|
||||
void openURL( QString url,
|
||||
const QString & locationBarURL,
|
||||
const QString & nameFilter );
|
||||
|
||||
/**
|
||||
* Change the type of view (i.e. loads a new konqueror view)
|
||||
* @param serviceType the service type we want to show
|
||||
* @param serviceName allows to enforce a particular service to be chosen,
|
||||
* @see KonqFactory.
|
||||
*/
|
||||
bool changeViewMode( const QString &serviceType,
|
||||
const QString &serviceName );
|
||||
|
||||
/**
|
||||
* Call this to prevent next openURL() call from changing history lists
|
||||
* Used when the same URL is reloaded (for instance with another view mode)
|
||||
*/
|
||||
void lockHistory();
|
||||
|
||||
/**
|
||||
* Stop loading
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Retrieve view's URL
|
||||
*/
|
||||
QString url();
|
||||
|
||||
/**
|
||||
* Get view's location bar URL, i.e. the one that the view signals
|
||||
* It can be different from url(), for instance if we display a index.html
|
||||
*/
|
||||
QString locationBarURL();
|
||||
|
||||
/**
|
||||
* @return the servicetype this view is currently displaying
|
||||
*/
|
||||
QString serviceType();
|
||||
|
||||
/**
|
||||
* @return the servicetypes this view is capable to display
|
||||
*/
|
||||
QStringList serviceTypes();
|
||||
|
||||
/**
|
||||
* @return the part embedded into this view
|
||||
*/
|
||||
DCOPRef part();
|
||||
|
||||
/**
|
||||
* Enable/Disable the context popup menu for this view.
|
||||
*/
|
||||
void enablePopupMenu( bool b );
|
||||
|
||||
|
||||
bool isPopupMenuEnabled() const;
|
||||
|
||||
/*
|
||||
* Return length of history
|
||||
*/
|
||||
uint historyLength()const;
|
||||
/*
|
||||
* Return true if "Use index HTML" is checked
|
||||
*/
|
||||
bool allowHTML() const;
|
||||
|
||||
/*
|
||||
* Move forward in history "-1"
|
||||
*/
|
||||
void goForward();
|
||||
/*
|
||||
* Move back in history "+1"
|
||||
*/
|
||||
void goBack();
|
||||
|
||||
bool canGoBack()const;
|
||||
bool canGoForward()const;
|
||||
|
||||
private:
|
||||
|
||||
KonqView * m_pView;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 1998, 1999 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
Copyright 1998, 1999 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000, 2006 David Faure <faure@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
|
@ -18,88 +18,56 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "KonquerorIface.h"
|
||||
#include "KonquerorAdaptor.h"
|
||||
#include "konq_misc.h"
|
||||
#include "KonqMainWindowIface.h"
|
||||
#include "KonqMainWindowAdaptor.h"
|
||||
#include "konq_mainwindow.h"
|
||||
#include "konq_viewmgr.h"
|
||||
#include "konq_view.h"
|
||||
#include "konq_settingsxt.h"
|
||||
#include <konq_settings.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <dcopclient.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QFile>
|
||||
//Added by qt3to4:
|
||||
#ifdef Q_WS_X11
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
#include "konq_settingsxt.h"
|
||||
|
||||
// these DCOP calls come from outside, so any windows created by these
|
||||
// these DBus calls come from outside, so any windows created by these
|
||||
// calls would have old user timestamps (for KWin's no-focus-stealing),
|
||||
// it's better to reset the timestamp and rely on other means
|
||||
// of detecting the time when the user action that triggered all this
|
||||
// happened
|
||||
// TODO a valid timestamp should be passed in the DCOP calls that
|
||||
// TODO a valid timestamp should be passed in the DBus calls that
|
||||
// are not for user scripting
|
||||
|
||||
KonquerorIface::KonquerorIface()
|
||||
: DCOPObject( "KonquerorIface" )
|
||||
KonquerorAdaptor::KonquerorAdaptor()
|
||||
: QDBusAbstractAdaptor( kapp )
|
||||
{
|
||||
}
|
||||
|
||||
KonquerorIface::~KonquerorIface()
|
||||
KonquerorAdaptor::~KonquerorAdaptor()
|
||||
{
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::openBrowserWindow( const QString &url )
|
||||
QDBusObjectPath KonquerorAdaptor::openBrowserWindow( const QString& url, const QByteArray& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
KonqMainWindow *res = KonqMisc::createSimpleWindow( KUrl(url) );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::openBrowserWindowASN( const QString &url, const DCOPCString& startup_id )
|
||||
QDBusObjectPath KonquerorAdaptor::createNewWindow( const QString& url, const QString& mimetype, const QByteArray& startup_id, bool tempFile )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return openBrowserWindow( url );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindow( const QString &url )
|
||||
{
|
||||
return createNewWindow( url, QString(), false );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindowASN( const QString &url, const DCOPCString& startup_id, bool tempFile )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createNewWindow( url, QString(), tempFile );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindowWithSelection( const QString &url, QStringList filesToSelect )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
KonqMainWindow *res = KonqMisc::createNewWindow( KUrl(url), KParts::URLArgs(), false, filesToSelect );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindowWithSelectionASN( const QString &url, QStringList filesToSelect, const DCOPCString &startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createNewWindowWithSelection( url, filesToSelect );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindow( const QString &url, const QString &mimetype, bool tempFile )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
|
@ -109,76 +77,51 @@ DCOPRef KonquerorIface::createNewWindow( const QString &url, const QString &mime
|
|||
KUrl finalURL = KonqMisc::konqFilteredURL( 0, url );
|
||||
KonqMainWindow *res = KonqMisc::createNewWindow( finalURL, args, false, QStringList(), tempFile );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createNewWindowASN( const QString &url, const QString &mimetype,
|
||||
const DCOPCString& startup_id, bool tempFile )
|
||||
QDBusObjectPath KonquerorAdaptor::createNewWindowWithSelection( const QString& url, const QStringList& filesToSelect, const QByteArray& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createNewWindow( url, mimetype, tempFile );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfile( const QString &path )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
kDebug(1202) << "void KonquerorIface::createBrowserWindowFromProfile( const QString &path ) " << endl;
|
||||
kDebug(1202) << path << endl;
|
||||
KonqMainWindow *res = KonqMisc::createBrowserWindowFromProfile( path, QString() );
|
||||
KonqMainWindow *res = KonqMisc::createNewWindow( KUrl(url), KParts::URLArgs(), false, filesToSelect );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileASN( const QString &path, const DCOPCString& startup_id )
|
||||
QDBusObjectPath KonquerorAdaptor::createBrowserWindowFromProfile( const QString& path, const QString& filename, const QByteArray& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createBrowserWindowFromProfile( path );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfile( const QString & path, const QString &filename )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
kDebug(1202) << "void KonquerorIface::createBrowserWindowFromProfile( path, filename ) " << endl;
|
||||
kDebug(1202) << "void KonquerorAdaptor::createBrowserWindowFromProfile( path, filename ) " << endl;
|
||||
kDebug(1202) << path << "," << filename << endl;
|
||||
KonqMainWindow *res = KonqMisc::createBrowserWindowFromProfile( path, filename );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileASN( const QString &path, const QString &filename,
|
||||
const DCOPCString& startup_id )
|
||||
QDBusObjectPath KonquerorAdaptor::createBrowserWindowFromProfileAndUrl( const QString& path, const QString& filename, const QString& url, const QByteArray& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createBrowserWindowFromProfile( path, filename );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileAndURL( const QString & path, const QString &filename, const QString &url )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
KonqMainWindow *res = KonqMisc::createBrowserWindowFromProfile( path, filename, KUrl(url) );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileAndURLASN( const QString & path, const QString &filename, const QString &url,
|
||||
const DCOPCString& startup_id )
|
||||
QDBusObjectPath KonquerorAdaptor::createBrowserWindowFromProfileUrlAndMimeType( const QString& path, const QString& filename, const QString& url, const QString& mimetype, const QByteArray& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createBrowserWindowFromProfileAndURL( path, filename, url );
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileAndURL( const QString &path, const QString &filename, const QString &url, const QString &mimetype )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info::setAppUserTime( 0 );
|
||||
#endif
|
||||
|
@ -186,19 +129,11 @@ DCOPRef KonquerorIface::createBrowserWindowFromProfileAndURL( const QString &pat
|
|||
args.serviceType = mimetype;
|
||||
KonqMainWindow *res = KonqMisc::createBrowserWindowFromProfile( path, filename, KUrl(url), args );
|
||||
if ( !res )
|
||||
return DCOPRef();
|
||||
return res->dcopObject();
|
||||
return QDBusObjectPath();
|
||||
return QDBusObjectPath( '/' + res->objectName() ); // this is what KMainWindow sets as the dbus object path
|
||||
}
|
||||
|
||||
DCOPRef KonquerorIface::createBrowserWindowFromProfileAndURLASN( const QString & path, const QString &filename, const QString &url, const QString &mimetype,
|
||||
const DCOPCString& startup_id )
|
||||
{
|
||||
kapp->setStartupId( startup_id );
|
||||
return createBrowserWindowFromProfileAndURL( path, filename, url, mimetype );
|
||||
}
|
||||
|
||||
|
||||
void KonquerorIface::reparseConfiguration()
|
||||
void KonquerorAdaptor::reparseConfiguration()
|
||||
{
|
||||
KGlobal::config()->reparseConfiguration();
|
||||
KonqFMSettings::reparseConfiguration();
|
||||
|
@ -211,7 +146,7 @@ void KonquerorIface::reparseConfiguration()
|
|||
}
|
||||
}
|
||||
|
||||
void KonquerorIface::updateProfileList()
|
||||
void KonquerorAdaptor::updateProfileList()
|
||||
{
|
||||
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
|
||||
if ( !mainWindows )
|
||||
|
@ -221,40 +156,39 @@ void KonquerorIface::updateProfileList()
|
|||
window->viewManager()->profileListDirty( false );
|
||||
}
|
||||
|
||||
QString KonquerorIface::crashLogFile()
|
||||
QString KonquerorAdaptor::crashLogFile()
|
||||
{
|
||||
return KonqMainWindow::s_crashlog_file->objectName();
|
||||
}
|
||||
|
||||
QList<DCOPRef> KonquerorIface::getWindows()
|
||||
QList<QDBusObjectPath> KonquerorAdaptor::getWindows()
|
||||
{
|
||||
QList<DCOPRef> lst;
|
||||
QList<QDBusObjectPath> lst;
|
||||
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
|
||||
if ( mainWindows )
|
||||
{
|
||||
foreach ( KonqMainWindow* window, *mainWindows )
|
||||
lst.append( DCOPRef( kapp->dcopClient()->appId(), window->dcopObject()->objId() ) );
|
||||
lst.append( QDBusObjectPath( '/' + window->objectName() ) );
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
void KonquerorIface::addToCombo( QString url, DCOPCString objId )
|
||||
void KonquerorAdaptor::addToCombo( const QString& url, const QDBusMessage& msg )
|
||||
{
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboAdd, url, objId );
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboAdd, url, msg.sender() );
|
||||
}
|
||||
|
||||
void KonquerorIface::removeFromCombo( QString url, DCOPCString objId )
|
||||
void KonquerorAdaptor::removeFromCombo( const QString& url, const QDBusMessage& msg )
|
||||
{
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboRemove, url, objId );
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboRemove, url, msg.sender() );
|
||||
}
|
||||
|
||||
void KonquerorIface::comboCleared( DCOPCString objId )
|
||||
void KonquerorAdaptor::comboCleared( const QDBusMessage& msg )
|
||||
{
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboClear,
|
||||
QString(), objId );
|
||||
KonqMainWindow::comboAction( KonqMainWindow::ComboClear, QString(), msg.sender() );
|
||||
}
|
||||
|
||||
bool KonquerorIface::processCanBeReused( int screen )
|
||||
bool KonquerorAdaptor::processCanBeReused( int screen )
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
QX11Info info;
|
||||
|
@ -301,8 +235,10 @@ bool KonquerorIface::processCanBeReused( int screen )
|
|||
return true;
|
||||
}
|
||||
|
||||
void KonquerorIface::terminatePreloaded()
|
||||
void KonquerorAdaptor::terminatePreloaded()
|
||||
{
|
||||
if( KonqMainWindow::isPreloaded())
|
||||
kapp->exit();
|
||||
}
|
||||
|
||||
#include "KonquerorAdaptor.moc"
|
153
konqueror/KonquerorAdaptor.h
Normal file
153
konqueror/KonquerorAdaptor.h
Normal file
|
@ -0,0 +1,153 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright 2000-2006 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonquerorAdaptor_h__
|
||||
#define __KonquerorAdaptor_h__
|
||||
|
||||
#include <QStringList>
|
||||
#include <dbus/qdbus.h>
|
||||
|
||||
/**
|
||||
* DBus interface of a konqueror process
|
||||
*/
|
||||
class KonquerorAdaptor : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.Konqueror")
|
||||
|
||||
public:
|
||||
|
||||
KonquerorAdaptor();
|
||||
~KonquerorAdaptor();
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
* Opens a new window for the given @p url (using createSimpleWindow, i.e. a single view)
|
||||
* @param url the url to open
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath openBrowserWindow( const QString& url, const QByteArray& startup_id );
|
||||
|
||||
/**
|
||||
* Opens a new window for the given @p url (using createNewWindow, i.e. with an appropriate profile)
|
||||
* @param url the url to open
|
||||
* @param mimetype pass the mimetype of the url, if known, to speed up the process.
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @param tempFile whether to delete the file after use, usually this is false
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath createNewWindow( const QString& url, const QString& mimetype, const QByteArray& startup_id, bool tempFile );
|
||||
|
||||
/**
|
||||
* Opens a new window like @ref createNewWindow, then selects the given @p filesToSelect
|
||||
* @param filesToSelect the files to select in the newly opened file-manager window
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath createNewWindowWithSelection( const QString& url, const QStringList& filesToSelect, const QByteArray& startup_id );
|
||||
|
||||
/**
|
||||
* As the name says, this creates a window from a profile.
|
||||
* Used for instance by kfmclient.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir (can be empty if not known, e.g. from khelpcenter)
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath createBrowserWindowFromProfile( const QString& path, const QString& filename,
|
||||
const QByteArray& startup_id );
|
||||
|
||||
/**
|
||||
* Creates a window from a profile and a URL.
|
||||
* Used by kfmclient to open http URLs with the webbrowsing profile
|
||||
* and others with the filemanagement profile.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir
|
||||
* @param url the URL to open
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath createBrowserWindowFromProfileAndUrl( const QString& path, const QString& filename, const QString& url,
|
||||
const QByteArray& startup_id );
|
||||
/**
|
||||
* Creates a window the fastest way : the caller has to provide
|
||||
* profile, URL, and mimetype.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir
|
||||
* @param url the URL to open
|
||||
* @param mimetype the mimetype that the URL we want to open has
|
||||
* @param startup_id sets the application startup notification (ASN) property on the window, if not empty.
|
||||
* @return the DBUS object path of the window
|
||||
*/
|
||||
QDBusObjectPath createBrowserWindowFromProfileUrlAndMimeType( const QString& path, const QString& filename,
|
||||
const QString& url, const QString& mimetype,
|
||||
const QByteArray& startup_id );
|
||||
|
||||
/**
|
||||
* Called by kcontrol when the global configuration changes
|
||||
*/
|
||||
Q_ASYNC void reparseConfiguration();
|
||||
|
||||
/**
|
||||
* @return the name of the instance's crash log file
|
||||
*/
|
||||
QString crashLogFile();
|
||||
|
||||
/**
|
||||
* @return a list of references to all the windows
|
||||
*/
|
||||
QList<QDBusObjectPath> getWindows();
|
||||
|
||||
/**
|
||||
* Called internally as broadcast when the user adds/removes/renames a view profile
|
||||
*/
|
||||
Q_ASYNC void updateProfileList();
|
||||
|
||||
/**
|
||||
* Called internally as broadcast when a URL is to be added to the combobox.
|
||||
*/
|
||||
Q_ASYNC void addToCombo( const QString& url, const QDBusMessage& msg );
|
||||
|
||||
/**
|
||||
* Called internall as broadcast when a URL has to be removed from the combo.
|
||||
*/
|
||||
Q_ASYNC void removeFromCombo( const QString& url, const QDBusMessage& msg );
|
||||
|
||||
/**
|
||||
* Called internally as a broadcast when the combobox was cleared.
|
||||
*/
|
||||
Q_ASYNC void comboCleared( const QDBusMessage& msg );
|
||||
|
||||
/**
|
||||
* Used by kfmclient when the 'minimize memory usage' setting is set
|
||||
* to find out if this konqueror can be used.
|
||||
*/
|
||||
bool processCanBeReused( int screen );
|
||||
|
||||
/**
|
||||
* Called from konqy_preloader to terminate this Konqueror instance,
|
||||
* if it's in the preloaded mode, and there are too many preloaded Konqy's
|
||||
*/
|
||||
Q_ASYNC void terminatePreloaded();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,188 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
|
||||
Copyright (C) 2000 David Faure <faure@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __KonquerorIface_h__
|
||||
#define __KonquerorIface_h__
|
||||
|
||||
#include <dcopobject.h>
|
||||
#include <dcopref.h>
|
||||
|
||||
#include <QStringList>
|
||||
/**
|
||||
* DCOP interface for konqueror
|
||||
*/
|
||||
class KonquerorIface : virtual public DCOPObject
|
||||
{
|
||||
K_DCOP
|
||||
public:
|
||||
|
||||
KonquerorIface();
|
||||
~KonquerorIface();
|
||||
|
||||
k_dcop:
|
||||
|
||||
/**
|
||||
* Opens a new window for the given @p url (using createSimpleWindow, i.e. a single view)
|
||||
*/
|
||||
DCOPRef openBrowserWindow( const QString &url );
|
||||
/**
|
||||
* Like @ref openBrowserWindow , with setting the application startup notification ( ASN )
|
||||
* property on the window.
|
||||
*/
|
||||
DCOPRef openBrowserWindowASN( const QString &url, const DCOPCString &startup_id );
|
||||
|
||||
/**
|
||||
* Opens a new window for the given @p url (using createNewWindow, i.e. with an appropriate profile)
|
||||
*/
|
||||
DCOPRef createNewWindow( const QString &url );
|
||||
/**
|
||||
* Like @ref createNewWindow , with setting the application startup notification ( ASN )
|
||||
* property on the window.
|
||||
*/
|
||||
DCOPRef createNewWindowASN( const QString &url, const DCOPCString &startup_id, bool tempFile );
|
||||
|
||||
/**
|
||||
* Opens a new window like @ref createNewWindow, then selects the given @p filesToSelect
|
||||
*/
|
||||
DCOPRef createNewWindowWithSelection( const QString &url, QStringList filesToSelect );
|
||||
/**
|
||||
* Like @ref createNewWindowWithSelection, with setting the application startup notification ( ASN )
|
||||
* property on the window.
|
||||
*/
|
||||
DCOPRef createNewWindowWithSelectionASN( const QString &url, QStringList filesToSelect, const DCOPCString &startup_id );
|
||||
|
||||
/**
|
||||
* Opens a new window for the given @p url (using createNewWindow, i.e. with an appropriate profile)
|
||||
* @param mimetype to speed it up.
|
||||
*/
|
||||
DCOPRef createNewWindow( const QString &url, const QString & mimetype, bool tempFile );
|
||||
/**
|
||||
* Like @ref createNewWindow , with setting the application startup notification ( ASN )
|
||||
* property on the window.
|
||||
*/
|
||||
DCOPRef createNewWindowASN( const QString &url, const QString & mimetype,
|
||||
const DCOPCString &startup_id, bool tempFile );
|
||||
|
||||
/**
|
||||
* As the name says, this creates a window from a profile.
|
||||
* Used for instance by khelpcenter.
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfile( const QString &path );
|
||||
/**
|
||||
* Like @ref createBrowserWindowFromProfile , with setting the application startup
|
||||
* notification ( ASN ) property on the window.
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileASN( const QString &path, const DCOPCString &startup_id );
|
||||
|
||||
/**
|
||||
* As the name says, this creates a window from a profile.
|
||||
* Used for instance by kfmclient.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfile( const QString &path, const QString &filename );
|
||||
/**
|
||||
* Like @ref createBrowserWindowFromProfile , with setting the application startup
|
||||
* notification ( ASN ) property on the window.
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileASN( const QString &path, const QString &filename,
|
||||
const DCOPCString &startup_id );
|
||||
|
||||
/**
|
||||
* Creates a window from a profile and a URL.
|
||||
* Used by kfmclient to open http URLs with the webbrowsing profile
|
||||
* and others with the filemanagement profile.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir
|
||||
* @param url the URL to open
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileAndURL( const QString &path, const QString &filename, const QString &url );
|
||||
/**
|
||||
* Like @ref createBrowserWindowFromProfileAndURL , with setting the application startup
|
||||
* notification ( ASN ) property on the window.
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileAndURLASN( const QString &path, const QString &filename, const QString &url,
|
||||
const DCOPCString &startup_id );
|
||||
|
||||
/**
|
||||
* Creates a window the fastest way : the caller has to provide
|
||||
* profile, URL, and mimetype.
|
||||
* @param path full path to the profile file
|
||||
* @param filename name of the profile file, if under the profiles dir
|
||||
* @param url the URL to open
|
||||
* @param mimetype the mimetype that the URL we want to open has
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileAndURL( const QString &path, const QString &filename, const QString &url, const QString &mimetype );
|
||||
/**
|
||||
* Like @ref createBrowserWindowFromProfileAndURL , with setting the application startup
|
||||
* notification ( ASN ) property on the window.
|
||||
*/
|
||||
DCOPRef createBrowserWindowFromProfileAndURLASN( const QString &path, const QString &filename, const QString &url, const QString &mimetype,
|
||||
const DCOPCString& startup_id );
|
||||
|
||||
/**
|
||||
* Called by kcontrol when the global configuration changes
|
||||
*/
|
||||
ASYNC reparseConfiguration();
|
||||
|
||||
/**
|
||||
* @return the name of the instance's crash log file
|
||||
*/
|
||||
QString crashLogFile();
|
||||
|
||||
/**
|
||||
* @return a list of references to all the windows
|
||||
*/
|
||||
QList<DCOPRef> getWindows();
|
||||
|
||||
/**
|
||||
* Called internally as broadcast when the user adds/removes/renames a view profile
|
||||
*/
|
||||
ASYNC updateProfileList();
|
||||
|
||||
/**
|
||||
* Called internally as broadcast when a URL is to be added to the combobox.
|
||||
*/
|
||||
ASYNC addToCombo( QString, DCOPCString );
|
||||
|
||||
/**
|
||||
* Called internall as broadcast when a URL has to be removed from the combo.
|
||||
*/
|
||||
ASYNC removeFromCombo( QString, DCOPCString );
|
||||
|
||||
/**
|
||||
* Called internally as a broadcast when the combobox was cleared.
|
||||
*/
|
||||
ASYNC comboCleared( DCOPCString );
|
||||
|
||||
/**
|
||||
* Used by kfmclient when the 'minimize memory usage' setting is set
|
||||
* to find out if this konqueror can be used.
|
||||
*/
|
||||
bool processCanBeReused( int screen );
|
||||
|
||||
/**
|
||||
* Called from konqy_preloader to terminate this Konqueror instance,
|
||||
* if it's in the preloaded mode, and there are too many preloaded Konqy's
|
||||
*/
|
||||
ASYNC terminatePreloaded();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -7,6 +7,7 @@ set(kfmclient_KDEINIT_SRCS kfmclient.cc )
|
|||
|
||||
kde4_automoc(${kfmclient_KDEINIT_SRCS})
|
||||
|
||||
add_definitions(-DQT_NO_CAST_ASCII)
|
||||
|
||||
kde4_add_kdeinit_executable( kfmclient ${kfmclient_KDEINIT_SRCS})
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 1999 David Faure <faure@kde.org>
|
||||
Copyright (C) 1999-2006 David Faure <faure@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
|
@ -17,13 +17,10 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <QDir>
|
||||
#include "kfmclient.h"
|
||||
#include "KonquerorIface_stub.h"
|
||||
#include "KDesktopIface_stub.h"
|
||||
#include "kwin.h"
|
||||
|
||||
#include <ktoolinvocation.h>
|
||||
#include <kio/job.h>
|
||||
|
@ -38,14 +35,18 @@
|
|||
#include <kmimetypetrader.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <kdebug.h>
|
||||
#include <dcopclient.h>
|
||||
#include <kservice.h>
|
||||
#include <kstaticdeleter.h>
|
||||
|
||||
#include <dbus/qdbus.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QRegExp>
|
||||
|
||||
#include "kfmclient.h"
|
||||
#include "KonquerorIface_stub.h"
|
||||
#include "KDesktopIface_stub.h"
|
||||
#include "kwin.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -54,16 +55,15 @@
|
|||
|
||||
static const char appName[] = "kfmclient";
|
||||
static const char programName[] = I18N_NOOP("kfmclient");
|
||||
|
||||
static const char description[] = I18N_NOOP("KDE tool for opening URLs from the command line");
|
||||
|
||||
static const char version[] = "2.0";
|
||||
|
||||
QByteArray clientApp::startup_id_str;
|
||||
bool clientApp::m_ok = true;
|
||||
QByteArray ClientApp::startup_id_str;
|
||||
bool ClientApp::m_ok = true;
|
||||
bool s_interactive = true;
|
||||
|
||||
static KInstance* s_instance = 0;
|
||||
static KStaticDeleter<KInstance> s_instanceSd;
|
||||
|
||||
static const KCmdLineOptions options[] =
|
||||
{
|
||||
|
@ -153,15 +153,14 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
|
|||
return 0;
|
||||
}
|
||||
|
||||
return clientApp::doIt() ? 0 /*no error*/ : 1 /*error*/;
|
||||
return ClientApp::doIt() ? 0 /*no error*/ : 1 /*error*/;
|
||||
}
|
||||
|
||||
// Call needInstance before any use of KConfig
|
||||
static void needInstance()
|
||||
{
|
||||
if ( !s_instance ) {
|
||||
// TODO KStaticDeleter
|
||||
s_instance = new KInstance( appName );
|
||||
s_instanceSd.setObject( s_instance, new KInstance( appName ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,40 +260,45 @@ static int currentScreen()
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void needDCOP()
|
||||
static void needDBus()
|
||||
{
|
||||
if( !KApplication::dcopClient()->attach())
|
||||
{
|
||||
KApplication::startKdeinit();
|
||||
KApplication::dcopClient()->attach();
|
||||
}
|
||||
if (!QDBus::sessionBus().isConnected() || !(bus = QDBus::sessionBus().busService()))
|
||||
kFatal(101) << "Session bus not found" << endl;
|
||||
}
|
||||
|
||||
// when reusing a preloaded konqy, make sure your always use a DCOP call which opens a profile !
|
||||
static DCOPCString getPreloadedKonqy()
|
||||
// when reusing a preloaded konqy, make sure your always use a DBus call which opens a profile !
|
||||
|
||||
#if 0
|
||||
// TODO - we need QDBusRef here; or QPair<QString,QDBusObjectPath>
|
||||
static QDBusRef getPreloadedKonqy()
|
||||
{
|
||||
needInstance();
|
||||
KConfig cfg( QLatin1String( "konquerorrc" ), true );
|
||||
cfg.setGroup( "Reusing" );
|
||||
if( cfg.readEntry( "MaxPreloadCount", 1 ) == 0 )
|
||||
return "";
|
||||
needDCOP();
|
||||
needDBus();
|
||||
DCOPRef ref( "kded", "konqy_preloader" );
|
||||
DCOPCString ret;
|
||||
if( ref.callExt( "getPreloadedKonqy", DCOPRef::NoEventLoop, 3000, currentScreen()).get( ret ))
|
||||
return ret;
|
||||
return DCOPCString();
|
||||
}
|
||||
#endif
|
||||
|
||||
static DCOPCString konqyToReuse( const QString& url, const QString& mimetype, const QString& profile )
|
||||
{ // prefer(?) preloaded ones
|
||||
|
||||
// TODO
|
||||
#if 0
|
||||
DCOPCString ret = getPreloadedKonqy();
|
||||
if( !ret.isEmpty())
|
||||
return ret;
|
||||
#endif
|
||||
if( startNewKonqueror( url, mimetype, profile ))
|
||||
return "";
|
||||
needDCOP();
|
||||
DCOPCString appObj;
|
||||
needDBus();
|
||||
QString appObj;
|
||||
QByteArray data;
|
||||
QDataStream str( &data, QIODevice::WriteOnly );
|
||||
|
||||
|
@ -306,7 +310,7 @@ static DCOPCString konqyToReuse( const QString& url, const QString& mimetype, co
|
|||
return ret;
|
||||
}
|
||||
|
||||
void clientApp::sendASNChange()
|
||||
void ClientApp::sendASNChange()
|
||||
{
|
||||
#ifdef Q_WS_X11
|
||||
KStartupInfoId id;
|
||||
|
@ -324,39 +328,20 @@ void clientApp::sendASNChange()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool clientApp::createNewWindow(const KUrl & url, bool newTab, bool tempFile, const QString & mimetype)
|
||||
bool ClientApp::createNewWindow(const KUrl & url, bool newTab, bool tempFile, const QString & mimetype)
|
||||
{
|
||||
kDebug( 1202 ) << "clientApp::createNewWindow " << url.url() << " mimetype=" << mimetype << endl;
|
||||
kDebug( 1202 ) << "ClientApp::createNewWindow " << url.url() << " mimetype=" << mimetype << endl;
|
||||
needInstance();
|
||||
#if 0
|
||||
// check if user wants to use external browser
|
||||
// ###### this option seems to have no GUI and to be redundant with BrowserApplication now.
|
||||
// ###### KDE4: remove
|
||||
KConfig config( QLatin1String("kfmclientrc"));
|
||||
config.setGroup( QLatin1String("Settings"));
|
||||
QString strBrowser = config.readPathEntry("ExternalBrowser");
|
||||
if (!strBrowser.isEmpty())
|
||||
{
|
||||
if ( tempFile )
|
||||
kWarning() << "kfmclient used with --tempfile but is passing to an external browser! Tempfile will never be deleted" << endl;
|
||||
KProcess proc;
|
||||
proc << strBrowser << url.url();
|
||||
proc.start( KProcess::DontCare );
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (url.protocol().startsWith(QLatin1String("http")))
|
||||
{
|
||||
#if 1
|
||||
KConfig config( QLatin1String("kfmclientrc"));
|
||||
#endif
|
||||
config.setGroup("General");
|
||||
if (!config.readEntry("BrowserApplication").isEmpty())
|
||||
{
|
||||
kDebug() << config.readEntry( "BrowserApplication" ) << endl;
|
||||
Q_ASSERT( qApp );
|
||||
//clientApp app;
|
||||
//ClientApp app;
|
||||
#ifdef Q_WS_X11
|
||||
KStartupInfo::appStarted();
|
||||
#endif
|
||||
|
@ -373,7 +358,7 @@ bool clientApp::createNewWindow(const KUrl & url, bool newTab, bool tempFile, co
|
|||
cfg.setGroup( "FMSettings" );
|
||||
if ( newTab || cfg.readEntry( "KonquerorTabforExternalURL", QVariant(false )).toBool() )
|
||||
{
|
||||
needDCOP();
|
||||
needDBus();
|
||||
DCOPCString foundApp, foundObj;
|
||||
QByteArray data;
|
||||
QDataStream str( &data, QIODevice::WriteOnly );
|
||||
|
@ -394,7 +379,7 @@ bool clientApp::createNewWindow(const KUrl & url, bool newTab, bool tempFile, co
|
|||
DCOPCString appId = konqyToReuse( url.url(), mimetype, QString() );
|
||||
if( !appId.isEmpty())
|
||||
{
|
||||
kDebug( 1202 ) << "clientApp::createNewWindow using existing konqueror" << endl;
|
||||
kDebug( 1202 ) << "ClientApp::createNewWindow using existing konqueror" << endl;
|
||||
KonquerorIface_stub konqy( appId, "KonquerorIface" );
|
||||
konqy.createNewWindowASN( url.url(), mimetype, startup_id_str, tempFile );
|
||||
sendASNChange();
|
||||
|
@ -425,13 +410,13 @@ bool clientApp::createNewWindow(const KUrl & url, bool newTab, bool tempFile, co
|
|||
#ifdef Q_WS_X11
|
||||
KStartupInfo::resetStartupEnv();
|
||||
#endif
|
||||
kDebug( 1202 ) << "clientApp::createNewWindow KProcess started" << endl;
|
||||
kDebug( 1202 ) << "ClientApp::createNewWindow KProcess started" << endl;
|
||||
//}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool clientApp::openProfile( const QString & profileName, const QString & url, const QString & mimetype )
|
||||
bool ClientApp::openProfile( const QString & profileName, const QString & url, const QString & mimetype )
|
||||
{
|
||||
needInstance();
|
||||
DCOPCString appId = konqyToReuse( url, mimetype, profileName );
|
||||
|
@ -444,7 +429,7 @@ bool clientApp::openProfile( const QString & profileName, const QString & url, c
|
|||
kError() << "Couldn't start konqueror from konqueror.desktop: " << error << endl;
|
||||
return false;
|
||||
}
|
||||
// startServiceByDesktopPath waits for the app to register with DCOP
|
||||
// startServiceByDesktopPath waits for the app to register with DBus
|
||||
// so when we arrive here, konq is up and running already, and appId contains the identification
|
||||
}
|
||||
|
||||
|
@ -462,11 +447,12 @@ bool clientApp::openProfile( const QString & profileName, const QString & url, c
|
|||
else
|
||||
konqy.createBrowserWindowFromProfileAndURLASN( profile, profileName, url, mimetype, startup_id_str );
|
||||
sleep(2); // Martin Schenk <martin@schenk.com> says this is necessary to let the server read from the socket
|
||||
// ######## so those methods should probably not be ASYNC
|
||||
sendASNChange();
|
||||
return true;
|
||||
}
|
||||
|
||||
void clientApp::delayedQuit()
|
||||
void ClientApp::delayedQuit()
|
||||
{
|
||||
// Quit in 2 seconds. This leaves time for KRun to pop up
|
||||
// "app not found" in KProcessRunner, if that was the case.
|
||||
|
@ -487,7 +473,7 @@ static void checkArgumentCount(int count, int min, int max)
|
|||
}
|
||||
}
|
||||
|
||||
bool clientApp::doIt()
|
||||
bool ClientApp::doIt()
|
||||
{
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
int argc = args->count();
|
||||
|
@ -503,10 +489,10 @@ bool clientApp::doIt()
|
|||
startup_id_str = KStartupInfo::currentStartupIdEnv().id();
|
||||
#endif
|
||||
|
||||
kDebug() << "Creating clientApp" << endl;
|
||||
kDebug() << "Creating ClientApp" << endl;
|
||||
int fake_argc = 0;
|
||||
char** fake_argv = 0;
|
||||
clientApp app( fake_argc, fake_argv );
|
||||
ClientApp app( fake_argc, fake_argv );
|
||||
|
||||
|
||||
if ( command == "openURL" || command == "newTab" )
|
||||
|
@ -646,7 +632,7 @@ bool clientApp::doIt()
|
|||
}
|
||||
else if ( command == "configure" )
|
||||
{
|
||||
needDCOP();
|
||||
needDBus();
|
||||
checkArgumentCount(argc, 1, 1);
|
||||
QByteArray data;
|
||||
kapp->dcopClient()->send( "*", "KonqMainViewIface", "reparseConfiguration()", data );
|
||||
|
@ -666,7 +652,7 @@ bool clientApp::doIt()
|
|||
return true;
|
||||
}
|
||||
|
||||
void clientApp::slotResult( KJob * job )
|
||||
void ClientApp::slotResult( KJob * job )
|
||||
{
|
||||
if (job->error() && s_interactive)
|
||||
static_cast<KIO::Job*>(job)->showErrorDialog();
|
||||
|
@ -674,7 +660,7 @@ void clientApp::slotResult( KJob * job )
|
|||
quit();
|
||||
}
|
||||
|
||||
void clientApp::slotDialogCanceled()
|
||||
void ClientApp::slotDialogCanceled()
|
||||
{
|
||||
m_ok = false;
|
||||
quit();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 1999 David Faure <faure@kde.org>
|
||||
Copyright (C) 1999-2006 David Faure <faure@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
|
@ -23,11 +23,11 @@
|
|||
#include <kapplication.h>
|
||||
#include <krun.h>
|
||||
|
||||
class clientApp : public QApplication
|
||||
class ClientApp : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
clientApp(int &argc, char **argv ) : QApplication( argc, argv ) {}
|
||||
ClientApp(int &argc, char **argv ) : QApplication( argc, argv ) {}
|
||||
|
||||
/** Parse command-line arguments and "do it" */
|
||||
static bool doIt();
|
||||
|
|
|
@ -72,7 +72,7 @@ KParts::ReadOnlyPart *KonqViewFactory::create( QWidget *parentWidget, QObject *
|
|||
}
|
||||
|
||||
if ( !obj->inherits( "KParts::ReadOnlyPart" ) )
|
||||
kError(1202) << "Part " << obj << " (" << obj->className() << ") doesn't inherit KParts::ReadOnlyPart !" << endl;
|
||||
kError(1202) << "Part " << obj << " (" << obj->metaObject()->className() << ") doesn't inherit KParts::ReadOnlyPart !" << endl;
|
||||
|
||||
return static_cast<KParts::ReadOnlyPart *>(obj);
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ QList<KAction*> ToggleViewGUIClient::actions() const
|
|||
|
||||
void ToggleViewGUIClient::slotToggleView( bool toggle )
|
||||
{
|
||||
QString serviceName = QLatin1String( sender()->name() );
|
||||
QString serviceName = sender()->objectName();
|
||||
|
||||
bool horizontal = m_mapOrientation[ serviceName ];
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "konq_mainwindow.h"
|
||||
#include "konq_view.h"
|
||||
#include "konq_settingsxt.h"
|
||||
//#include "KonquerorIface.h"
|
||||
#include "KonquerorAdaptor.h"
|
||||
|
||||
#include <ktempfile.h>
|
||||
#include <klocale.h>
|
||||
|
@ -61,9 +61,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
|
|||
|
||||
KonquerorApplication app;
|
||||
|
||||
// TODO DBUS Interface
|
||||
//KonquerorIface *kiface = new KonquerorIface;
|
||||
//app.dcopClient()->setDefaultObject( kiface->objId() );
|
||||
new KonquerorAdaptor;
|
||||
|
||||
KGlobal::locale()->insertCatalog("libkonq"); // needed for apps using libkonq
|
||||
|
||||
|
@ -222,8 +220,6 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
|
|||
delete KonqMainWindow::mainWindowList()->first();
|
||||
}
|
||||
|
||||
//delete kiface;
|
||||
|
||||
crashlog_file.unlink();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "konq_mainwindow.h"
|
||||
#include "konq_guiclients.h"
|
||||
//#include "KonqMainWindowIface.h"
|
||||
#include "KonqMainWindowAdaptor.h"
|
||||
#include "konq_view.h"
|
||||
#include "konq_run.h"
|
||||
#include "konq_misc.h"
|
||||
|
@ -181,7 +181,7 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, bool openInitialURL, con
|
|||
m_pWorkingTab = 0;
|
||||
m_initialKonqRun = 0;
|
||||
m_pBookmarkMenu = 0;
|
||||
// TODO m_dcopObject = new KonqMainWindowIface( this );
|
||||
(void) new KonqMainWindowAdaptor( this );
|
||||
m_combo = 0;
|
||||
m_bURLEnterLock = false;
|
||||
m_bLocationBarConnected = false;
|
||||
|
@ -347,8 +347,6 @@ KonqMainWindow::~KonqMainWindow()
|
|||
|
||||
delete m_configureDialog;
|
||||
m_configureDialog = 0;
|
||||
//delete m_dcopObject;
|
||||
//m_dcopObject = 0;
|
||||
delete m_combo;
|
||||
m_combo = 0;
|
||||
delete m_locationLabel;
|
||||
|
@ -3589,8 +3587,8 @@ void KonqMainWindow::showPageSecurity()
|
|||
}
|
||||
}
|
||||
|
||||
// called via DBUS from KonquerorIface
|
||||
void KonqMainWindow::comboAction( int action, const QString& url, const QByteArray& objId )
|
||||
// called via DBUS from KonquerorAdaptor
|
||||
void KonqMainWindow::comboAction( int action, const QString& url, const QString& senderId )
|
||||
{
|
||||
if (!s_lstViews) // this happens in "konqueror --silent"
|
||||
return;
|
||||
|
@ -3617,7 +3615,7 @@ void KonqMainWindow::comboAction( int action, const QString& url, const QByteArr
|
|||
}
|
||||
|
||||
// only one instance should save...
|
||||
if ( combo && QString(objId) == QDBus::sessionBus().baseService() )
|
||||
if ( combo && senderId == QDBus::sessionBus().baseService() )
|
||||
combo->saveItems();
|
||||
}
|
||||
|
||||
|
@ -5102,12 +5100,6 @@ void KonqMainWindow::unplugViewModeActions()
|
|||
unplugActionList( "viewmode_toolbar" );
|
||||
}
|
||||
|
||||
/*KonqMainWindowIface* KonqMainWindow::dcopObject()
|
||||
{
|
||||
return m_dcopObject;
|
||||
}
|
||||
*/
|
||||
|
||||
void KonqMainWindow::updateBookmarkBar()
|
||||
{
|
||||
KToolBar * bar = static_cast<KToolBar *>( child( "bookmarkToolBar", "KToolBar" ) );
|
||||
|
@ -5379,7 +5371,7 @@ static void hp_removeDupe( KCompletionMatches& l, const QString& dupe,
|
|||
continue;
|
||||
}
|
||||
if( (*it).value() == dupe ) {
|
||||
(*it_orig).first = qMax( (*it_orig).first, (*it).index());
|
||||
(*it_orig).first = qMax( (*it_orig).first, (*it).key());
|
||||
it = l.erase( it );
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ public:
|
|||
// operates on all combos of all mainwindows of this instance
|
||||
// up to now adds an entry or clears all entries
|
||||
static void comboAction( int action, const QString& url,
|
||||
const QByteArray& objId );
|
||||
const QString& senderId );
|
||||
|
||||
#ifndef NDEBUG
|
||||
void dumpViewList();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- c-basic-offset: 2 -*-
|
||||
/*
|
||||
This file is part of the KDE project
|
||||
Copyright (C) 1998-2005 David Faure <faure@kde.org>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#include "konq_view.h"
|
||||
//#include "KonqViewIface.h"
|
||||
#include "KonqViewAdaptor.h"
|
||||
#include "konq_settingsxt.h"
|
||||
#include "konq_frame.h"
|
||||
#include "konq_run.h"
|
||||
|
@ -74,9 +74,8 @@ KonqView::KonqView( KonqViewFactory &viewFactory,
|
|||
m_bLockHistory = false;
|
||||
m_doPost = false;
|
||||
m_pMainWindow = mainWindow;
|
||||
m_pRun = 0L;
|
||||
m_pPart = 0L;
|
||||
m_dcopObject = 0L;
|
||||
m_pRun = NULL;
|
||||
m_pPart = NULL;
|
||||
|
||||
m_randID = KRandom::random();
|
||||
|
||||
|
@ -1206,12 +1205,27 @@ void KonqView::disableScrolling()
|
|||
callExtensionMethod( "disableScrolling()" );
|
||||
}
|
||||
|
||||
KonqViewIface * KonqView::dcopObject()
|
||||
QString KonqView::dbusObjectPath()
|
||||
{
|
||||
// TODO
|
||||
// if ( !m_dcopObject )
|
||||
// m_dcopObject = new KonqViewIface( this );
|
||||
return m_dcopObject;
|
||||
// TODO maybe this can be improved?
|
||||
// E.g. using the part's name, but we'd have to update the name in setViewName maybe?
|
||||
// And to make sure it's a valid dbus object path like in kmainwindow...
|
||||
static int s_viewNumber = 0;
|
||||
if ( m_dbusObjectPath.isEmpty() ) {
|
||||
m_dbusObjectPath = '/' + m_pMainWindow->objectName() + '/' + QString::number( ++s_viewNumber );
|
||||
new KonqViewAdaptor( this );
|
||||
QDBus::sessionBus().registerObject( m_dbusObjectPath, this );
|
||||
}
|
||||
return m_dbusObjectPath;
|
||||
}
|
||||
|
||||
QString KonqView::partObjectPath()
|
||||
{
|
||||
if ( !m_pPart )
|
||||
return QString();
|
||||
|
||||
const QVariant dcopProperty = m_pPart->property( "dbusObjectPath" );
|
||||
return dcopProperty.toString();
|
||||
}
|
||||
|
||||
bool KonqView::eventFilter( QObject *obj, QEvent *e )
|
||||
|
|
|
@ -20,22 +20,20 @@
|
|||
#ifndef __konq_view_h__
|
||||
#define __konq_view_h__
|
||||
|
||||
#include "konq_mainwindow.h"
|
||||
#include "konq_mainwindow.h" // hmm, please move PageSecurity out of konq_mainwindow...
|
||||
#include "konq_factory.h"
|
||||
|
||||
#include <kservice.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QPointer>
|
||||
//Added by qt3to4:
|
||||
#include <QEvent>
|
||||
|
||||
#include <kservice.h>
|
||||
|
||||
class KonqRun;
|
||||
class KonqFrame;
|
||||
class KonqViewIface;
|
||||
class KonqBrowserInterface;
|
||||
namespace KParts
|
||||
{
|
||||
|
@ -311,7 +309,8 @@ public:
|
|||
|
||||
QStringList frameNames() const;
|
||||
|
||||
KonqViewIface * dcopObject();
|
||||
QString dbusObjectPath();
|
||||
QString partObjectPath();
|
||||
|
||||
void goHistory( int steps );
|
||||
|
||||
|
@ -480,7 +479,7 @@ private:
|
|||
QString m_serviceType;
|
||||
QString m_caption;
|
||||
QString m_tempFile;
|
||||
KonqViewIface * m_dcopObject;
|
||||
QString m_dbusObjectPath;
|
||||
KonqBrowserInterface *m_browserIface;
|
||||
int m_randID;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue