Commit aa1323ba authored by Martin Klapetek's avatar Martin Klapetek
Browse files

[logviewer] Port KCmdLineArgs and friends to QCommandLineParser ...and friends

parent f87ced7b
......@@ -19,12 +19,11 @@
#include "entity-view.h"
#include <KCmdLineArgs>
#include <KTp/Logger/log-entity.h>
#include <KTp/types.h>
#include <QAbstractItemModel>
#include <QCoreApplication>
#include <TelepathyQt/Account>
......@@ -56,8 +55,10 @@ void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
}
QModelIndex selectedIndex;
if (KCmdLineArgs::parsedArgs()->count() == 1 && KTp::kpeopleEnabled()) {
const QString selectedPersonaId = KCmdLineArgs::parsedArgs()->arg(0);
QCommandLineParser parser;
if (QCoreApplication::arguments().count() == 1 && KTp::kpeopleEnabled()) {
const QString selectedPersonaId = QCoreApplication::arguments().at(0);
for (int i = start; i <= end; i++) {
const QModelIndex index = model()->index(i, 0, parent);
if (index.data(KTp::PersonIdRole).toUrl() == selectedPersonaId) {
......@@ -65,9 +66,9 @@ void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
break;
}
}
} else if (KCmdLineArgs::parsedArgs()->count() == 2) {
QString selectAccountId = KCmdLineArgs::parsedArgs()->arg(0);
QString selectContactId = KCmdLineArgs::parsedArgs()->arg(1);
} else if (QCoreApplication::arguments().count() == 2) {
QString selectAccountId = QCoreApplication::arguments().at(0);
QString selectContactId = QCoreApplication::arguments().at(1);
for (int i = start; i <= end; i++) {
QModelIndex index = model()->index(i, 0, parent);
......
......@@ -17,9 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include <KUniqueApplication>
#include <KCmdLineArgs>
#include <k4aboutdata.h>
#include <QApplication>
#include <QCommandLineParser>
#include <KAboutData>
#include <KLocalizedString>
#include "log-viewer.h"
#include "../ktptextui_version.h"
......@@ -33,26 +35,31 @@ Q_LOGGING_CATEGORY(KTP_LOGVIEWER, "ktp-logviewer")
int main(int argc, char *argv[])
{
K4AboutData aboutData("ktp-log-viewer",
0,
ki18n("KDE IM Log Viewer"),
KTP_TEXT_UI_VERSION_STRING);
aboutData.addAuthor(ki18n("David Edmundson"), ki18n("Developer"), "kde@davidedmundson.co.uk");
aboutData.addAuthor(ki18n("Daniele E. Domenichelli"), ki18n("Developer"), "daniele.domenichelli@gmail.com");
aboutData.addAuthor(ki18n("Dan Vrátil"), ki18n("Developer"), "dvratil@redhat.com");
QApplication app(argc, argv);
KAboutData aboutData("ktp-log-viewer",
i18n("KDE IM Log Viewer"),
QStringLiteral(KTP_TEXT_UI_VERSION_STRING));
aboutData.addAuthor(i18n("David Edmundson"), i18n("Developer"), "kde@davidedmundson.co.uk");
aboutData.addAuthor(i18n("Daniele E. Domenichelli"), i18n("Developer"), "daniele.domenichelli@gmail.com");
aboutData.addAuthor(i18n("Dan Vrátil"), i18n("Developer"), "dvratil@redhat.com");
aboutData.setProductName("telepathy/log-viewer"); //set the correct name for bug reporting
aboutData.setProgramIconName(QLatin1String("documentation"));
aboutData.setLicense(K4AboutData::License_GPL_V2);
aboutData.setLicense(KAboutLicense::GPL_V2);
KAboutData::setApplicationData(aboutData);
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("documentation")));
KCmdLineArgs::init(argc, argv, &aboutData);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
KCmdLineOptions options;
options.add("+accountID", ki18n("The UID of the account to preselect"));
options.add("+contactID", ki18n("The UID of the contact to preselect"));
QCommandLineOption accountId(QStringLiteral("accountID"), i18n("The UID of the account to preselect"));
QCommandLineOption contactId(QStringLiteral("contactID"), i18n("The UID of the contact to preselect"));
KCmdLineArgs::addCmdLineOptions(options);
parser.addOption(accountId);
parser.addOption(contactId);
KApplication app;
parser.process(app);
Tp::registerTypes();
......
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