]> git.sur5r.net Git - minitube/commitdiff
Search for a YouTube URL
authorFlavio <flavio@odisseo.local>
Fri, 10 Dec 2010 09:45:24 +0000 (10:45 +0100)
committerFlavio <flavio@odisseo.local>
Fri, 10 Dec 2010 09:45:24 +0000 (10:45 +0100)
src/ListModel.cpp
src/SearchView.cpp

index 761e5a4bff6c200c8ed49dba0bfdff35751b4408..1c146eec728e1fbf0eedf47397f0c167c3586b78 100755 (executable)
@@ -202,6 +202,10 @@ void ListModel::addVideo(Video* video) {
 
         // save keyword
         QString query = searchParams->keywords();
+        if (query.startsWith("http://")) {
+            // Save the video title
+            query += "|" + videos.first()->title();
+        }
         QSettings settings;
         QStringList keywords = settings.value(recentKeywordsKey).toStringList();
         keywords.removeAll(query);
index d1907f0d68215f2d4f876273f6b664f0586b304e..76f7da4abe9980b65789db1f3b7c1b6bda2e717f 100644 (file)
@@ -135,9 +135,18 @@ void SearchView::updateRecentKeywords() {
     The::globalActions()->value("clearRecentKeywords")->setEnabled(!keywords.isEmpty());
 
     foreach (QString keyword, keywords) {
-        QLabel *itemLabel = new QLabel("<a href=\"" + keyword
+        QString link = keyword;
+        QString display = keyword;
+        if (keyword.startsWith("http://")) {
+            int separator = keyword.indexOf("|");
+            if (separator > 0 && separator + 1 < keyword.length()) {
+                link = keyword.left(separator);
+                display = keyword.mid(separator+1);
+            }
+        }
+        QLabel *itemLabel = new QLabel("<a href=\"" + link
                                        + "\" style=\"color:palette(text); text-decoration:none\">"
-                                       + keyword + "</a>", this);
+                                       + display + "</a>", this);
 
         itemLabel->setMaximumWidth(queryEdit->width() + watchButton->width());
         // itemLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);