• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • app
kbookmarkhandler.cpp
1 /* This file is part of the KDE project
2  Copyright (C) xxxx KFile Authors
3  Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "katefileselector.h"
21 
22 #include <stdio.h>
23 #include <stdlib.h>
24 
25 #include <tqtextstream.h>
26 
27 #include <kbookmarkimporter.h>
28 #include <tdepopupmenu.h>
29 #include <ksavefile.h>
30 #include <kstandarddirs.h>
31 #include <tdediroperator.h>
32 #include <tdeaction.h>
33 
34 #include "kbookmarkhandler.h"
35 #include "kbookmarkhandler.moc"
36 
37 
38 KBookmarkHandler::KBookmarkHandler( KateFileSelector *parent, TDEPopupMenu* tdepopupmenu )
39  : TQObject( parent, "KBookmarkHandler" ),
40  KBookmarkOwner(),
41  mParent( parent ),
42  m_menu( tdepopupmenu ),
43  m_importStream( 0L )
44 {
45  if (!m_menu)
46  m_menu = new TDEPopupMenu( parent, "bookmark menu" );
47 
48  TQString file = locate( "data", "kate/fsbookmarks.xml" );
49  if ( file.isEmpty() )
50  file = locateLocal( "data", "kate/fsbookmarks.xml" );
51 
52  KBookmarkManager *manager = KBookmarkManager::managerForFile( file, false);
53  manager->setUpdate( true );
54  manager->setShowNSBookmarks( false );
55 
56  m_bookmarkMenu = new KBookmarkMenu( manager, this, m_menu, 0, true );
57 }
58 
59 KBookmarkHandler::~KBookmarkHandler()
60 {
61  // delete m_bookmarkMenu; ###
62 }
63 
64 TQString KBookmarkHandler::currentURL() const
65 {
66  return mParent->dirOperator()->url().url();
67 }
68 
69 
70 void KBookmarkHandler::slotNewBookmark( const TQString& /*text*/,
71  const TQCString& url,
72  const TQString& additionalInfo )
73 {
74  *m_importStream << "<bookmark icon=\"" << KMimeType::iconForURL( KURL( url ) );
75  *m_importStream << "\" href=\"" << TQString::fromUtf8(url) << "\">\n";
76  *m_importStream << "<title>" << (additionalInfo.isEmpty() ? TQString(TQString::fromUtf8(url)) : additionalInfo) << "</title>\n</bookmark>\n";
77 }
78 
79 void KBookmarkHandler::slotNewFolder( const TQString& text, bool /*open*/,
80  const TQString& /*additionalInfo*/ )
81 {
82  *m_importStream << "<folder icon=\"bookmark_folder\">\n<title=\"";
83  *m_importStream << text << "\">\n";
84 }
85 
86 void KBookmarkHandler::newSeparator()
87 {
88  *m_importStream << "<separator/>\n";
89 }
90 
91 void KBookmarkHandler::endFolder()
92 {
93  *m_importStream << "</folder>\n";
94 }
95 
96 void KBookmarkHandler::virtual_hook( int id, void* data )
97 { KBookmarkOwner::virtual_hook( id, data ); }
98 

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.