Changeset View
Changeset View
Standalone View
Standalone View
bookmarkowner.cpp
Show All 17 Lines | 1 | /* | |||
---|---|---|---|---|---|
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | MA 02110-1301, USA | 19 | MA 02110-1301, USA | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "bookmarkowner.h" | 22 | #include "bookmarkowner.h" | ||
23 | 23 | | |||
24 | #include "view.h" | 24 | #include "view.h" | ||
25 | 25 | | |||
26 | #include <dom/html_document.h> | | |||
27 | | ||||
28 | using namespace KHC; | 26 | using namespace KHC; | ||
29 | 27 | | |||
30 | BookmarkOwner::BookmarkOwner( View *view, QObject *parent ) | 28 | BookmarkOwner::BookmarkOwner( View *view, QObject *parent ) | ||
31 | : QObject( parent ), KBookmarkOwner() | 29 | : QObject( parent ), KBookmarkOwner() | ||
32 | , mView( view ) | 30 | , mView( view ) | ||
33 | { | 31 | { | ||
34 | } | 32 | } | ||
35 | 33 | | |||
36 | BookmarkOwner::~BookmarkOwner() | 34 | BookmarkOwner::~BookmarkOwner() | ||
37 | { | 35 | { | ||
38 | } | 36 | } | ||
39 | 37 | | |||
40 | QString BookmarkOwner::currentTitle() const | 38 | QString BookmarkOwner::currentTitle() const | ||
41 | { | 39 | { | ||
42 | return currentUrl().isValid() ? mView->htmlDocument().title().string() : QString(); | 40 | return currentUrl().isValid() ? mView->title() : QString(); | ||
43 | } | 41 | } | ||
44 | 42 | | |||
45 | QUrl BookmarkOwner::currentUrl() const | 43 | QUrl BookmarkOwner::currentUrl() const | ||
46 | { | 44 | { | ||
47 | const QUrl url = mView->baseURL(); | 45 | const QUrl url = mView->url(); | ||
48 | // khelpcenter: URLs are internal, hence to not bookmark | 46 | // khelpcenter: URLs are internal, hence to not bookmark | ||
49 | return url.scheme() == QLatin1String( "khelpcenter" ) ? QUrl() : url; | 47 | return url.scheme() == QLatin1String( "khelpcenter" ) ? QUrl() : url; | ||
50 | } | 48 | } | ||
51 | 49 | | |||
52 | void BookmarkOwner::openBookmark( const KBookmark& bm, Qt::MouseButtons /*mb*/, Qt::KeyboardModifiers /*km*/ ) | 50 | void BookmarkOwner::openBookmark( const KBookmark& bm, Qt::MouseButtons /*mb*/, Qt::KeyboardModifiers /*km*/ ) | ||
53 | { | 51 | { | ||
54 | if ( !bm.url().isValid() ) { | 52 | if ( !bm.url().isValid() ) { | ||
55 | return; | 53 | return; | ||
56 | } | 54 | } | ||
57 | 55 | | |||
58 | emit openUrl( bm.url() ); | 56 | emit openUrl( bm.url() ); | ||
59 | } | 57 | } |