KFile
kfilebookmarkhandler.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation, version 2. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "kfilebookmarkhandler_p.h" 00020 00021 #include <stdio.h> 00022 #include <stdlib.h> 00023 00024 #include <kbookmarkimporter.h> 00025 #include <kbookmarkdombuilder.h> 00026 #include <kmenu.h> 00027 #include <kstandarddirs.h> 00028 00029 #include "kfilewidget.h" 00030 00031 KFileBookmarkHandler::KFileBookmarkHandler( KFileWidget *widget ) 00032 : QObject( widget ), 00033 KBookmarkOwner(), 00034 m_widget( widget ) 00035 { 00036 setObjectName( "KFileBookmarkHandler" ); 00037 m_menu = new KMenu( widget ); 00038 m_menu->setObjectName( "bookmark menu" ); 00039 00040 QString file = KStandardDirs::locate( "data", "kfile/bookmarks.xml" ); 00041 if ( file.isEmpty() ) 00042 file = KStandardDirs::locateLocal( "data", "kfile/bookmarks.xml" ); 00043 00044 KBookmarkManager *manager = KBookmarkManager::managerForFile( file, "kfile" ); 00045 manager->setUpdate( true ); 00046 00047 m_bookmarkMenu = new KBookmarkMenu( manager, this, m_menu, 00048 widget->actionCollection() ); 00049 } 00050 00051 KFileBookmarkHandler::~KFileBookmarkHandler() 00052 { 00053 delete m_bookmarkMenu; 00054 } 00055 00056 void KFileBookmarkHandler::openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::KeyboardModifiers) 00057 { 00058 emit openUrl( bm.url().url() ); 00059 } 00060 00061 QString KFileBookmarkHandler::currentUrl() const 00062 { 00063 return m_widget->baseUrl().url(); 00064 } 00065 00066 QString KFileBookmarkHandler::currentTitle() const 00067 { 00068 return m_widget->baseUrl().prettyUrl(); 00069 } 00070 00071 #include "kfilebookmarkhandler_p.moc"
KDE 4.6 API Reference