F:/KPlato/koffice/libs/kofficecore/KoApplicationAdaptor.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003    Copyright (C) 2006 Fredrik Edemar <f_edemar@linux.se>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "KoApplicationAdaptor.h"
00022 
00023 #include <kdebug.h>
00024 #include <klocale.h>
00025 #include <kmessagebox.h>
00026 
00027 #include "KoApplication.h"
00028 
00029 #include "KoDocument.h"
00030 #include "KoMainWindow.h"
00031 #include "KoQueryTrader.h"
00032 #include "KoView.h"
00033 
00034 KoApplicationAdaptor::KoApplicationAdaptor(QObject *parent)
00035    : QDBusAbstractAdaptor(parent)
00036 {
00037     // constructor
00038     setAutoRelaySignals(true);
00039 }
00040 
00041 KoApplicationAdaptor::~KoApplicationAdaptor()
00042 {
00043     // destructor
00044 }
00045 
00046 QString KoApplicationAdaptor::createDocument( const QString &nativeFormat )
00047 {
00048     KoDocumentEntry entry = KoDocumentEntry::queryByMimeType( nativeFormat );
00049     if ( entry.isEmpty() )
00050     {
00051         KMessageBox::questionYesNo( 0, i18n( "Unknown KOffice MimeType %s. Check your installation.", nativeFormat ) );
00052         return QString();
00053     }
00054     KoDocument* doc = entry.createDoc( 0 );
00055     if ( doc )
00056         return '/' + doc->objectName();
00057     else
00058         return QString();
00059 }
00060 
00061 QStringList KoApplicationAdaptor::getDocuments()
00062 {
00063     QStringList lst;
00064     Q3PtrList<KoDocument> *documents = KoDocument::documentList();
00065     if ( documents )
00066     {
00067       Q3PtrListIterator<KoDocument> it( *documents );
00068       for (; it.current(); ++it )
00069         lst.append( '/' + it.current()->objectName() );
00070     }
00071     return lst;
00072 }
00073 
00074 QStringList KoApplicationAdaptor::getViews()
00075 {
00076     QStringList lst;
00077     Q3PtrList<KoDocument> *documents = KoDocument::documentList();
00078     if ( documents )
00079     {
00080       Q3PtrListIterator<KoDocument> it( *documents );
00081       for (; it.current(); ++it )
00082       {
00083           foreach ( KoView* view, it.current()->views() )
00084               lst.append( '/' + view->objectName() );
00085       }
00086     }
00087     return lst;
00088 }
00089 
00090 QStringList KoApplicationAdaptor::getWindows()
00091 {
00092     QStringList lst;
00093     QList<KMainWindow*> mainWindows = KMainWindow::memberList();
00094     if ( !mainWindows.isEmpty() )
00095     {
00096         foreach ( KMainWindow* mainWindow, mainWindows )
00097             lst.append( static_cast<KoMainWindow*>(mainWindow)->objectName() );
00098     }
00099     return lst;
00100 }
00101 
00102 #include "KoApplicationAdaptor.moc"

Généré le Wed Nov 22 23:41:02 2006 pour KPlato par  doxygen 1.5.1-p1