1 /* This file is part of the KDE project
2 Copyright 2000 Simon Hausmann <hausmann@kde.org>
3 Copyright 2000, 2006 David Faure <faure@kde.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #include "KonqMainWindowAdaptor.h"
22 #include "KonqViewAdaptor.h"
26 #include <kstartupinfo.h>
28 KonqMainWindowAdaptor::KonqMainWindowAdaptor( KonqMainWindow
* mainWindow
)
29 : QDBusAbstractAdaptor( mainWindow
), m_pMainWindow( mainWindow
)
31 // m_dcopActionProxy = new KDCOPActionProxy( mainWindow->actionCollection(), this );
34 KonqMainWindowAdaptor::~KonqMainWindowAdaptor()
36 // delete m_dcopActionProxy;
39 void KonqMainWindowAdaptor::openUrl( const QString
& url
, bool tempFile
)
41 m_pMainWindow
->openFilteredUrl( url
, false, tempFile
);
44 void KonqMainWindowAdaptor::newTab( const QString
& url
, bool tempFile
)
46 m_pMainWindow
->openFilteredUrl( url
, true, tempFile
);
49 void KonqMainWindowAdaptor::newTabASN( const QString
& url
, const QByteArray
& startup_id
, bool tempFile
)
52 KStartupInfo::setNewStartupId( m_pMainWindow
, startup_id
);
54 m_pMainWindow
->openFilteredUrl( url
, true, tempFile
);
57 void KonqMainWindowAdaptor::reload()
59 m_pMainWindow
->slotReload();
62 QDBusObjectPath
KonqMainWindowAdaptor::currentView()
65 KonqView
*view
= m_pMainWindow
->currentView();
67 return QDBusObjectPath();
69 return QDBusObjectPath( view
->dbusObjectPath() );
72 QDBusObjectPath
KonqMainWindowAdaptor::currentPart()
74 KonqView
*view
= m_pMainWindow
->currentView();
76 return QDBusObjectPath();
78 return QDBusObjectPath( view
->partObjectPath() );
81 QDBusObjectPath
KonqMainWindowAdaptor::view(int viewNumber
)
83 KonqMainWindow::MapViews viewMap
= m_pMainWindow
->viewMap();
84 KonqMainWindow::MapViews::const_iterator it
= viewMap
.begin();
85 for ( int i
= 0; it
!= viewMap
.end() && i
< viewNumber
; ++i
)
87 if ( it
== viewMap
.end() )
88 return QDBusObjectPath();
89 return QDBusObjectPath( (*it
)->dbusObjectPath() );
92 QDBusObjectPath
KonqMainWindowAdaptor::part(int partNumber
)
94 KonqMainWindow::MapViews viewMap
= m_pMainWindow
->viewMap();
95 KonqMainWindow::MapViews::const_iterator it
= viewMap
.begin();
96 for ( int i
= 0; it
!= viewMap
.end() && i
< partNumber
; ++i
)
98 if ( it
== viewMap
.end() )
99 return QDBusObjectPath();
100 return QDBusObjectPath( (*it
)->partObjectPath() );
103 void KonqMainWindowAdaptor::splitViewHorizontally()
105 m_pMainWindow
->slotSplitViewHorizontal();
108 void KonqMainWindowAdaptor::splitViewVertically()
110 m_pMainWindow
->slotSplitViewVertical();
113 #include "KonqMainWindowAdaptor.moc"