• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/bookmarks
 

tdeio/bookmarks

  • tdeio
  • bookmarks
kbookmarkmenu.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
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 "kbookmarkmenu.h"
21 #include "kbookmarkmenu_p.h"
22 #include "kbookmarkimporter.h"
23 #include "kbookmarkimporter_opera.h"
24 #include "kbookmarkimporter_ie.h"
25 #include "kbookmarkdrag.h"
26 
27 #include <tdeapplication.h>
28 #include <tdeconfig.h>
29 #include <kdebug.h>
30 #include <kdialogbase.h>
31 #include <kiconloader.h>
32 #include <klineedit.h>
33 #include <tdelocale.h>
34 #include <tdemessagebox.h>
35 #include <tdepopupmenu.h>
36 #include <tdestdaccel.h>
37 #include <kstdaction.h>
38 #include <kstringhandler.h>
39 
40 #include <tqclipboard.h>
41 #include <tqfile.h>
42 #include <tqheader.h>
43 #include <tqlabel.h>
44 #include <tqlayout.h>
45 #include <tqlineedit.h>
46 #include <tqlistview.h>
47 #include <tqpushbutton.h>
48 
49 #include <dptrtemplate.h>
50 
51 template class TQPtrList<KBookmarkMenu>;
52 
53 static TQString makeTextNodeMod(KBookmark bk, const TQString &m_nodename, const TQString &m_newText) {
54  TQDomNode subnode = bk.internalElement().namedItem(m_nodename);
55  if (subnode.isNull()) {
56  subnode = bk.internalElement().ownerDocument().createElement(m_nodename);
57  bk.internalElement().appendChild(subnode);
58  }
59 
60  if (subnode.firstChild().isNull()) {
61  TQDomText domtext = subnode.ownerDocument().createTextNode("");
62  subnode.appendChild(domtext);
63  }
64 
65  TQDomText domtext = subnode.firstChild().toText();
66 
67  TQString m_oldText = domtext.data();
68  domtext.setData(m_newText);
69 
70  return m_oldText;
71 }
72 
73 /********************************************************************/
74 /********************************************************************/
75 /********************************************************************/
76 
77 KBookmarkMenu::KBookmarkMenu( KBookmarkManager* mgr,
78  KBookmarkOwner * _owner, TDEPopupMenu * _parentMenu,
79  TDEActionCollection *collec, bool _isRoot, bool _add,
80  const TQString & parentAddress )
81  : TQObject(),
82  m_bIsRoot(_isRoot), m_bAddBookmark(_add),
83  m_bAddShortcuts(true),
84  m_pManager(mgr), m_pOwner(_owner),
85  m_parentMenu( _parentMenu ),
86  m_actionCollection( collec ),
87  m_parentAddress( parentAddress )
88 {
89  m_parentMenu->setKeyboardShortcutsEnabled( true );
90 
91  m_lstSubMenus.setAutoDelete( true );
92  m_actions.setAutoDelete( true );
93 
94  if (m_actionCollection)
95  {
96  m_actionCollection->setHighlightingEnabled(true);
97  disconnect( m_actionCollection, TQ_SIGNAL( actionHighlighted( TDEAction * ) ), 0, 0 );
98  connect( m_actionCollection, TQ_SIGNAL( actionHighlighted( TDEAction * ) ),
99  this, TQ_SLOT( slotActionHighlighted( TDEAction * ) ) );
100  }
101 
102  m_bNSBookmark = m_parentAddress.isNull();
103  if ( !m_bNSBookmark ) // not for the netscape bookmark
104  {
105  //kdDebug(7043) << "KBookmarkMenu::KBookmarkMenu " << this << " address : " << m_parentAddress << endl;
106 
107  connect( _parentMenu, TQ_SIGNAL( aboutToShow() ),
108  TQ_SLOT( slotAboutToShow() ) );
109 
110  if ( KBookmarkSettings::self()->m_contextmenu )
111  {
112  (void) _parentMenu->contextMenu();
113  connect( _parentMenu, TQ_SIGNAL( aboutToShowContextMenu(TDEPopupMenu*, int, TQPopupMenu*) ),
114  this, TQ_SLOT( slotAboutToShowContextMenu(TDEPopupMenu*, int, TQPopupMenu*) ));
115  }
116 
117  if ( m_bIsRoot )
118  {
119  connect( m_pManager, TQ_SIGNAL( changed(const TQString &, const TQString &) ),
120  TQ_SLOT( slotBookmarksChanged(const TQString &) ) );
121  }
122  }
123 
124  // add entries that possibly have a shortcut, so they are available _before_ first popup
125  if ( m_bIsRoot )
126  {
127  if ( m_bAddBookmark )
128  {
129  addAddBookmark();
130  if ( extOwner() )
131  addAddBookmarksList(); // FIXME
132  }
133 
134  addEditBookmarks();
135  }
136 
137  m_bDirty = true;
138 }
139 
140 KBookmarkMenu::~KBookmarkMenu()
141 {
142  //kdDebug(7043) << "KBookmarkMenu::~KBookmarkMenu() " << this << endl;
143  TQPtrListIterator<TDEAction> it( m_actions );
144  for (; it.current(); ++it )
145  it.current()->unplugAll();
146 
147  m_lstSubMenus.clear();
148  m_actions.clear();
149 }
150 
151 void KBookmarkMenu::ensureUpToDate()
152 {
153  slotAboutToShow();
154 }
155 
156 void KBookmarkMenu::slotAboutToShow()
157 {
158  // Did the bookmarks change since the last time we showed them ?
159  if ( m_bDirty )
160  {
161  m_bDirty = false;
162  refill();
163  }
164 }
165 
166 TQString KBookmarkMenu::s_highlightedAddress;
167 TQString KBookmarkMenu::s_highlightedImportType;
168 TQString KBookmarkMenu::s_highlightedImportLocation;
169 
170 void KBookmarkMenu::slotActionHighlighted( TDEAction* action )
171 {
172  if (action->isA("KBookmarkActionMenu") || action->isA("KBookmarkAction"))
173  {
174  s_highlightedAddress = action->property("address").toString();
175  //kdDebug() << "KBookmarkMenu::slotActionHighlighted" << s_highlightedAddress << endl;
176  }
177  else if (action->isA("KImportedBookmarksActionMenu"))
178  {
179  s_highlightedImportType = action->property("type").toString();
180  s_highlightedImportLocation = action->property("location").toString();
181  }
182  else
183  {
184  s_highlightedAddress = TQString::null;
185  s_highlightedImportType = TQString::null;
186  s_highlightedImportLocation = TQString::null;
187  }
188 }
189 
190 /********************************************************************/
191 /********************************************************************/
192 /********************************************************************/
193 
194 class KBookmarkMenuRMBAssoc : public dPtrTemplate<KBookmarkMenu, RMB> { };
195 template<> TQPtrDict<RMB>* dPtrTemplate<KBookmarkMenu, RMB>::d_ptr = 0;
196 
197 static RMB* rmbSelf(KBookmarkMenu *m) { return KBookmarkMenuRMBAssoc::d(m); }
198 
199 // TODO check via dcop before making any changes to the bookmarks file???
200 
201 void RMB::begin_rmb_action(KBookmarkMenu *self)
202 {
203  RMB *s = rmbSelf(self);
204  s->recv = self;
205  s->m_parentAddress = self->m_parentAddress;
206  s->s_highlightedAddress = KBookmarkMenu::s_highlightedAddress;
207  s->m_pManager = self->m_pManager;
208  s->m_pOwner = self->m_pOwner;
209  s->m_parentMenu = self->m_parentMenu;
210 }
211 
212 bool RMB::invalid( int val )
213 {
214  bool valid = true;
215 
216  if (val == 1)
217  s_highlightedAddress = m_parentAddress;
218 
219  if (s_highlightedAddress.isNull())
220  valid = false;
221 
222  return !valid;
223 }
224 
225 KBookmark RMB::atAddress(const TQString & address)
226 {
227  KBookmark bookmark = m_pManager->findByAddress( address );
228  Q_ASSERT(!bookmark.isNull());
229  return bookmark;
230 }
231 
232 void KBookmarkMenu::slotAboutToShowContextMenu( TDEPopupMenu*, int, TQPopupMenu* contextMenu )
233 {
234  //kdDebug(7043) << "KBookmarkMenu::slotAboutToShowContextMenu" << s_highlightedAddress << endl;
235  if (s_highlightedAddress.isNull())
236  {
237  TDEPopupMenu::contextMenuFocus()->hideContextMenu();
238  return;
239  }
240  contextMenu->clear();
241  fillContextMenu( contextMenu, s_highlightedAddress, 0 );
242 }
243 
244 void RMB::fillContextMenu( TQPopupMenu* contextMenu, const TQString & address, int val )
245 {
246  KBookmark bookmark = atAddress(address);
247 
248  int id;
249 
250  // binner:
251  // "Add Bookmark Here" when pointing at a bookmark looks strange and if you
252  // call it you have to close and reopen the menu to see an entry was added?
253  //
254  // TODO rename these, but, message freeze... umm...
255 
256 // if (bookmark.isGroup()) {
257  id = contextMenu->insertItem( SmallIcon("bookmark_add"), i18n( "Add Bookmark Here" ), recv, TQ_SLOT(slotRMBActionInsert(int)) );
258  contextMenu->setItemParameter( id, val );
259 /* }
260  else
261  {
262  id = contextMenu->insertItem( SmallIcon("bookmark_add"), i18n( "Add Bookmark Here" ), recv, TQ_SLOT(slotRMBActionInsert(int)) );
263  contextMenu->setItemParameter( id, val );
264  }*/
265 }
266 
267 void RMB::fillContextMenu2( TQPopupMenu* contextMenu, const TQString & address, int val )
268 {
269  KBookmark bookmark = atAddress(address);
270 
271  int id;
272 
273  if (bookmark.isGroup()) {
274  id = contextMenu->insertItem( i18n( "Open Folder in Bookmark Editor" ), recv, TQ_SLOT(slotRMBActionEditAt(int)) );
275  contextMenu->setItemParameter( id, val );
276  contextMenu->insertSeparator();
277  id = contextMenu->insertItem( SmallIcon("edit-delete"), i18n( "Delete Folder" ), recv, TQ_SLOT(slotRMBActionRemove(int)) );
278  contextMenu->setItemParameter( id, val );
279  contextMenu->insertSeparator();
280  id = contextMenu->insertItem( i18n( "Properties" ), recv, TQ_SLOT(slotRMBActionProperties(int)) );
281  contextMenu->setItemParameter( id, val );
282  }
283  else
284  {
285  id = contextMenu->insertItem( i18n( "Copy Link Address" ), recv, TQ_SLOT(slotRMBActionCopyLocation(int)) );
286  contextMenu->setItemParameter( id, val );
287  contextMenu->insertSeparator();
288  id = contextMenu->insertItem( SmallIcon("edit-delete"), i18n( "Delete Bookmark" ), recv, TQ_SLOT(slotRMBActionRemove(int)) );
289  contextMenu->setItemParameter( id, val );
290  contextMenu->insertSeparator();
291  id = contextMenu->insertItem( i18n( "Properties" ), recv, TQ_SLOT(slotRMBActionProperties(int)) );
292  contextMenu->setItemParameter( id, val );
293  }
294 }
295 
296 void RMB::slotRMBActionEditAt( int val )
297 {
298  kdDebug(7043) << "KBookmarkMenu::slotRMBActionEditAt" << s_highlightedAddress << endl;
299  if (invalid(val)) { hidePopup(); return; }
300 
301  KBookmark bookmark = atAddress(s_highlightedAddress);
302 
303  m_pManager->slotEditBookmarksAtAddress( s_highlightedAddress );
304 }
305 
306 void RMB::slotRMBActionProperties( int val )
307 {
308  kdDebug(7043) << "KBookmarkMenu::slotRMBActionProperties" << s_highlightedAddress << endl;
309  if (invalid(val)) { hidePopup(); return; }
310 
311  KBookmark bookmark = atAddress(s_highlightedAddress);
312 
313  TQString folder = bookmark.isGroup() ? TQString::null : bookmark.url().pathOrURL();
314  KBookmarkEditDialog dlg( bookmark.fullText(), folder,
315  m_pManager, KBookmarkEditDialog::ModifyMode, 0,
316  0, 0, i18n("Bookmark Properties") );
317  if ( dlg.exec() != KDialogBase::Accepted )
318  return;
319 
320  makeTextNodeMod(bookmark, "title", dlg.finalTitle());
321  if ( !dlg.finalUrl().isNull() )
322  {
323  KURL u = KURL::fromPathOrURL(dlg.finalUrl());
324  bookmark.internalElement().setAttribute("href", u.url(0, 106));
325  }
326 
327  kdDebug(7043) << "Requested move to " << dlg.finalAddress() << "!" << endl;
328 
329  KBookmarkGroup parentBookmark = atAddress(m_parentAddress).toGroup();
330  m_pManager->emitChanged( parentBookmark );
331 }
332 
333 void RMB::slotRMBActionInsert( int val )
334 {
335  kdDebug(7043) << "KBookmarkMenu::slotRMBActionInsert" << s_highlightedAddress << endl;
336  if (invalid(val)) { hidePopup(); return; }
337 
338  TQString url = m_pOwner->currentURL();
339  if (url.isEmpty())
340  {
341  KMessageBox::error( 0L, i18n("Cannot add bookmark with empty URL."));
342  return;
343  }
344  TQString title = m_pOwner->currentTitle();
345  if (title.isEmpty())
346  title = url;
347 
348  KBookmark bookmark = atAddress( s_highlightedAddress );
349 
350  // TODO use unique title
351 
352  if (bookmark.isGroup())
353  {
354  KBookmarkGroup parentBookmark = bookmark.toGroup();
355  Q_ASSERT(!parentBookmark.isNull());
356  parentBookmark.addBookmark( m_pManager, title, KURL( url ) );
357  m_pManager->emitChanged( parentBookmark );
358  }
359  else
360  {
361  KBookmarkGroup parentBookmark = bookmark.parentGroup();
362  Q_ASSERT(!parentBookmark.isNull());
363  KBookmark newBookmark = parentBookmark.addBookmark( m_pManager, title, KURL( url ) );
364  parentBookmark.moveItem( newBookmark, parentBookmark.previous(bookmark) );
365  m_pManager->emitChanged( parentBookmark );
366  }
367 }
368 
369 void RMB::slotRMBActionRemove( int val )
370 {
371  //kdDebug(7043) << "KBookmarkMenu::slotRMBActionRemove" << s_highlightedAddress << endl;
372  if (invalid(val)) { hidePopup(); return; }
373 
374  KBookmark bookmark = atAddress( s_highlightedAddress );
375  bool folder = bookmark.isGroup();
376 
377  if (KMessageBox::warningContinueCancel(
378  m_parentMenu,
379  folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?").arg(bookmark.text())
380  : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?").arg(bookmark.text()),
381  folder ? i18n("Bookmark Folder Deletion")
382  : i18n("Bookmark Deletion"),
383  KStdGuiItem::del())
384  != KMessageBox::Continue
385  )
386  return;
387 
388  KBookmarkGroup parentBookmark = atAddress( m_parentAddress ).toGroup();
389  parentBookmark.deleteBookmark( bookmark );
390  m_pManager->emitChanged( parentBookmark );
391  if (m_parentMenu)
392  m_parentMenu->hide();
393 }
394 
395 void RMB::slotRMBActionCopyLocation( int val )
396 {
397  //kdDebug(7043) << "KBookmarkMenu::slotRMBActionCopyLocation" << s_highlightedAddress << endl;
398  if (invalid(val)) { hidePopup(); return; }
399 
400  KBookmark bookmark = atAddress( s_highlightedAddress );
401 
402  if ( !bookmark.isGroup() )
403  {
404  kapp->clipboard()->setData( KBookmarkDrag::newDrag(bookmark, 0),
405  TQClipboard::Selection );
406  kapp->clipboard()->setData( KBookmarkDrag::newDrag(bookmark, 0),
407  TQClipboard::Clipboard );
408  }
409 }
410 
411 void RMB::hidePopup() {
412  TDEPopupMenu::contextMenuFocus()->hideContextMenu();
413 }
414 
415 /********************************************************************/
416 /********************************************************************/
417 /********************************************************************/
418 
419 void KBookmarkMenu::fillContextMenu( TQPopupMenu* contextMenu, const TQString & address, int val )
420 {
421  RMB::begin_rmb_action(this);
422  rmbSelf(this)->fillContextMenu(contextMenu, address, val);
423  emit aboutToShowContextMenu( rmbSelf(this)->atAddress(address), contextMenu);
424  rmbSelf(this)->fillContextMenu2(contextMenu, address, val);
425 }
426 
427 void KBookmarkMenu::slotRMBActionEditAt( int val )
428 { RMB::begin_rmb_action(this); rmbSelf(this)->slotRMBActionEditAt( val ); }
429 
430 void KBookmarkMenu::slotRMBActionProperties( int val )
431 { RMB::begin_rmb_action(this); rmbSelf(this)->slotRMBActionProperties( val ); }
432 
433 void KBookmarkMenu::slotRMBActionInsert( int val )
434 { RMB::begin_rmb_action(this); rmbSelf(this)->slotRMBActionInsert( val ); }
435 
436 void KBookmarkMenu::slotRMBActionRemove( int val )
437 { RMB::begin_rmb_action(this); rmbSelf(this)->slotRMBActionRemove( val ); }
438 
439 void KBookmarkMenu::slotRMBActionCopyLocation( int val )
440 { RMB::begin_rmb_action(this); rmbSelf(this)->slotRMBActionCopyLocation( val ); }
441 
442 void KBookmarkMenu::slotBookmarksChanged( const TQString & groupAddress )
443 {
444  if (m_bNSBookmark)
445  return;
446 
447  if ( groupAddress == m_parentAddress )
448  {
449  //kdDebug(7043) << "KBookmarkMenu::slotBookmarksChanged -> setting m_bDirty on " << groupAddress << endl;
450  m_bDirty = true;
451  }
452  else
453  {
454  // Iterate recursively into child menus
455  TQPtrListIterator<KBookmarkMenu> it( m_lstSubMenus );
456  for (; it.current(); ++it )
457  {
458  it.current()->slotBookmarksChanged( groupAddress );
459  }
460  }
461 }
462 
463 void KBookmarkMenu::refill()
464 {
465  //kdDebug(7043) << "KBookmarkMenu::refill()" << endl;
466  m_lstSubMenus.clear();
467 
468  TQPtrListIterator<TDEAction> it( m_actions );
469  for (; it.current(); ++it )
470  it.current()->unplug( m_parentMenu );
471 
472  m_parentMenu->clear();
473  m_actions.clear();
474 
475  fillBookmarkMenu();
476  m_parentMenu->adjustSize();
477 }
478 
479 void KBookmarkMenu::addAddBookmarksList()
480 {
481  if (!kapp->authorizeTDEAction("bookmarks"))
482  return;
483 
484  TQString title = i18n( "Bookmark Tabs as Folder..." );
485 
486  TDEAction * paAddBookmarksList = new TDEAction( title,
487  "bookmarks_list_add",
488  0,
489  this,
490  TQ_SLOT( slotAddBookmarksList() ),
491  m_actionCollection, m_bIsRoot ? "add_bookmarks_list" : 0 );
492 
493  paAddBookmarksList->setToolTip( i18n( "Add a folder of bookmarks for all open tabs." ) );
494 
495  paAddBookmarksList->plug( m_parentMenu );
496  m_actions.append( paAddBookmarksList );
497 }
498 
499 void KBookmarkMenu::addAddBookmark()
500 {
501  if (!kapp->authorizeTDEAction("bookmarks"))
502  return;
503 
504  TQString title = i18n( "Add Bookmark" );
505 
506  TDEAction * paAddBookmarks = new TDEAction( title,
507  "bookmark_add",
508  m_bIsRoot && m_bAddShortcuts ? TDEStdAccel::addBookmark() : TDEShortcut(),
509  this,
510  TQ_SLOT( slotAddBookmark() ),
511  m_actionCollection, m_bIsRoot ? "add_bookmark" : 0 );
512 
513  paAddBookmarks->setToolTip( i18n( "Add a bookmark for the current document" ) );
514 
515  paAddBookmarks->plug( m_parentMenu );
516  m_actions.append( paAddBookmarks );
517 }
518 
519 void KBookmarkMenu::addEditBookmarks()
520 {
521  if (!kapp->authorizeTDEAction("bookmarks"))
522  return;
523 
524  TDEAction * m_paEditBookmarks = KStdAction::editBookmarks( m_pManager, TQ_SLOT( slotEditBookmarks() ),
525  m_actionCollection, "edit_bookmarks" );
526  m_paEditBookmarks->plug( m_parentMenu );
527  m_paEditBookmarks->setToolTip( i18n( "Edit your bookmark collection in a separate window" ) );
528  m_actions.append( m_paEditBookmarks );
529 }
530 
531 void KBookmarkMenu::addNewFolder()
532 {
533  if (!kapp->authorizeTDEAction("bookmarks"))
534  return;
535 
536  TQString title = i18n( "&New Bookmark Folder..." );
537  int p;
538  while ( ( p = title.find( '&' ) ) >= 0 )
539  title.remove( p, 1 );
540 
541  TDEAction * paNewFolder = new TDEAction( title,
542  "folder-new", //"folder",
543  0,
544  this,
545  TQ_SLOT( slotNewFolder() ),
546  m_actionCollection );
547 
548  paNewFolder->setToolTip( i18n( "Create a new bookmark folder in this menu" ) );
549 
550  paNewFolder->plug( m_parentMenu );
551  m_actions.append( paNewFolder );
552 }
553 
554 void KBookmarkMenu::fillBookmarkMenu()
555 {
556  if (!kapp->authorizeTDEAction("bookmarks"))
557  return;
558 
559  if ( m_bIsRoot )
560  {
561  if ( m_bAddBookmark )
562  {
563  addAddBookmark();
564  if ( extOwner() )
565  addAddBookmarksList(); // FIXME
566  }
567 
568  addEditBookmarks();
569 
570  if ( m_bAddBookmark && !KBookmarkSettings::self()->m_advancedaddbookmark )
571  addNewFolder();
572  }
573 
574  if ( m_bIsRoot
575  && KBookmarkManager::userBookmarksFile() == m_pManager->path() )
576  {
577  bool haveSep = false;
578 
579  TQValueList<TQString> keys = KBookmarkMenu::dynamicBookmarksList();
580  TQValueList<TQString>::const_iterator it;
581  for ( it = keys.begin(); it != keys.end(); ++it )
582  {
583  DynMenuInfo info;
584  info = showDynamicBookmarks((*it));
585 
586  if ( !info.show || !TQFile::exists( info.location ) )
587  continue;
588 
589  if (!haveSep)
590  {
591  m_parentMenu->insertSeparator();
592  haveSep = true;
593  }
594 
595  TDEActionMenu * actionMenu;
596  actionMenu = new KImportedBookmarksActionMenu(
597  info.name, info.type,
598  m_actionCollection, "kbookmarkmenu" );
599 
600  actionMenu->setProperty( "type", info.type );
601  actionMenu->setProperty( "location", info.location );
602 
603  actionMenu->plug( m_parentMenu );
604  m_actions.append( actionMenu );
605 
606  KBookmarkMenu *subMenu =
607  new KBookmarkMenu( m_pManager, m_pOwner, actionMenu->popupMenu(),
608  m_actionCollection, false,
609  m_bAddBookmark, TQString::null );
610  connect( subMenu, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ),
611  this, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ));
612  m_lstSubMenus.append(subMenu);
613 
614  connect(actionMenu->popupMenu(), TQ_SIGNAL(aboutToShow()), subMenu, TQ_SLOT(slotNSLoad()));
615  }
616  }
617 
618  KBookmarkGroup parentBookmark = m_pManager->findByAddress( m_parentAddress ).toGroup();
619  Q_ASSERT(!parentBookmark.isNull());
620  bool separatorInserted = false;
621  for ( KBookmark bm = parentBookmark.first(); !bm.isNull(); bm = parentBookmark.next(bm) )
622  {
623  TQString text = KStringHandler::csqueeze(bm.fullText(), 60);
624  text.replace( '&', "&&" );
625  if ( !separatorInserted && m_bIsRoot) {
626  // inserted before the first konq bookmark, to avoid the separator if no konq bookmark
627  m_parentMenu->insertSeparator();
628  separatorInserted = true;
629  }
630  if ( !bm.isGroup() )
631  {
632  if ( bm.isSeparator() )
633  {
634  m_parentMenu->insertSeparator();
635  }
636  else
637  {
638  //kdDebug(7043) << "Creating URL bookmark menu item for " << bm.text() << endl;
639  TDEAction * action = new KBookmarkAction( text, bm.icon(), 0, m_actionCollection, 0 );
640  connect(action, TQ_SIGNAL( activated ( TDEAction::ActivationReason, TQt::ButtonState )),
641  this, TQ_SLOT( slotBookmarkSelected( TDEAction::ActivationReason, TQt::ButtonState ) ));
642 
643  action->setProperty( "url", bm.url().url() );
644  action->setProperty( "address", bm.address() );
645 
646  action->setToolTip( bm.url().pathOrURL() );
647 
648  action->plug( m_parentMenu );
649  m_actions.append( action );
650  }
651  }
652  else
653  {
654  //kdDebug(7043) << "Creating bookmark submenu named " << bm.text() << endl;
655  TDEActionMenu * actionMenu = new KBookmarkActionMenu( text, bm.icon(),
656  m_actionCollection,
657  "kbookmarkmenu" );
658  actionMenu->setProperty( "address", bm.address() );
659  actionMenu->plug( m_parentMenu );
660  m_actions.append( actionMenu );
661 
662  KBookmarkMenu *subMenu = new KBookmarkMenu( m_pManager, m_pOwner, actionMenu->popupMenu(),
663  m_actionCollection, false,
664  m_bAddBookmark,
665  bm.address() );
666 
667  connect(subMenu, TQ_SIGNAL( aboutToShowContextMenu( const KBookmark &, TQPopupMenu * ) ),
668  this, TQ_SIGNAL( aboutToShowContextMenu( const KBookmark &, TQPopupMenu * ) ));
669  connect(subMenu, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ),
670  this, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ));
671  m_lstSubMenus.append( subMenu );
672  }
673  }
674 
675  if ( !m_bIsRoot && m_bAddBookmark )
676  {
677  if ( m_parentMenu->count() > 0 )
678  m_parentMenu->insertSeparator();
679 
680  if ( KBookmarkSettings::self()->m_quickactions )
681  {
682  TDEActionMenu * actionMenu = new TDEActionMenu( i18n("Quick Actions"), m_actionCollection, 0L );
683  fillContextMenu( actionMenu->popupMenu(), m_parentAddress, 1 );
684  actionMenu->plug( m_parentMenu );
685  m_actions.append( actionMenu );
686  }
687  else
688  {
689  addAddBookmark();
690  if ( extOwner() )
691  addAddBookmarksList(); // FIXME
692  addNewFolder();
693  }
694  }
695 }
696 
697 void KBookmarkMenu::slotAddBookmarksList()
698 {
699  KExtendedBookmarkOwner *extOwner = dynamic_cast<KExtendedBookmarkOwner*>(m_pOwner);
700  if (!extOwner)
701  {
702  kdWarning() << "erm, sorry ;-)" << endl;
703  return;
704  }
705 
706  KExtendedBookmarkOwner::QStringPairList list;
707  extOwner->fillBookmarksList( list );
708 
709  KBookmarkGroup parentBookmark = m_pManager->findByAddress( m_parentAddress ).toGroup();
710  Q_ASSERT(!parentBookmark.isNull());
711  KBookmarkGroup group = parentBookmark.createNewFolder( m_pManager );
712  if ( group.isNull() )
713  return; // user canceled i guess
714 
715  KExtendedBookmarkOwner::QStringPairList::const_iterator it;
716  for ( it = list.begin(); it != list.end(); ++it )
717  group.addBookmark( m_pManager, (*it).first, KURL((*it).second) );
718 
719  m_pManager->emitChanged( parentBookmark );
720 }
721 
722 
723 void KBookmarkMenu::slotAddBookmark()
724 {
725  KBookmarkGroup parentBookmark;
726  parentBookmark = m_pManager->addBookmarkDialog(m_pOwner->currentURL(), m_pOwner->currentTitle(), m_parentAddress);
727  if (!parentBookmark.isNull())
728  m_pManager->emitChanged( parentBookmark );
729 }
730 
731 void KBookmarkMenu::slotNewFolder()
732 {
733  if ( !m_pOwner ) return; // this view doesn't handle bookmarks...
734  KBookmarkGroup parentBookmark = m_pManager->findByAddress( m_parentAddress ).toGroup();
735  Q_ASSERT(!parentBookmark.isNull());
736  KBookmarkGroup group = parentBookmark.createNewFolder( m_pManager );
737  if ( !group.isNull() )
738  {
739  KBookmarkGroup parentGroup = group.parentGroup();
740  m_pManager->emitChanged( parentGroup );
741  }
742 }
743 
744 void KBookmarkMenu::slotBookmarkSelected( TDEAction::ActivationReason /*reason*/, TQt::ButtonState state )
745 {
746  kdDebug(7043) << "KBookmarkMenu::slotBookmarkSelected()" << endl;
747  if ( !m_pOwner ) return; // this view doesn't handle bookmarks...
748  const TDEAction* action = dynamic_cast<const TDEAction *>(sender());
749  if(action)
750  {
751  const TQString& url = sender()->property("url").toString();
752  m_pOwner->openBookmarkURL( url );
753  emit openBookmark( url, state );
754  }
755 }
756 
757 void KBookmarkMenu::slotBookmarkSelected()
758 {
759  slotBookmarkSelected(TDEAction::PopupMenuActivation, TQt::NoButton);
760 }
761 
762 KExtendedBookmarkOwner* KBookmarkMenu::extOwner()
763 {
764  return dynamic_cast<KExtendedBookmarkOwner*>(m_pOwner);
765 }
766 
767 void KBookmarkMenu::slotNSLoad()
768 {
769  // only fill menu once
770  m_parentMenu->disconnect(TQ_SIGNAL(aboutToShow()));
771 
772  // not NSImporter, but kept old name for BC reasons
773  KBookmarkMenuNSImporter importer( m_pManager, this, m_actionCollection );
774  importer.openBookmarks(s_highlightedImportLocation, s_highlightedImportType);
775 }
776 
777 /********************************************************************/
778 /********************************************************************/
779 /********************************************************************/
780 
781 KBookmarkEditFields::KBookmarkEditFields(TQWidget *main, TQBoxLayout *vbox, FieldsSet fieldsSet)
782 {
783  bool isF = (fieldsSet != FolderFieldsSet);
784 
785  TQGridLayout *grid = new TQGridLayout( vbox, 2, isF ? 2 : 1 );
786 
787  m_title = new KLineEdit( main );
788  grid->addWidget( m_title, 0, 1 );
789  grid->addWidget( new TQLabel( m_title, i18n( "Name:" ), main ), 0, 0 );
790  m_title->setFocus();
791  if (isF)
792  {
793  m_url = new KLineEdit( main );
794  grid->addWidget( m_url, 1, 1 );
795  grid->addWidget( new TQLabel( m_url, i18n( "Location:" ), main ), 1, 0 );
796  }
797  else
798  {
799  m_url = 0;
800  }
801 
802  main->setMinimumSize( 300, 0 );
803 }
804 
805 void KBookmarkEditFields::setName(const TQString &str)
806 {
807  m_title->setText(str);
808 }
809 
810 void KBookmarkEditFields::setLocation(const TQString &str)
811 {
812  m_url->setText(str);
813 }
814 
815 /********************************************************************/
816 /********************************************************************/
817 /********************************************************************/
818 
819 // TODO - make the dialog use Properties as a title when in Modify mode... (dirk noticed the bug...)
820 KBookmarkEditDialog::KBookmarkEditDialog(const TQString& title, const TQString& url, KBookmarkManager * mgr, BookmarkEditType editType, const TQString& address,
821  TQWidget * parent, const char * name, const TQString& caption )
822  : KDialogBase(parent, name, true, caption,
823  (editType == InsertionMode) ? (User1|Ok|Cancel) : (Ok|Cancel),
824  Ok, false, KGuiItem()),
825  m_folderTree(0), m_mgr(mgr), m_editType(editType), m_address(address)
826 {
827  setButtonOK( (editType == InsertionMode) ? KGuiItem( i18n( "&Add" ), "bookmark_add") : i18n( "&Update" ) );
828  if (editType == InsertionMode) {
829  setButtonGuiItem( User1, KGuiItem( i18n( "&New Folder..." ), "folder-new") );
830  }
831 
832  bool folder = url.isNull();
833 
834  m_main = new TQWidget( this );
835  setMainWidget( m_main );
836 
837  TQBoxLayout *vbox = new TQVBoxLayout( m_main, 0, spacingHint() );
838  KBookmarkEditFields::FieldsSet fs =
839  folder ? KBookmarkEditFields::FolderFieldsSet
840  : KBookmarkEditFields::BookmarkFieldsSet;
841  m_fields = new KBookmarkEditFields(m_main, vbox, fs);
842  m_fields->setName(title);
843  if ( !folder )
844  m_fields->setLocation(url);
845 
846  if ( editType == InsertionMode )
847  {
848  m_folderTree = KBookmarkFolderTree::createTree( m_mgr, m_main, name, m_address );
849  connect( m_folderTree, TQ_SIGNAL( doubleClicked(TQListViewItem*) ),
850  this, TQ_SLOT( slotDoubleClicked(TQListViewItem*) ) );
851  vbox->addWidget( m_folderTree );
852  connect( this, TQ_SIGNAL( user1Clicked() ), TQ_SLOT( slotUser1() ) );
853  }
854 }
855 
856 void KBookmarkEditDialog::slotDoubleClicked( TQListViewItem* item )
857 {
858  Q_ASSERT( m_folderTree );
859  m_folderTree->setCurrentItem( item );
860  accept();
861 }
862 
863 void KBookmarkEditDialog::slotOk()
864 {
865  accept();
866 }
867 
868 void KBookmarkEditDialog::slotCancel()
869 {
870  reject();
871 }
872 
873 TQString KBookmarkEditDialog::finalAddress() const
874 {
875  Q_ASSERT( m_folderTree );
876  return KBookmarkFolderTree::selectedAddress( m_folderTree );
877 }
878 
879 TQString KBookmarkEditDialog::finalUrl() const
880 {
881  return m_fields->m_url ? m_fields->m_url->text() : TQString::null;
882 }
883 
884 TQString KBookmarkEditDialog::finalTitle() const
885 {
886  return m_fields->m_title ? m_fields->m_title->text() : TQString::null;
887 }
888 
889 void KBookmarkEditDialog::slotUser1()
890 {
891  // kdDebug(7043) << "KBookmarkEditDialog::slotUser1" << endl;
892  Q_ASSERT( m_folderTree );
893 
894  TQString address = KBookmarkFolderTree::selectedAddress( m_folderTree );
895  if ( address.isNull() ) return;
896  KBookmarkGroup bm = m_mgr->findByAddress( address ).toGroup();
897  Q_ASSERT(!bm.isNull());
898  Q_ASSERT(m_editType == InsertionMode);
899 
900  KBookmarkGroup group = bm.createNewFolder( m_mgr );
901  if ( !group.isNull() )
902  {
903  KBookmarkGroup parentGroup = group.parentGroup();
904  m_mgr->emitChanged( parentGroup );
905  }
906  KBookmarkFolderTree::fillTree( m_folderTree, m_mgr );
907 }
908 
909 /********************************************************************/
910 /********************************************************************/
911 /********************************************************************/
912 
913 static void fillGroup( TQListView* listview, KBookmarkFolderTreeItem * parentItem, KBookmarkGroup group, bool expandOpenGroups = true, const TQString& address = TQString::null )
914 {
915  bool noSubGroups = true;
916  KBookmarkFolderTreeItem * lastItem = 0L;
917  KBookmarkFolderTreeItem * item = 0L;
918  for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk) )
919  {
920  if ( bk.isGroup() )
921  {
922  KBookmarkGroup grp = bk.toGroup();
923  item = new KBookmarkFolderTreeItem( parentItem, lastItem, grp );
924  fillGroup( listview, item, grp, expandOpenGroups, address );
925  if ( expandOpenGroups && grp.isOpen() )
926  item->setOpen( true );
927  lastItem = item;
928  noSubGroups = false;
929  }
930  if (bk.address() == address) {
931  listview->setCurrentItem( lastItem );
932  listview->ensureItemVisible( item );
933  }
934  }
935  if ( noSubGroups ) {
936  parentItem->setOpen( true );
937  }
938 }
939 
940 TQListView* KBookmarkFolderTree::createTree( KBookmarkManager* mgr, TQWidget* parent, const char* name, const TQString& address )
941 {
942  TQListView *listview = new TQListView( parent, name );
943 
944  listview->setRootIsDecorated( false );
945  listview->header()->hide();
946  listview->addColumn( i18n("Bookmark"), 200 );
947  listview->setSorting( -1, false );
948  listview->setSelectionMode( TQListView::Single );
949  listview->setAllColumnsShowFocus( true );
950  listview->setResizeMode( TQListView::AllColumns );
951  listview->setMinimumSize( 60, 100 );
952 
953  fillTree( listview, mgr, address );
954 
955  return listview;
956 }
957 
958 void KBookmarkFolderTree::fillTree( TQListView *listview, KBookmarkManager* mgr, const TQString& address )
959 {
960  listview->clear();
961 
962  KBookmarkGroup root = mgr->root();
963  KBookmarkFolderTreeItem * rootItem = new KBookmarkFolderTreeItem( listview, root );
964  listview->setCurrentItem( rootItem );
965  rootItem->setSelected( true );
966  fillGroup( listview, rootItem, root, (address == root.groupAddress() || address.isNull()) ? true : false, address );
967  rootItem->setOpen( true );
968 }
969 
970 static KBookmarkFolderTreeItem* ft_cast( TQListViewItem *i )
971 {
972  return static_cast<KBookmarkFolderTreeItem*>( i );
973 }
974 
975 TQString KBookmarkFolderTree::selectedAddress( TQListView *listview )
976 {
977  if ( !listview)
978  return TQString::null;
979  KBookmarkFolderTreeItem *item = ft_cast( listview->currentItem() );
980  return item ? item->m_bookmark.address() : TQString::null;
981 }
982 
983 void KBookmarkFolderTree::setAddress( TQListView *listview, const TQString & address )
984 {
985  KBookmarkFolderTreeItem* it = ft_cast( listview->firstChild() );
986  while ( true ) {
987  kdDebug(7043) << it->m_bookmark.address() << endl;
988  it = ft_cast( it->itemBelow() );
989  if ( !it )
990  return;
991  if ( it->m_bookmark.address() == address )
992  break;
993  }
994  it->setSelected( true );
995  listview->setCurrentItem( it );
996 }
997 
998 /********************************************************************/
999 /********************************************************************/
1000 /********************************************************************/
1001 
1002 // toplevel item
1003 KBookmarkFolderTreeItem::KBookmarkFolderTreeItem( TQListView *parent, const KBookmark & gp )
1004  : TQListViewItem(parent, i18n("Bookmarks")), m_bookmark(gp)
1005 {
1006  setPixmap(0, SmallIcon("bookmark"));
1007  setExpandable(true);
1008 }
1009 
1010 // group
1011 KBookmarkFolderTreeItem::KBookmarkFolderTreeItem( KBookmarkFolderTreeItem *parent, TQListViewItem *after, const KBookmarkGroup & gp )
1012  : TQListViewItem(parent, after, gp.fullText()), m_bookmark(gp)
1013 {
1014  setPixmap(0, SmallIcon( gp.icon() ) );
1015  setExpandable(true);
1016 }
1017 
1018 /********************************************************************/
1019 /********************************************************************/
1020 /********************************************************************/
1021 
1022 // NOTE - KBookmarkMenuNSImporter is really === KBookmarkMenuImporter
1023 // i.e, it is _not_ ns specific. and in KDE4 it should be renamed.
1024 
1025 void KBookmarkMenuNSImporter::openNSBookmarks()
1026 {
1027  openBookmarks( KNSBookmarkImporter::netscapeBookmarksFile(), "netscape" );
1028 }
1029 
1030 void KBookmarkMenuNSImporter::openBookmarks( const TQString &location, const TQString &type )
1031 {
1032  mstack.push(m_menu);
1033 
1034  KBookmarkImporterBase *importer = KBookmarkImporterBase::factory(type);
1035  if (!importer)
1036  return;
1037  importer->setFilename(location);
1038  connectToImporter(*importer);
1039  importer->parse();
1040 
1041  delete importer;
1042 }
1043 
1044 void KBookmarkMenuNSImporter::connectToImporter(const TQObject &importer)
1045 {
1046  connect( &importer, TQ_SIGNAL( newBookmark( const TQString &, const TQCString &, const TQString & ) ),
1047  TQ_SLOT( newBookmark( const TQString &, const TQCString &, const TQString & ) ) );
1048  connect( &importer, TQ_SIGNAL( newFolder( const TQString &, bool, const TQString & ) ),
1049  TQ_SLOT( newFolder( const TQString &, bool, const TQString & ) ) );
1050  connect( &importer, TQ_SIGNAL( newSeparator() ), TQ_SLOT( newSeparator() ) );
1051  connect( &importer, TQ_SIGNAL( endFolder() ), TQ_SLOT( endFolder() ) );
1052 }
1053 
1054 void KBookmarkMenuNSImporter::newBookmark( const TQString & text, const TQCString & url, const TQString & )
1055 {
1056  TQString _text = KStringHandler::csqueeze(text);
1057  _text.replace( '&', "&&" );
1058  TDEAction * action = new KBookmarkAction(_text, "text-html", 0, 0, "", m_actionCollection, 0);
1059  connect(action, TQ_SIGNAL( activated ( TDEAction::ActivationReason, TQt::ButtonState )),
1060  m_menu, TQ_SLOT( slotBookmarkSelected( TDEAction::ActivationReason, TQt::ButtonState ) ));
1061  action->setProperty( "url", url );
1062  action->setToolTip( url );
1063  action->plug( mstack.top()->m_parentMenu );
1064  mstack.top()->m_actions.append( action );
1065 }
1066 
1067 void KBookmarkMenuNSImporter::newFolder( const TQString & text, bool, const TQString & )
1068 {
1069  TQString _text = KStringHandler::csqueeze(text);
1070  _text.replace( '&', "&&" );
1071  TDEActionMenu * actionMenu = new TDEActionMenu( _text, "folder", m_actionCollection, 0L );
1072  actionMenu->plug( mstack.top()->m_parentMenu );
1073  mstack.top()->m_actions.append( actionMenu );
1074  KBookmarkMenu *subMenu = new KBookmarkMenu( m_pManager, m_menu->m_pOwner, actionMenu->popupMenu(),
1075  m_actionCollection, false,
1076  m_menu->m_bAddBookmark, TQString::null );
1077  connect( subMenu, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ),
1078  m_menu, TQ_SIGNAL( openBookmark( const TQString &, TQt::ButtonState ) ));
1079  mstack.top()->m_lstSubMenus.append( subMenu );
1080 
1081  mstack.push(subMenu);
1082 }
1083 
1084 void KBookmarkMenuNSImporter::newSeparator()
1085 {
1086  mstack.top()->m_parentMenu->insertSeparator();
1087 }
1088 
1089 void KBookmarkMenuNSImporter::endFolder()
1090 {
1091  mstack.pop();
1092 }
1093 
1094 /********************************************************************/
1095 /********************************************************************/
1096 /********************************************************************/
1097 
1098 KBookmarkMenu::DynMenuInfo KBookmarkMenu::showDynamicBookmarks( const TQString &id )
1099 {
1100  TDEConfig config("kbookmarkrc", false, false);
1101  config.setGroup("Bookmarks");
1102 
1103  DynMenuInfo info;
1104  info.show = false;
1105 
1106  if (!config.hasKey("DynamicMenus")) {
1107  // upgrade path
1108  if (id == "netscape") {
1109  KBookmarkManager *manager = KBookmarkManager::userBookmarksManager();
1110  info.show = manager->root().internalElement().attribute("hide_nsbk") != "yes";
1111  info.location = KNSBookmarkImporter::netscapeBookmarksFile();
1112  info.type = "netscape";
1113  info.name = i18n("Netscape Bookmarks");
1114  } // else, no show
1115 
1116  } else {
1117  // have new version config
1118  if (config.hasGroup("DynamicMenu-" + id)) {
1119  config.setGroup("DynamicMenu-" + id);
1120  info.show = config.readBoolEntry("Show");
1121  info.location = config.readPathEntry("Location");
1122  info.type = config.readEntry("Type");
1123  info.name = config.readEntry("Name");
1124  } // else, no show
1125  }
1126 
1127  return info;
1128 }
1129 
1130 TQStringList KBookmarkMenu::dynamicBookmarksList()
1131 {
1132  TDEConfig config("kbookmarkrc", false, false);
1133  config.setGroup("Bookmarks");
1134 
1135  TQStringList mlist;
1136  if (config.hasKey("DynamicMenus"))
1137  mlist = config.readListEntry("DynamicMenus");
1138  else
1139  mlist << "netscape";
1140 
1141  return mlist;
1142 }
1143 
1144 void KBookmarkMenu::setDynamicBookmarks(const TQString &id, const DynMenuInfo &newMenu)
1145 {
1146  TDEConfig config("kbookmarkrc", false, false);
1147 
1148  // add group unconditionally
1149  config.setGroup("DynamicMenu-" + id);
1150  config.writeEntry("Show", newMenu.show);
1151  config.writePathEntry("Location", newMenu.location);
1152  config.writeEntry("Type", newMenu.type);
1153  config.writeEntry("Name", newMenu.name);
1154 
1155  TQStringList elist;
1156 
1157  config.setGroup("Bookmarks");
1158  if (!config.hasKey("DynamicMenus")) {
1159  if (newMenu.type != "netscape") {
1160  // update from old xbel method to new rc method
1161  // though only if not writing the netscape setting
1162  config.setGroup("DynamicMenu-" "netscape");
1163  DynMenuInfo xbelSetting;
1164  xbelSetting = showDynamicBookmarks("netscape");
1165  config.writeEntry("Show", xbelSetting.show);
1166  config.writePathEntry("Location", xbelSetting.location);
1167  config.writeEntry("Type", xbelSetting.type);
1168  config.writeEntry("Name", xbelSetting.name);
1169  }
1170  } else {
1171  elist = config.readListEntry("DynamicMenus");
1172  }
1173 
1174  // make sure list includes type
1175  config.setGroup("Bookmarks");
1176  if (elist.contains(id) < 1) {
1177  elist << id;
1178  config.writeEntry("DynamicMenus", elist);
1179  }
1180 
1181  config.sync();
1182 }
1183 
1184 #include "kbookmarkmenu.moc"
1185 #include "kbookmarkmenu_p.moc"
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:198
KBookmarkGroup::next
KBookmark next(const KBookmark &current) const
Return the next sibling of a child bookmark of this group.
Definition: kbookmark.cpp:81
KBookmarkGroup::groupAddress
TQString groupAddress() const
Much like KBookmark::address, but caches the address into m_address.
Definition: kbookmark.cpp:43
KBookmarkGroup::first
KBookmark first() const
Return the first child bookmark of this group.
Definition: kbookmark.cpp:71
KBookmarkGroup::isOpen
bool isOpen() const
Definition: kbookmark.cpp:50
KBookmarkGroup::addBookmark
KBookmark addBookmark(KBookmarkManager *mgr, const KBookmark &bm, bool emitSignal=true)
Create a new bookmark, as the last child of this group Don't forget to use KBookmarkManager::self()->...
Definition: kbookmark.cpp:176
KBookmarkGroup::deleteBookmark
void deleteBookmark(KBookmark bk)
Delete a bookmark - it has to be one of our children ! Don't forget to use KBookmarkManager::self()->...
Definition: kbookmark.cpp:211
KBookmarkGroup::previous
KBookmark previous(const KBookmark &current) const
Return the prevous sibling of a child bookmark of this group.
Definition: kbookmark.cpp:76
KBookmarkGroup::createNewFolder
KBookmarkGroup createNewFolder(KBookmarkManager *mgr, const TQString &text=TQString::null, bool emitSignal=true)
Create a new bookmark folder, as the last child of this group.
Definition: kbookmark.cpp:108
KBookmarkGroup::moveItem
bool moveItem(const KBookmark &item, const KBookmark &after)
Moves item after after (which should be a child of ours).
Definition: kbookmark.cpp:153
KBookmarkImporterBase
A class for importing NS bookmarks KEditBookmarks uses it to insert bookmarks into its DOM tree,...
Definition: kbookmarkimporter.h:36
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:52
KBookmarkManager::emitChanged
void emitChanged(KBookmarkGroup &group)
Saves the bookmark file and notifies everyone.
Definition: kbookmarkmanager.cpp:539
KBookmarkManager::path
TQString path()
This will return the path that this manager is using to read the bookmarks.
Definition: kbookmarkmanager.h:132
KBookmarkManager::findByAddress
KBookmark findByAddress(const TQString &address, bool tolerate=false)
Definition: kbookmarkmanager.cpp:429
KBookmarkManager::addBookmarkDialog
KBookmarkGroup addBookmarkDialog(const TQString &_url, const TQString &_title, const TQString &_parentBookmarkAddress=TQString::null)
Definition: kbookmarkmanager.cpp:500
KBookmarkManager::userBookmarksManager
static KBookmarkManager * userBookmarksManager()
Returns a pointer to the users main bookmark collection.
Definition: kbookmarkmanager.cpp:700
KBookmarkManager::root
KBookmarkGroup root() const
This will return the root bookmark.
Definition: kbookmarkmanager.cpp:383
KBookmarkManager::userBookmarksFile
static TQString userBookmarksFile()
Returns the path to the user's main bookmark collection file.
Definition: kbookmarkmanager.cpp:695
KBookmarkMenuNSImporter
A class connected to KNSBookmarkImporter, to fill TDEActionMenus.
Definition: kbookmarkmenu.h:240
KBookmarkMenu
This class provides a bookmark menu.
Definition: kbookmarkmenu.h:78
KBookmarkMenu::m_parentAddress
TQString m_parentAddress
Parent bookmark for this menu.
Definition: kbookmarkmenu.h:228
KBookmarkMenu::showDynamicBookmarks
static DynMenuInfo showDynamicBookmarks(const TQString &id)
Definition: kbookmarkmenu.cpp:1098
KBookmarkMenu::m_parentMenu
TDEPopupMenu * m_parentMenu
The menu in which we plug our actions.
Definition: kbookmarkmenu.h:215
KBookmarkMenu::KBookmarkMenu
KBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, TDEPopupMenu *parentMenu, TDEActionCollection *collec, bool root, bool add=true, const TQString &parentAddress="")
Fills a bookmark menu (one instance of KBookmarkMenu is created for the toplevel menu,...
Definition: kbookmarkmenu.cpp:77
KBookmarkMenu::ensureUpToDate
void ensureUpToDate()
Call ensureUpToDate() if you need KBookmarkMenu to adjust to its final size before it is executed.
Definition: kbookmarkmenu.cpp:151
KBookmarkMenu::openBookmark
void openBookmark(const TQString &url, TQt::ButtonState state)
KBookmarkMenu::setDynamicBookmarks
static void setDynamicBookmarks(const TQString &id, const DynMenuInfo &info)
Shows an extra menu for the given bookmarks file and type.
Definition: kbookmarkmenu.cpp:1144
KBookmarkMenu::m_lstSubMenus
TQPtrList< KBookmarkMenu > m_lstSubMenus
List of our sub menus.
Definition: kbookmarkmenu.h:219
KBookmarkMenu::m_actions
TQPtrList< TDEAction > m_actions
List of our actions.
Definition: kbookmarkmenu.h:224
KBookmarkMenu::fillBookmarkMenu
void fillBookmarkMenu()
Even if you think you need to use this, you are probably wrong.
Definition: kbookmarkmenu.cpp:554
KBookmarkMenu::dynamicBookmarksList
static TQStringList dynamicBookmarksList()
Definition: kbookmarkmenu.cpp:1130
KBookmarkMenu::slotNSLoad
void slotNSLoad()
load Netscape's bookmarks
Definition: kbookmarkmenu.cpp:767
KBookmarkOwner
The KBookmarkMenu and KBookmarkBar classes gives the user the ability to either edit bookmarks or add...
Definition: kbookmarkmanager.h:316
KBookmarkOwner::currentTitle
virtual TQString currentTitle() const
This function is called whenever the user wants to add the current page to the bookmarks list.
Definition: kbookmarkmanager.h:332
KBookmarkOwner::openBookmarkURL
virtual void openBookmarkURL(const TQString &_url)
This function is called if the user selects a bookmark.
Definition: kbookmarkmanager.cpp:641
KBookmarkOwner::currentURL
virtual TQString currentURL() const
This function is called whenever the user wants to add the current page to the bookmarks list.
Definition: kbookmarkmanager.h:342
KExtendedBookmarkOwner
Definition: kbookmarkmanager.h:352
KBookmarkMenu::DynMenuInfo
Structure used for storing information about the dynamic menu setting.
Definition: kbookmarkmenu.h:128

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/bookmarks by doxygen 1.9.1
This website is maintained by Timothy Pearson.