1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/* 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 "konqview.h"
#include <kdebug.h>
#include <kstartupinfo.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::newTabASNWithMimeType(const QString& url, const QString& mimetype, const QByteArray& startup_id, bool tempFile)
{
#ifdef Q_WS_X11
KStartupInfo::setNewStartupId( m_pMainWindow, startup_id );
#endif
m_pMainWindow->openFilteredUrl( url, mimetype, true, tempFile );
}
void KonqMainWindowAdaptor::reload()
{
m_pMainWindow->slotReload();
}
QDBusObjectPath KonqMainWindowAdaptor::currentView()
{
kDebug() ;
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() );
}
QDBusObjectPath KonqMainWindowAdaptor::view(int viewNumber)
{
KonqMainWindow::MapViews viewMap = m_pMainWindow->viewMap();
KonqMainWindow::MapViews::const_iterator it = viewMap.constBegin();
for ( int i = 0; it != viewMap.constEnd() && i < viewNumber; ++i )
++it;
if ( it == viewMap.constEnd() )
return QDBusObjectPath();
return QDBusObjectPath( (*it)->dbusObjectPath() );
}
QDBusObjectPath KonqMainWindowAdaptor::part(int partNumber)
{
KonqMainWindow::MapViews viewMap = m_pMainWindow->viewMap();
KonqMainWindow::MapViews::const_iterator it = viewMap.constBegin();
for ( int i = 0; it != viewMap.constEnd() && i < partNumber; ++i )
++it;
if ( it == viewMap.constEnd() )
return QDBusObjectPath();
return QDBusObjectPath( (*it)->partObjectPath() );
}
void KonqMainWindowAdaptor::splitViewHorizontally()
{
m_pMainWindow->slotSplitViewHorizontal();
}
void KonqMainWindowAdaptor::splitViewVertically()
{
m_pMainWindow->slotSplitViewVertical();
}
#include "KonqMainWindowAdaptor.moc"
|