diff options
Diffstat (limited to 'akonadish/syntax_modules/akonadi_list.cpp')
-rw-r--r-- | akonadish/syntax_modules/akonadi_list.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
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) |