Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2b2e08a9 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Port to QCommandParser

parent 89bc1db3
......@@ -1287,8 +1287,8 @@ bool KopeteChatWindow::queryClose()
bool KopeteChatWindow::queryExit()
{
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (app->sessionSaving()
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (app->isSavingSession()
|| app->isShuttingDown() /* only set if KopeteApplication::quitKopete() or
KopeteApplication::commitData() called */
|| !Kopete::BehaviorSettings::self()->showSystemTray() /* also close if our tray icon is hidden! */
......@@ -1304,8 +1304,8 @@ void KopeteChatWindow::closeEvent(QCloseEvent *e)
{
// if there's a system tray applet and we are not shutting down then just do what needs to be done if a
// window is closed.
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (Kopete::BehaviorSettings::self()->showSystemTray() && !app->isShuttingDown() && !app->sessionSaving()) {
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (Kopete::BehaviorSettings::self()->showSystemTray() && !app->isShuttingDown() && !app->isSavingSession()) {
// hide();
// BEGIN of code borrowed from KMainWindow::closeEvent
// Save settings if auto-save is enabled, and settings have changed
......
......@@ -53,8 +53,8 @@
#include "kopeteidentitymanager.h"
#include "kopetedbusinterface.h"
KopeteApplication::KopeteApplication()
: KUniqueApplication(true, true)
KopeteApplication::KopeteApplication(int &argc, char *argv[])
: QApplication(argc, argv)
{
m_isShuttingDown = false;
......@@ -151,7 +151,7 @@ void KopeteApplication::slotLoadPlugins()
KSharedConfig::Ptr config = KSharedConfig::openConfig();
// Parse command-line arguments
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//FIXME KF5 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
bool showConfigDialog = false;
......@@ -179,6 +179,7 @@ void KopeteApplication::slotLoadPlugins()
*/
// Prevent plugins from loading? (--disable=foo,bar)
#if 0//FIXME KF5
foreach (const QString &disableArg, args->getOption("disable").split(',')) {
showConfigDialog = false;
Kopete::PluginManager::self()->setPluginEnabled(disableArg, false);
......@@ -192,11 +193,12 @@ void KopeteApplication::slotLoadPlugins()
Kopete::PluginManager::self()->setPluginEnabled(plugin, true);
}
}
#endif
config->sync();
// Disable plugins altogether? (--noplugins)
if (!args->isSet("plugins")) {
if (/*!args->isSet("plugins")*/1) { //KF5 FIXME
// If anybody reenables this I'll get a sword and make a nice chop-suy out
// of your body :P [mETz - 29.05.2004]
// This screws up kopeterc because there is no way to get the Plugins group back!
......@@ -232,19 +234,20 @@ void KopeteApplication::slotLoadPlugins()
void KopeteApplication::slotAllPluginsLoaded()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//FIXME KF5 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//FIXME: this should probably ask for the identities to connect instead of all accounts
// --noconnect not specified?
Kopete::OnlineStatusManager::Category initStatus = Kopete::OnlineStatusManager::self()->initialStatus();
Kopete::OnlineStatusManager::Category setStatus = Kopete::OnlineStatusManager::Offline;
#if 0 //FIXME
if (args->isSet("connect") && initStatus != Kopete::OnlineStatusManager::Offline
&& (Solid::Networking::status() == Solid::Networking::Unknown
|| Solid::Networking::status() == Solid::Networking::Connected)) {
setStatus = initStatus;
}
#endif
QList <Kopete::Status::StatusItem *> statusList = Kopete::StatusManager::self()->getRootGroup()->childList();
QString message, title;
......@@ -273,7 +276,8 @@ void KopeteApplication::slotAllPluginsLoaded()
}
kDebug(14000)<< "initial status set in config: " << initStatus;
//FIXME KF5
#if 0
QStringList connectArgs = args->getOptionList("autoconnect");
// toConnect will contain all the protocols to connect to
......@@ -315,8 +319,10 @@ void KopeteApplication::slotAllPluginsLoaded()
// Parse any passed URLs/files
handleURLArgs();
#endif
}
#if 0
int KopeteApplication::newInstance()
{
// kDebug(14000) ;
......@@ -324,9 +330,11 @@ int KopeteApplication::newInstance()
return KUniqueApplication::newInstance();
}
#endif
void KopeteApplication::handleURLArgs()
{
#if 0
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
// kDebug(14000) << "called with " << args->count() << " arguments to handle.";
......@@ -340,6 +348,7 @@ void KopeteApplication::handleURLArgs()
Kopete::MimeTypeHandler::dispatchURL(u);
} // END for()
} // END args->count() > 0
#endif
}
void KopeteApplication::quitKopete()
......@@ -370,7 +379,7 @@ void KopeteApplication::quitKopete()
void KopeteApplication::commitData(QSessionManager &sm)
{
m_isShuttingDown = true;
KUniqueApplication::commitData(sm);
//FIXME KUniqueApplication::commitData(sm);
}
// vim: set noet ts=4 sts=4 sw=4:
......@@ -22,7 +22,7 @@
#include <qpointer.h>
#include <kuniqueapplication.h>
#include <QApplication>
class KopeteWindow;
class QSessionManager;
......@@ -35,12 +35,12 @@ class FileEngineHandler;
/**
* @author Duncan Mac-Vicar P. <duncan@kde.org>
*/
class KopeteApplication : public KUniqueApplication
class KopeteApplication : public QApplication
{
Q_OBJECT
public:
KopeteApplication();
KopeteApplication(int &argc, char *argv[]);
~KopeteApplication();
/**
......@@ -52,7 +52,7 @@ public:
return m_isShuttingDown;
}
int newInstance() Q_DECL_OVERRIDE;
//FIXME int newInstance() Q_DECL_OVERRIDE;
public slots:
/**
......
......@@ -284,7 +284,7 @@ KopeteWindow::KopeteWindow (QWidget *parent)
, d(new Private)
{
d->appDestroyed = false;
connect(kapp, SIGNAL(destroyed()), this, SLOT(slotAppDestroyed()));
connect(qApp, SIGNAL(destroyed()), this, SLOT(slotAppDestroyed()));
setAttribute(Qt::WA_DeleteOnClose, false);
setAttribute(Qt::WA_QuitOnClose, false);
// Applications should ensure that their StatusBar exists before calling createGUI()
......@@ -833,8 +833,8 @@ void KopeteWindow::slotDisconnectAll()
bool KopeteWindow::queryClose()
{
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (app->sessionSaving() || app->isShuttingDown()) {
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (app->isSavingSession() || app->isShuttingDown()) {
// we are shutting down, don't show any message
return true;
}
......@@ -881,8 +881,8 @@ bool KopeteWindow::shouldExitOnClose() const
bool KopeteWindow::queryExit()
{
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (app->sessionSaving()
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (app->isSavingSession()
|| app->isShuttingDown() /* only set if KopeteApplication::quitKopete() or
KopeteApplication::commitData() called */
|| shouldExitOnClose()
......@@ -904,8 +904,8 @@ void KopeteWindow::closeEvent(QCloseEvent *e)
{
// if we are not ok to exit on close and we are not shutting down then just do what needs to be done if a
// window is closed.
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (!shouldExitOnClose() && !app->isShuttingDown() && !app->sessionSaving()) {
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (!shouldExitOnClose() && !app->isShuttingDown() && !app->isSavingSession()) {
// BEGIN of code borrowed from KMainWindow::closeEvent
// Save settings if auto-save is enabled, and settings have changed
if (settingsDirty() && autoSaveSettings()) {
......@@ -925,7 +925,7 @@ void KopeteWindow::closeEvent(QCloseEvent *e)
void KopeteWindow::slotQuit()
{
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
app->quitKopete();
if (d->tray && app->isShuttingDown()) {
......@@ -1018,8 +1018,8 @@ void KopeteWindow::slotIdentityToolTipChanged(Kopete::Identity *identity)
return;
}
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (app->sessionSaving() || app->isShuttingDown()) {
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (app->isSavingSession() || app->isShuttingDown()) {
return;
}
......@@ -1051,8 +1051,8 @@ void KopeteWindow::slotIdentityStatusIconChanged(Kopete::Identity *identity)
return;
}
KopeteApplication *app = static_cast<KopeteApplication *>(kapp);
if (app->sessionSaving() || app->isShuttingDown()) {
KopeteApplication *app = static_cast<KopeteApplication *>(qApp);
if (app->isSavingSession() || app->isShuttingDown()) {
return;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment