File indexing completed on 2024-12-22 04:57:17

0001 /*
0002    SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003    SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0004 
0005    SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include <QApplication>
0009 #include <QDebug>
0010 
0011 #include "imapaccount.h"
0012 #include "subscriptiondialog.h"
0013 
0014 int main(int argc, char **argv)
0015 {
0016     QApplication app(argc, argv);
0017 
0018     if (app.arguments().size() < 5) {
0019         qWarning("Not enough parameters, expecting: <server> <port> <user> <password>");
0020         return 1;
0021     }
0022 
0023     const QString server = app.arguments().at(1);
0024     const int port = app.arguments().at(2).toInt();
0025     const QString user = app.arguments().at(3);
0026     const QString password = app.arguments().at(4);
0027 
0028     qDebug() << "Querying:" << server << port << user << password;
0029     qDebug();
0030 
0031     ImapAccount account;
0032     account.setServer(server);
0033     account.setPort(port);
0034     account.setUserName(user);
0035 
0036     auto dialog = new SubscriptionDialog();
0037     dialog->connectAccount(account, password);
0038 
0039     dialog->show();
0040 
0041     int retcode = app.exec();
0042 
0043     qDebug() << "Subscription changed?" << dialog->isSubscriptionChanged();
0044 
0045     return retcode;
0046 }