diff --git a/libs/kasten/gui/system/singledocumentstrategy_p.cpp b/libs/kasten/gui/system/singledocumentstrategy_p.cpp index b2090118..209d60c6 100644 --- a/libs/kasten/gui/system/singledocumentstrategy_p.cpp +++ b/libs/kasten/gui/system/singledocumentstrategy_p.cpp @@ -1,161 +1,161 @@ /* This file is part of the Kasten Framework, made within the KDE community. Copyright 2011 Friedrich W. H. Kossebau This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "singledocumentstrategy_p.h" // lib #include "createdialog.h" // Kasten gui #include #include #include // Kasten core #include #include #include #include #include // KF5 #include // Qt #include #include #include #include namespace Kasten { void SingleDocumentStrategyPrivate::init() { Q_Q( SingleDocumentStrategy ); // setup - QObject::connect( mDocumentManager, SIGNAL(added(QList)), - mViewManager, SLOT(createViewsFor(QList)) ); - QObject::connect( mDocumentManager, SIGNAL(closing(QList)), - mViewManager, SLOT(removeViewsFor(QList)) ); + QObject::connect( mDocumentManager, &DocumentManager::added, + mViewManager, &ViewManager::createViewsFor ); + QObject::connect( mDocumentManager, &DocumentManager::closing, + mViewManager, &ViewManager::removeViewsFor ); QObject::connect( mDocumentManager->syncManager(), &DocumentSyncManager::urlUsed, q, &SingleDocumentStrategy::urlUsed ); } void SingleDocumentStrategyPrivate::createNew() { if( mDocumentManager->isEmpty() ) mDocumentManager->createManager()->createNew(); else { const QString executable = QCoreApplication::applicationFilePath(); // TODO: get parameters from common place with KCmdLineOptions // TODO: forward also interesting parameters passed to this program const QStringList parameters = QStringList() << QStringLiteral( "-c" ); KProcess::startDetached( executable, parameters ); } } void SingleDocumentStrategyPrivate::createNewFromClipboard() { if( mDocumentManager->isEmpty() ) { const QMimeData* mimeData = QApplication::clipboard()->mimeData( QClipboard::Clipboard ); mDocumentManager->createManager()->createNewFromData( mimeData, true ); } else { const QString executable = QCoreApplication::applicationFilePath(); // TODO: get parameters from common place with KCmdLineOptions // TODO: forward also interesting parameters passed to this program const QStringList parameters = QStringList() << QStringLiteral( "-c" ) << QStringLiteral( "-g" ) << QStringLiteral( "FromClipboard" ); KProcess::startDetached( executable, parameters ); } } void SingleDocumentStrategyPrivate::createNewWithGenerator( AbstractModelDataGenerator* generator ) { Q_Q( SingleDocumentStrategy ); // TODO: show dialog in this process, meanwhile start other process, but hidden, // on result of dialog pass on the parameters if( ! mDocumentManager->isEmpty() ) { const QString executable = QCoreApplication::applicationFilePath(); // TODO: get parameters from common place with KCmdLineOptions // TODO: forward also interesting parameters passed to this program // TODO: add id to AbstractModelDataGenerator, to use instead of className const QStringList parameters = QStringList() << QStringLiteral( "-c" ) << QStringLiteral( "-g" ) << QLatin1String(generator->metaObject()->className()); KProcess::startDetached( executable, parameters ); return; } AbstractModelDataGeneratorConfigEditor* configEditor = mViewManager->codecViewManager()->createConfigEditor( generator ); if( configEditor ) { // TODO: make dialog abstract for different UIs CreateDialog* dialog = new CreateDialog( configEditor ); // dialog->setData( mModel, selection ); TODO if( ! dialog->exec() ) return; } QApplication::setOverrideCursor( Qt::WaitCursor ); ModelDataGenerateThread* generateThread = new ModelDataGenerateThread( q, generator ); generateThread->start(); while( !generateThread->wait(100) ) QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers ); QMimeData* mimeData = generateThread->data(); delete generateThread; const bool setModified = ( generator->flags() & AbstractModelDataGenerator::DynamicGeneration ); mDocumentManager->createManager()->createNewFromData( mimeData, setModified ); QApplication::restoreOverrideCursor(); } void SingleDocumentStrategyPrivate::load( const QUrl& url ) { if( mDocumentManager->isEmpty() ) mDocumentManager->syncManager()->load( url ); else { const QString executable = QCoreApplication::applicationFilePath(); // TODO: get parameters from common place with KCmdLineOptions // TODO: forward also interesting parameters passed to this program const QStringList parameters = QStringList() << url.url(); KProcess::startDetached( executable, parameters ); } } }