summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dialog.cpp8
-rw-r--r--src/sessiontreemodel.cpp68
-rw-r--r--src/ui/dialog.ui6
3 files changed, 41 insertions, 41 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 8572c67..4179afd 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -161,6 +161,7 @@ void Dialog::addItems(const QList<Session*>& entries, int tab) {
}
model_[tab]->updateView();
selectPreviousSession();
+ on_filterEdit_textChanged();
}
void Dialog::addStatusString(const int status) {
@@ -353,9 +354,6 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) {
this->addStatusString(STR_NO_ITEMS);
}
- // give focus to treeView
- ui->treeView->setFocus();
-
// select last-session
selectPreviousSession();
userInteracted_ = true;
@@ -432,7 +430,9 @@ void Dialog::onTabButtonChanged(int tab) {
}
// give focus to treeView
- ui->treeView->setFocus();
+ if (!ui->filterEdit->hasFocus()) {
+ ui->treeView->setFocus();
+ }
// Update pressed status of buttons
for (int i = 0; i < 3; ++i) {
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();
}
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 5be8154..0ac918b 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -133,7 +133,7 @@ margin-bottom:0px;}</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt;&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Loading...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -165,7 +165,7 @@ p, li { white-space: pre-wrap; }
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt;&quot;&gt;Loading...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Loading...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -487,7 +487,7 @@ border:1px solid #999;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;Click on an item on the left side for more infos.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Click on an item on the left side for more information&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>