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

List:       kde-commits
Subject:    Re: KDE/kdenetwork/krdc
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2012-12-30 15:51:54
Message-ID: 3066372.dFWxaeeKU7 () xps
[Download RAW message or body]

Hi Urs, are we getting this in 4.10 too?

Cheers,
  Albert

El Diumenge, 30 de desembre de 2012, a les 16:49:41, Urs Wolfer va escriure:
> SVN commit 1330195 by uwolfer:
> 
> properly synchronize connection history
> 
>  M  +19 -6     bookmarkmanager.cpp
>  M  +6 -1      bookmarkmanager.h
>  M  +1 -1      mainwindow.cpp
> 
> 
> --- trunk/KDE/kdenetwork/krdc/bookmarkmanager.cpp #1330194:1330195
> @@ -63,11 +63,13 @@
>      delete m_bookmarkMenu;
>  }
> 
> -void BookmarkManager::addHistoryBookmark()
> +void BookmarkManager::addHistoryBookmark(RemoteView *view)
>  {
>      KBookmark bm = m_historyGroup.first();
> +    const QString urlString = urlForView(view);
> +    const KUrl url = KUrl(urlString);
>      while (!bm.isNull()) {
> -        if (bm.url() == KUrl(currentUrl())) {
> +        if (bm.url() == url) {
>              kDebug(5010) << "Found URL. Move it at the history start.";
>              m_historyGroup.moveBookmark(bm, KBookmark());
>              bm.updateAccessMetadata();
> @@ -79,7 +81,7 @@
> 
>      if (bm.isNull()) {
>          kDebug(5010) << "Add new history bookmark.";
> -        bm = m_historyGroup.addBookmark(currentTitle(), currentUrl());
> +        bm = m_historyGroup.addBookmark(titleForUrl(urlString), urlString);
> bm.updateAccessMetadata();
>          m_historyGroup.moveBookmark(bm, KBookmark());
>          m_manager->emitChanged(m_historyGroup);
> @@ -113,17 +115,28 @@
>  QString BookmarkManager::currentUrl() const
>  {
>      if (m_mainWindow->currentRemoteView() >= 0)
> -        return
> m_mainWindow->remoteViewList().at(m_mainWindow->currentRemoteView()) -     
>          ->url().prettyUrl(KUrl::RemoveTrailingSlash);
> +        return
> urlForView(m_mainWindow->remoteViewList().at(m_mainWindow->currentRemoteVie
> w())); else
>          return QString();
>  }
> 
> +QString BookmarkManager::urlForView(RemoteView *view) const
> +{
> +    return view->url().prettyUrl(KUrl::RemoveTrailingSlash);
> +
> +}
> +
>  QString BookmarkManager::currentTitle() const
>  {
> -    return QUrl::fromPercentEncoding(currentUrl().toUtf8());
> +    return titleForUrl(currentUrl());
>  }
> 
> +QString BookmarkManager::titleForUrl(const QString &url) const
> +{
> +    return QUrl::fromPercentEncoding(url.toUtf8());
> +
> +}
> +
>  bool BookmarkManager::supportsTabs() const
>  {
>      return true;
> --- trunk/KDE/kdenetwork/krdc/bookmarkmanager.h #1330194:1330195
> @@ -24,6 +24,8 @@
>  #ifndef BOOKMARKMANAGER_H
>  #define BOOKMARKMANAGER_H
> 
> +#include "core/remoteview.h"
> +
>  #include <KBookmarkManager>
> 
>  class KActionCollection;
> @@ -45,7 +47,7 @@
>      virtual bool editBookmarkEntry() const;
>      virtual bool supportsTabs() const;
>      virtual QList<QPair<QString, QString> > currentBookmarkList() const;
> -    void addHistoryBookmark();
> +    void addHistoryBookmark(RemoteView *view);
>      void addManualBookmark(const QString &url, const QString &text);
>      KBookmarkManager* getManager();
>      // removes all bookmarks with url, possibly ignore the history folder
> and update it's title there if it's set @@ -62,6 +64,9 @@
>      void openFolderinTabs(const KBookmarkGroup &bookmarkGroup);
> 
>  private:
> +    QString urlForView(RemoteView *view) const;
> +    QString titleForUrl(const QString &url) const;
> +
>      KBookmarkMenu *m_bookmarkMenu;
>      KBookmarkManager *m_manager;
>      KBookmarkGroup m_historyGroup;
> --- trunk/KDE/kdenetwork/krdc/mainwindow.cpp #1330194:1330195
> @@ -471,7 +471,7 @@
>          }
> 
>          if (Settings::rememberHistory()) {
> -            m_bookmarkManager->addHistoryBookmark();
> +            m_bookmarkManager->addHistoryBookmark(view);
>          }
> 
>          break;
[prev in list] [next in list] [prev in thread] [next in thread] 

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