Warning, file /office/calligra/libs/main/KoApplicationAdaptor.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 Copyright (C) 2000 David Faure <faure@kde.org> 0003 Copyright (C) 2006 Fredrik Edemar <f_edemar@linux.se> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #include "KoApplicationAdaptor.h" 0022 0023 #include <MainDebug.h> 0024 #include <klocalizedstring.h> 0025 #include <kmessagebox.h> 0026 0027 #include "KoApplication.h" 0028 #include "KoPart.h" 0029 #include "KoDocument.h" 0030 #include "KoMainWindow.h" 0031 #include "KoDocumentEntry.h" 0032 #include "KoView.h" 0033 0034 KoApplicationAdaptor::KoApplicationAdaptor(KoApplication *parent) 0035 : QDBusAbstractAdaptor(parent) 0036 , m_application(parent) 0037 { 0038 // constructor 0039 setAutoRelaySignals(true); 0040 } 0041 0042 KoApplicationAdaptor::~KoApplicationAdaptor() 0043 { 0044 // destructor 0045 } 0046 0047 //QString KoApplicationAdaptor::createDocument(const QString &nativeFormat) 0048 //{ 0049 // KoDocumentEntry entry = KoDocumentEntry::queryByMimeType(nativeFormat); 0050 // if (entry.isEmpty()) { 0051 // KMessageBox::questionYesNo(0, i18n("Unknown Calligra MimeType %1. Check your installation.", nativeFormat)); 0052 // return QString(); 0053 // } 0054 // KoPart *part = entry.createKoPart(0); 0055 // if (part) { 0056 // m_application->addPart(part); 0057 // return '/' + part->document()->objectName(); 0058 // } 0059 // else { 0060 // return QString(); 0061 // } 0062 //} 0063 0064 QStringList KoApplicationAdaptor::getDocuments() 0065 { 0066 QStringList lst; 0067 QList<KoPart*> parts = m_application->partList(); 0068 foreach(KoPart *part, parts) { 0069 lst.append('/' + part->document()->objectName()); 0070 } 0071 return lst; 0072 } 0073 0074 QStringList KoApplicationAdaptor::getViews() 0075 { 0076 QStringList lst; 0077 QList<KoPart*> parts = m_application->partList(); 0078 foreach(KoPart *part, parts) { 0079 foreach(KoView* view, part->views()) { 0080 lst.append('/' + view->objectName()); 0081 } 0082 } 0083 0084 return lst; 0085 } 0086 0087 QStringList KoApplicationAdaptor::getWindows() 0088 { 0089 QStringList lst; 0090 QList<KMainWindow*> mainWindows = KMainWindow::memberList(); 0091 if (!mainWindows.isEmpty()) { 0092 foreach(KMainWindow* mainWindow, mainWindows) { 0093 lst.append(static_cast<KoMainWindow*>(mainWindow)->objectName()); 0094 } 0095 } 0096 return lst; 0097 }