diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-28 22:51:43 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-28 22:51:43 +0100 |
commit | 1998b8d35478205118cea5cc215c682b235434f1 (patch) | |
tree | 7a0f04f8b52843d9cbdb622d476a90604c48ff7a /akonadish/syntax_modules | |
parent | ac0e1de3a3895b0e62231364499a2c3327fd74f0 (diff) | |
parent | cc5363fe4b0cd4ea95ac98d9d37f2028fe226145 (diff) | |
download | sink-1998b8d35478205118cea5cc215c682b235434f1.tar.gz sink-1998b8d35478205118cea5cc215c682b235434f1.zip |
Merge branch 'develop' of git://anongit.kde.org/akonadi-next into develop
Diffstat (limited to 'akonadish/syntax_modules')
-rw-r--r-- | akonadish/syntax_modules/akonadi_clear.cpp | 6 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_count.cpp | 6 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_list.cpp | 11 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_modify.cpp | 9 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_remove.cpp | 9 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_stat.cpp | 6 | ||||
-rw-r--r-- | akonadish/syntax_modules/akonadi_sync.cpp | 6 | ||||
-rw-r--r-- | akonadish/syntax_modules/core_syntax.cpp | 2 |
8 files changed, 25 insertions, 30 deletions
diff --git a/akonadish/syntax_modules/akonadi_clear.cpp b/akonadish/syntax_modules/akonadi_clear.cpp index d17fac2..d328849 100644 --- a/akonadish/syntax_modules/akonadi_clear.cpp +++ b/akonadish/syntax_modules/akonadi_clear.cpp | |||
@@ -50,10 +50,10 @@ bool clear(const QStringList &args, State &state) | |||
50 | 50 | ||
51 | Syntax::List syntax() | 51 | Syntax::List syntax() |
52 | { | 52 | { |
53 | Syntax::List syntax; | 53 | Syntax clear("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &AkonadiClear::clear); |
54 | syntax << Syntax("clear", QObject::tr("Clears the local cache of one or more resources (be careful!)"), &AkonadiClear::clear); | 54 | clear.completer = &AkonadishUtils::resourceCompleter; |
55 | 55 | ||
56 | return syntax; | 56 | return Syntax::List() << clear; |
57 | } | 57 | } |
58 | 58 | ||
59 | REGISTER_SYNTAX(AkonadiClear) | 59 | REGISTER_SYNTAX(AkonadiClear) |
diff --git a/akonadish/syntax_modules/akonadi_count.cpp b/akonadish/syntax_modules/akonadi_count.cpp index cda7235..5acdcdd 100644 --- a/akonadish/syntax_modules/akonadi_count.cpp +++ b/akonadish/syntax_modules/akonadi_count.cpp | |||
@@ -74,10 +74,10 @@ bool count(const QStringList &args, State &state) | |||
74 | 74 | ||
75 | Syntax::List syntax() | 75 | Syntax::List syntax() |
76 | { | 76 | { |
77 | Syntax::List syntax; | 77 | Syntax count("count", QObject::tr("Returns the number of items of a given type in a resource. Usage: count <type> <resource>"), &AkonadiCount::count, Syntax::EventDriven); |
78 | syntax << Syntax("count", QObject::tr("Returns the number of items of a given type in a resource. Usage: count <type> <resource>"), &AkonadiCount::count, Syntax::EventDriven); | 78 | count.completer = &AkonadishUtils::typeCompleter; |
79 | 79 | ||
80 | return syntax; | 80 | return Syntax::List() << count; |
81 | } | 81 | } |
82 | 82 | ||
83 | REGISTER_SYNTAX(AkonadiCount) | 83 | REGISTER_SYNTAX(AkonadiCount) |
diff --git a/akonadish/syntax_modules/akonadi_list.cpp b/akonadish/syntax_modules/akonadi_list.cpp index 807119c..82f13b5 100644 --- a/akonadish/syntax_modules/akonadi_list.cpp +++ b/akonadish/syntax_modules/akonadi_list.cpp | |||
@@ -72,7 +72,6 @@ bool list(const QStringList &args, State &state) | |||
72 | 72 | ||
73 | //qDebug() << "Listing"; | 73 | //qDebug() << "Listing"; |
74 | int colSize = 38; //Necessary to display a complete UUID | 74 | int colSize = 38; //Necessary to display a complete UUID |
75 | state.print(" " + QObject::tr("Column") + " "); | ||
76 | state.print(QObject::tr("Resource").leftJustified(colSize, ' ', true) + | 75 | state.print(QObject::tr("Resource").leftJustified(colSize, ' ', true) + |
77 | QObject::tr("Identifier").leftJustified(colSize, ' ', true)); | 76 | QObject::tr("Identifier").leftJustified(colSize, ' ', true)); |
78 | for (int i = 0; i < model->columnCount(QModelIndex()); i++) { | 77 | for (int i = 0; i < model->columnCount(QModelIndex()); i++) { |
@@ -82,9 +81,8 @@ bool list(const QStringList &args, State &state) | |||
82 | 81 | ||
83 | QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model, colSize, state](const QModelIndex &index, int start, int end) { | 82 | QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model, colSize, state](const QModelIndex &index, int start, int end) { |
84 | for (int i = start; i <= end; i++) { | 83 | for (int i = start; i <= end; i++) { |
85 | state.print(" " + QObject::tr("Row %1").arg(QString::number(model->rowCount())).rightJustified(4, ' ') + ": "); | ||
86 | auto object = model->data(model->index(i, 0, index), Akonadi2::Store::DomainObjectBaseRole).value<Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr>(); | 84 | auto object = model->data(model->index(i, 0, index), Akonadi2::Store::DomainObjectBaseRole).value<Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr>(); |
87 | state.print(" " + object->resourceInstanceIdentifier().leftJustified(colSize, ' ', true)); | 85 | state.print(object->resourceInstanceIdentifier().leftJustified(colSize, ' ', true)); |
88 | state.print(object->identifier().leftJustified(colSize, ' ', true)); | 86 | state.print(object->identifier().leftJustified(colSize, ' ', true)); |
89 | for (int col = 0; col < model->columnCount(QModelIndex()); col++) { | 87 | for (int col = 0; col < model->columnCount(QModelIndex()); col++) { |
90 | state.print(" | " + model->data(model->index(i, col, index)).toString().leftJustified(colSize, ' ', true)); | 88 | state.print(" | " + model->data(model->index(i, col, index)).toString().leftJustified(colSize, ' ', true)); |
@@ -108,10 +106,9 @@ bool list(const QStringList &args, State &state) | |||
108 | 106 | ||
109 | Syntax::List syntax() | 107 | Syntax::List syntax() |
110 | { | 108 | { |
111 | Syntax::List syntax; | 109 | Syntax list("list", QObject::tr("List all resources, or the contents of one or more resources"), &AkonadiList::list, Syntax::EventDriven); |
112 | syntax << Syntax("list", QObject::tr("List all resources, or the contents of one or more resources"), &AkonadiList::list, Syntax::EventDriven); | 110 | list.completer = &AkonadishUtils::resourceOrTypeCompleter; |
113 | 111 | return Syntax::List() << list; | |
114 | return syntax; | ||
115 | } | 112 | } |
116 | 113 | ||
117 | REGISTER_SYNTAX(AkonadiList) | 114 | REGISTER_SYNTAX(AkonadiList) |
diff --git a/akonadish/syntax_modules/akonadi_modify.cpp b/akonadish/syntax_modules/akonadi_modify.cpp index 8438301..76a7f5e 100644 --- a/akonadish/syntax_modules/akonadi_modify.cpp +++ b/akonadish/syntax_modules/akonadi_modify.cpp | |||
@@ -107,13 +107,12 @@ bool resource(const QStringList &args, State &state) | |||
107 | 107 | ||
108 | Syntax::List syntax() | 108 | Syntax::List syntax() |
109 | { | 109 | { |
110 | Syntax::List syntax; | ||
111 | |||
112 | Syntax modify("modify", QObject::tr("Modify items in a resource"), &AkonadiModify::modify); | 110 | Syntax modify("modify", QObject::tr("Modify items in a resource"), &AkonadiModify::modify); |
113 | modify.children << Syntax("resource", QObject::tr("Modify a resource"), &AkonadiModify::resource);//, Syntax::EventDriven); | 111 | Syntax resource("resource", QObject::tr("Modify a resource"), &AkonadiModify::resource);//, Syntax::EventDriven); |
112 | resource.completer = &AkonadishUtils::resourceOrTypeCompleter; | ||
113 | modify.children << resource; | ||
114 | 114 | ||
115 | syntax << modify; | 115 | return Syntax::List() << modify; |
116 | return syntax; | ||
117 | } | 116 | } |
118 | 117 | ||
119 | REGISTER_SYNTAX(AkonadiModify) | 118 | REGISTER_SYNTAX(AkonadiModify) |
diff --git a/akonadish/syntax_modules/akonadi_remove.cpp b/akonadish/syntax_modules/akonadi_remove.cpp index bf09e2e..9691d78 100644 --- a/akonadish/syntax_modules/akonadi_remove.cpp +++ b/akonadish/syntax_modules/akonadi_remove.cpp | |||
@@ -97,13 +97,12 @@ bool resource(const QStringList &args, State &state) | |||
97 | 97 | ||
98 | Syntax::List syntax() | 98 | Syntax::List syntax() |
99 | { | 99 | { |
100 | Syntax::List syntax; | ||
101 | |||
102 | Syntax remove("remove", QObject::tr("Remove items in a resource"), &AkonadiRemove::remove); | 100 | Syntax remove("remove", QObject::tr("Remove items in a resource"), &AkonadiRemove::remove); |
103 | remove.children << Syntax("resource", QObject::tr("Removes a resource"), &AkonadiRemove::resource);//, Syntax::EventDriven); | 101 | Syntax resource("resource", QObject::tr("Removes a resource"), &AkonadiRemove::resource);//, Syntax::EventDriven); |
102 | resource.completer = &AkonadishUtils::resourceCompleter; | ||
103 | remove.children << resource; | ||
104 | 104 | ||
105 | syntax << remove; | 105 | return Syntax::List() << remove; |
106 | return syntax; | ||
107 | } | 106 | } |
108 | 107 | ||
109 | REGISTER_SYNTAX(AkonadiRemove) | 108 | REGISTER_SYNTAX(AkonadiRemove) |
diff --git a/akonadish/syntax_modules/akonadi_stat.cpp b/akonadish/syntax_modules/akonadi_stat.cpp index 0ea65dd..9270f9d 100644 --- a/akonadish/syntax_modules/akonadi_stat.cpp +++ b/akonadish/syntax_modules/akonadi_stat.cpp | |||
@@ -111,10 +111,10 @@ bool stat(const QStringList &args, State &state) | |||
111 | 111 | ||
112 | Syntax::List syntax() | 112 | Syntax::List syntax() |
113 | { | 113 | { |
114 | Syntax::List syntax; | 114 | Syntax state("stat", QObject::tr("Shows database usage for the resources requested"), &AkonadiStat::stat, Syntax::EventDriven); |
115 | syntax << Syntax("stat", QObject::tr("Shows database usage for the resources requested"), &AkonadiStat::stat, Syntax::EventDriven); | 115 | state.completer = &AkonadishUtils::resourceCompleter; |
116 | 116 | ||
117 | return syntax; | 117 | return Syntax::List() << state; |
118 | } | 118 | } |
119 | 119 | ||
120 | REGISTER_SYNTAX(AkonadiStat) | 120 | REGISTER_SYNTAX(AkonadiStat) |
diff --git a/akonadish/syntax_modules/akonadi_sync.cpp b/akonadish/syntax_modules/akonadi_sync.cpp index 1cf097d..03abbb4 100644 --- a/akonadish/syntax_modules/akonadi_sync.cpp +++ b/akonadish/syntax_modules/akonadi_sync.cpp | |||
@@ -58,10 +58,10 @@ bool sync(const QStringList &args, State &state) | |||
58 | 58 | ||
59 | Syntax::List syntax() | 59 | Syntax::List syntax() |
60 | { | 60 | { |
61 | Syntax::List syntax; | 61 | Syntax sync("sync", QObject::tr("Syncronizes all resources that are listed; and empty list triggers a syncronizaton on all resources"), &AkonadiSync::sync, Syntax::EventDriven ); |
62 | syntax << Syntax("sync", QObject::tr("Syncronizes all resources that are listed; and empty list triggers a syncronizaton on all resources"), &AkonadiSync::sync, Syntax::EventDriven ); | 62 | sync.completer = &AkonadishUtils::resourceCompleter; |
63 | 63 | ||
64 | return syntax; | 64 | return Syntax::List() << sync; |
65 | } | 65 | } |
66 | 66 | ||
67 | REGISTER_SYNTAX(AkonadiSync) | 67 | REGISTER_SYNTAX(AkonadiSync) |
diff --git a/akonadish/syntax_modules/core_syntax.cpp b/akonadish/syntax_modules/core_syntax.cpp index 31b824a..b4812df 100644 --- a/akonadish/syntax_modules/core_syntax.cpp +++ b/akonadish/syntax_modules/core_syntax.cpp | |||
@@ -76,7 +76,7 @@ bool showHelp(const QStringList &commands, State &state) | |||
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | QStringList showHelpCompleter(const QStringList &commands, const QString &fragment) | 79 | QStringList showHelpCompleter(const QStringList &commands, const QString &fragment, State &) |
80 | { | 80 | { |
81 | QStringList items; | 81 | QStringList items; |
82 | 82 | ||