[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/krdc
From:       Tony Murray <murraytony () gmail ! com>
Date:       2010-12-21 7:14:42
Message-ID: 20101221071442.439C0AC8AB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208291 by murrant:

Bookmark Title cleanup 
* don't shorten titles with ..., use fullText()
* do not use percent encoded urls in bookmark titles
* convert filterable items to non-percent encoded characters (allows us to filter as \
typed without any tricks)


 M  +1 -1      bookmarkmanager.cpp  
 M  +3 -10     mainwindow.cpp  
 M  +0 -1      mainwindow.h  
 M  +3 -3      remotedesktopsmodel.cpp  


--- trunk/KDE/kdenetwork/krdc/bookmarkmanager.cpp #1208290:1208291
@@ -121,7 +121,7 @@
 
 QString BookmarkManager::currentTitle() const
 {
-    return currentUrl();
+    return QUrl::fromPercentEncoding(currentUrl().toUtf8());
 }
 
 bool BookmarkManager::supportsTabs() const
--- trunk/KDE/kdenetwork/krdc/mainwindow.cpp #1208290:1208291
@@ -75,8 +75,6 @@
 #include <QToolBar>
 #include <QVBoxLayout>
 
-static const QByteArray FILTER_EXCLUSIONS = "@/:";
-
 MainWindow::MainWindow(QWidget *parent)
         : KXmlGuiWindow(parent),
         m_fullscreenWindow(0),
@@ -1107,7 +1105,7 @@
         m_addressInput = new KLineEdit(m_newConnectionWidget);
         m_addressInput->setClearButtonShown(true);
         m_addressInput->setClickMessage(i18n("Type here to connect to an address and \
                filter the list."));
-        connect(m_addressInput, SIGNAL(textChanged(const QString &)), \
SLOT(updateFilter(const QString &))); +        connect(m_addressInput, \
SIGNAL(textChanged(const QString &)), m_remoteDesktopsModelProxy, \
SLOT(setFilterFixedString(const QString &)));  
         foreach(RemoteViewFactory *factory, m_remoteViewFactories) {
             m_protocolInput->addItem(factory->scheme());
@@ -1194,12 +1192,6 @@
     return m_currentRemoteView;
 }
 
-void MainWindow::updateFilter(const QString &text)
-{
-    // use QUrl::toPercentEncoding() to match KUrl::prettyUrl()
-    m_remoteDesktopsModelProxy->setFilterRegExp(QRegExp("IGNORE|" + \
QUrl::toPercentEncoding(text, FILTER_EXCLUSIONS), Qt::CaseInsensitive, \
                QRegExp::RegExp));
-}
-
 void MainWindow::createDockWidget()
 {
     QDockWidget *remoteDesktopsDockWidget = new QDockWidget(this);
@@ -1216,6 +1208,7 @@
     RemoteDesktopsModel *remoteDesktopsModel = new RemoteDesktopsModel(this);
     m_remoteDesktopsModelProxy = new QSortFilterProxyModel(this);
     m_remoteDesktopsModelProxy->setSourceModel(remoteDesktopsModel);
+    m_remoteDesktopsModelProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
     m_remoteDesktopsModelProxy->setFilterRole(10002);
     m_dockWidgetTableView->setModel(m_remoteDesktopsModelProxy);
 
@@ -1238,7 +1231,7 @@
     KLineEdit *filterLineEdit = new KLineEdit(remoteDesktopsDockLayoutWidget);
     filterLineEdit->setClickMessage(i18n("Filter"));
     filterLineEdit->setClearButtonShown(true);
-    connect(filterLineEdit, SIGNAL(textChanged(const QString &)), \
SLOT(updateFilter(const QString &))); +    connect(filterLineEdit, \
SIGNAL(textChanged(const QString &)), m_remoteDesktopsModelProxy, \
SLOT(setFilterFixedString(const QString &)));  \
remoteDesktopsDockLayout->addWidget(filterLineEdit);  \
remoteDesktopsDockLayout->addWidget(m_dockWidgetTableView);  \
                remoteDesktopsDockWidget->setWidget(remoteDesktopsDockLayoutWidget);
--- trunk/KDE/kdenetwork/krdc/mainwindow.h #1208290:1208291
@@ -104,7 +104,6 @@
     QWidget* newConnectionWidget();
     void newConnectionPage();
     void openFromRemoteDesktopsModel(const QModelIndex &index);
-    void updateFilter(const QString &text);
     void createDockWidget();
     void showConnectionContextMenu(const QPoint &pos);
     void saveConnectionListSort(const int logicalindex, const Qt::SortOrder order);
--- trunk/KDE/kdenetwork/krdc/remotedesktopsmodel.cpp #1208290:1208291
@@ -160,7 +160,7 @@
         return item.url;
 
     case 10002: //filter
-        return item.url + item.title; // return both uservisible and data
+        return QUrl::fromPercentEncoding((item.url + item.title).toUtf8()); // \
return both user visible title and url data, percent encoded  
     case 10003: //title for dockwidget
         return item.title;
@@ -223,7 +223,7 @@
         } else { // not a group
 
             RemoteDesktop item;
-            item.title = bm.text();
+            item.title = bm.fullText();
             item.url = bm.url().url();
             int index = remoteDesktops.indexOf(item); //search for this url to see \
if we need to update it  bool newItem = index < 0; // do we need to create a new \
item? @@ -259,7 +259,7 @@
                     item.source = RemoteDesktop::Bookmarks;
                 } else {
                     // otherwise override these fields with the info from the \
                bookmark
-                    remoteDesktops[index].title = bm.text();
+                    remoteDesktops[index].title = bm.fullText();
                     remoteDesktops[index].favorite = true;
                     remoteDesktops[index].source = RemoteDesktop::Bookmarks;
                 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic