summaryrefslogtreecommitdiffstats
path: root/src/sessiontreemodel.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-04 15:54:11 +0100
committerSimon Rettberg2016-01-04 15:54:11 +0100
commitc6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5 (patch)
tree9a9ff83d1119014dda4aa3ead0e4ef3f228a6a30 /src/sessiontreemodel.cpp
parentUpdate images (diff)
downloadvmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.tar.gz
vmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.tar.xz
vmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.zip
Icons in tabs, configurable default tab
Diffstat (limited to 'src/sessiontreemodel.cpp')
-rw-r--r--src/sessiontreemodel.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp
index aaf47b9..cf4f2cf 100644
--- a/src/sessiontreemodel.cpp
+++ b/src/sessiontreemodel.cpp
@@ -135,46 +135,46 @@ void SessionTreeModel::addLabelItem(const QString& label) {
}
void SessionTreeModel::removeItem(const QString& name) {
- for (int i = 0; i < root_->childCount(); ++i) {
- SessionTreeItem* item = root_->child(i);
- if (item->text() == name) {
- root_->removeChild(item);
- }
- }
+ for (int i = 0; i < root_->childCount(); ++i) {
+ SessionTreeItem* item = root_->child(i);
+ if (item->text() == name) {
+ root_->removeChild(item);
+ }
+ }
}
QList<Session*> SessionTreeModel::lookForItem(const QString& label) {
- QList<Session*> result;
-
- if (label.startsWith("\"")) {
- QString searchTerm = label;
- searchTerm.remove(0, 1);
- if (label.endsWith("\"")) {
- searchTerm.chop(1);
- }
- QList<QString> items;
- items.append(searchTerm);
- for (int i = 0; i < root_->childCount(); ++i) {
- SessionTreeItem* item = root_->child(i);
- if (item->session()->containsKeywords(items)) {
- result.append(const_cast<Session*>(item->session()));
- }
- }
- } else {
- QList<QString> items = label.split(" ", QString::SkipEmptyParts);
- for (int i = 0; i < root_->childCount(); ++i) {
- SessionTreeItem* item = root_->child(i);
- if (item->session()->containsKeywords(items)) {
- result.append(const_cast<Session*>(item->session()));
- }
- }
- }
-
- return result;
+ QList<Session*> result;
+
+ if (label.startsWith("\"")) {
+ QString searchTerm = label;
+ searchTerm.remove(0, 1);
+ if (label.endsWith("\"")) {
+ searchTerm.chop(1);
+ }
+ QList<QString> items;
+ items.append(searchTerm);
+ for (int i = 0; i < root_->childCount(); ++i) {
+ SessionTreeItem* item = root_->child(i);
+ if (item->session() != NULL && item->session()->containsKeywords(items)) {
+ result.append(const_cast<Session*>(item->session()));
+ }
+ }
+ } else {
+ QList<QString> items = label.split(" ", QString::SkipEmptyParts);
+ for (int i = 0; i < root_->childCount(); ++i) {
+ SessionTreeItem* item = root_->child(i);
+ if (item->session() != NULL && item->session()->containsKeywords(items)) {
+ result.append(const_cast<Session*>(item->session()));
+ }
+ }
+ }
+
+ return result;
}
void SessionTreeModel::updateView() {
- emit layoutChanged();
+ emit layoutChanged();
}