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

libkonq

  • libkonq
konq_popupmenu.cc
1 /* This file is part of the KDE project
2  Copyright (C) 1998, 1999 David Faure <faure@kde.org>
3  Copyright (C) 2001 Holger Freyther <freyther@yahoo.com>
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 as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include <tqdir.h>
22 #include <tqeventloop.h>
23 
24 #include <tdelocale.h>
25 #include <tdeapplication.h>
26 #include <kbookmarkmanager.h>
27 #include <kdebug.h>
28 #include <krun.h>
29 #include <kprotocolinfo.h>
30 #include <kiconloader.h>
31 #include <kinputdialog.h>
32 #include <tdeglobalsettings.h>
33 #include <kstandarddirs.h>
34 #include <kxmlguifactory.h>
35 #include <kxmlguibuilder.h>
36 #include <tdeparts/componentfactory.h>
37 
38 #include <assert.h>
39 
40 #include <tdefileshare.h>
41 #include <kprocess.h>
42 
43 #include "kpropertiesdialog.h"
44 #include "knewmenu.h"
45 #include "konq_popupmenu.h"
46 #include "konq_operations.h"
47 #include "konq_xmlguiclient.h"
48 #include <dcopclient.h>
49 
50 /*
51  Test cases:
52  iconview file: background
53  iconview file: file (with and without servicemenus)
54  iconview file: directory
55  iconview remote protocol (e.g. ftp: or fish:)
56  iconview trash:/
57  sidebar directory tree
58  sidebar Devices / Hard Disc
59  tdehtml background
60  tdehtml link
61  tdehtml image (www.kde.org RMB on K logo)
62  tdehtmlimage (same as above, then choose View image, then RMB)
63  selected text in tdehtml
64  embedded katepart
65  kdesktop folder
66  trash link on desktop
67  trashed file or directory
68  application .desktop file
69  Then the same after uninstalling tdeaddons/konq-plugins (kuick and arkplugin in particular)
70 */
71 
72 class KonqPopupMenuGUIBuilder : public KXMLGUIBuilder
73 {
74 public:
75  KonqPopupMenuGUIBuilder( TQPopupMenu *menu )
76  : KXMLGUIBuilder( 0 )
77  {
78  m_menu = menu;
79  }
80  virtual ~KonqPopupMenuGUIBuilder()
81  {
82  }
83 
84  virtual TQWidget *createContainer( TQWidget *parent, int index,
85  const TQDomElement &element,
86  int &id )
87  {
88  if ( !parent && element.attribute( "name" ) == "popupmenu" )
89  return m_menu;
90 
91  return KXMLGUIBuilder::createContainer( parent, index, element, id );
92  }
93 
94  TQPopupMenu *m_menu;
95 };
96 
97 class KonqPopupMenu::KonqPopupMenuPrivate
98 {
99 public:
100  KonqPopupMenuPrivate() : m_parentWidget( 0 ),
101  m_itemFlags( KParts::BrowserExtension::DefaultPopupItems )
102  {
103  }
104  TQString m_urlTitle;
105  TQWidget *m_parentWidget;
106  KParts::BrowserExtension::PopupFlags m_itemFlags;
107 
108  bool localURLSlotFired;
109  KURL localURLResultURL;
110  bool localURLResultIsLocal;
111 };
112 
113 KonqPopupMenu::ProtocolInfo::ProtocolInfo()
114 {
115  m_Reading = false;
116  m_Writing = false;
117  m_Deleting = false;
118  m_Moving = false;
119  m_TrashIncluded = false;
120 }
121 
122 bool KonqPopupMenu::ProtocolInfo::supportsReading() const
123 {
124  return m_Reading;
125 }
126 
127 bool KonqPopupMenu::ProtocolInfo::supportsWriting() const
128 {
129  return m_Writing;
130 }
131 
132 bool KonqPopupMenu::ProtocolInfo::supportsDeleting() const
133 {
134  return m_Deleting;
135 }
136 
137 bool KonqPopupMenu::ProtocolInfo::supportsMoving() const
138 {
139  return m_Moving;
140 }
141 
142 bool KonqPopupMenu::ProtocolInfo::trashIncluded() const
143 {
144  return m_TrashIncluded;
145 }
146 
147 // This helper class stores the .desktop-file actions and the servicemenus
148 // in order to support X-TDE-Priority and X-TDE-Submenu.
149 class PopupServices
150 {
151 public:
152  ServiceList* selectList( const TQString& priority, const TQString& submenuName );
153 
154  ServiceList builtin;
155  ServiceList user, userToplevel, userPriority;
156  TQMap<TQString, ServiceList> userSubmenus, userToplevelSubmenus, userPrioritySubmenus;
157 };
158 
159 ServiceList* PopupServices::selectList( const TQString& priority, const TQString& submenuName )
160 {
161  // we use the categories .desktop entry to define submenus
162  // if none is defined, we just pop it in the main menu
163  if (submenuName.isEmpty())
164  {
165  if (priority == "TopLevel")
166  {
167  return &userToplevel;
168  }
169  else if (priority == "Important")
170  {
171  return &userPriority;
172  }
173  }
174  else if (priority == "TopLevel")
175  {
176  return &(userToplevelSubmenus[submenuName]);
177  }
178  else if (priority == "Important")
179  {
180  return &(userPrioritySubmenus[submenuName]);
181  }
182  else
183  {
184  return &(userSubmenus[submenuName]);
185  }
186  return &user;
187 }
188 
190 
191 KonqPopupMenu::KonqPopupMenu( KBookmarkManager *mgr, const KFileItemList &items,
192  KURL viewURL,
193  TDEActionCollection & actions,
194  KNewMenu * newMenu,
195  bool showProperties )
196  : TQPopupMenu( 0L, "konq_popupmenu" ),
197  m_actions( actions ), m_ownActions( static_cast<TQWidget *>( 0 ), "KonqPopupMenu::m_ownActions" ),
198  m_pMenuNew( newMenu ), m_sViewURL(viewURL), m_lstItems(items), m_pManager(mgr)
199 {
200  KonqPopupFlags kpf = ( showProperties ? ShowProperties : IsLink ) | ShowNewWindow;
201  init(0, kpf, KParts::BrowserExtension::DefaultPopupItems);
202 }
203 
204 KonqPopupMenu::KonqPopupMenu( KBookmarkManager *mgr, const KFileItemList &items,
205  KURL viewURL,
206  TDEActionCollection & actions,
207  KNewMenu * newMenu,
208  TQWidget * parentWidget,
209  bool showProperties )
210  : TQPopupMenu( parentWidget, "konq_popupmenu" ), m_actions( actions ), m_ownActions( static_cast<TQWidget *>( 0 ), "KonqPopupMenu::m_ownActions" ), m_pMenuNew( newMenu ), m_sViewURL(viewURL), m_lstItems(items), m_pManager(mgr)
211 {
212  KonqPopupFlags kpf = ( showProperties ? ShowProperties : IsLink ) | ShowNewWindow;
213  init(parentWidget, kpf, KParts::BrowserExtension::DefaultPopupItems);
214 }
215 
216 KonqPopupMenu::KonqPopupMenu( KBookmarkManager *mgr, const KFileItemList &items,
217  const KURL& viewURL,
218  TDEActionCollection & actions,
219  KNewMenu * newMenu,
220  TQWidget * parentWidget,
221  KonqPopupFlags kpf,
222  KParts::BrowserExtension::PopupFlags flags)
223  : TQPopupMenu( parentWidget, "konq_popupmenu" ), m_actions( actions ), m_ownActions( static_cast<TQWidget *>( 0 ), "KonqPopupMenu::m_ownActions" ), m_pMenuNew( newMenu ), m_sViewURL(viewURL), m_lstItems(items), m_pManager(mgr)
224 {
225  init(parentWidget, kpf, flags);
226 }
227 
228 void KonqPopupMenu::init (TQWidget * parentWidget, KonqPopupFlags kpf, KParts::BrowserExtension::PopupFlags flags)
229 {
230  d = new KonqPopupMenuPrivate;
231  d->m_parentWidget = parentWidget;
232  d->m_itemFlags = flags;
233  setup(kpf);
234 }
235 
236 int KonqPopupMenu::insertServicesSubmenus(const TQMap<TQString, ServiceList>& submenus,
237  TQDomElement& menu,
238  bool isBuiltin)
239 {
240  int count = 0;
241  TQMap<TQString, ServiceList>::ConstIterator it;
242 
243  for (it = submenus.begin(); it != submenus.end(); ++it)
244  {
245  if (it.data().isEmpty())
246  {
247  //avoid empty sub-menus
248  continue;
249  }
250 
251  TQDomElement actionSubmenu = m_doc.createElement( "menu" );
252  actionSubmenu.setAttribute( "name", "actions " + it.key() );
253  menu.appendChild( actionSubmenu );
254  TQDomElement subtext = m_doc.createElement( "text" );
255  actionSubmenu.appendChild( subtext );
256  subtext.appendChild( m_doc.createTextNode( it.key() ) );
257  count += insertServices(it.data(), actionSubmenu, isBuiltin);
258  }
259 
260  return count;
261 }
262 
263 int KonqPopupMenu::insertServices(const ServiceList& list,
264  TQDomElement& menu,
265  bool isBuiltin)
266 {
267  static int id = 1000;
268  int count = 0;
269 
270  ServiceList::const_iterator it = list.begin();
271  for( ; it != list.end(); ++it )
272  {
273  if ((*it).isEmpty())
274  {
275  if (!menu.firstChild().isNull() &&
276  menu.lastChild().toElement().tagName().lower() != "separator")
277  {
278  TQDomElement separator = m_doc.createElement( "separator" );
279  menu.appendChild(separator);
280  }
281  continue;
282  }
283 
284  if (isBuiltin || (*it).m_display == true)
285  {
286  TQCString name;
287  name.setNum( id );
288  name.prepend( isBuiltin ? "builtinservice_" : "userservice_" );
289  TDEAction * act = new TDEAction( TQString((*it).m_strName).replace('&',"&&"), 0,
290  TQT_TQOBJECT(this), TQT_SLOT( slotRunService() ),
291  &m_ownActions, name );
292 
293  if ( !(*it).m_strIcon.isEmpty() )
294  {
295  TQPixmap pix = SmallIcon( (*it).m_strIcon );
296  act->setIconSet( pix );
297  }
298 
299  addAction( act, menu ); // Add to toplevel menu
300 
301  m_mapPopupServices[ id++ ] = *it;
302  ++count;
303  }
304  }
305 
306  return count;
307 }
308 
309 bool KonqPopupMenu::KIOSKAuthorizedAction(TDEConfig& cfg)
310 {
311  if ( !cfg.hasKey( "X-TDE-AuthorizeAction") )
312  {
313  return true;
314  }
315 
316  TQStringList list = cfg.readListEntry("X-TDE-AuthorizeAction");
317  if (kapp && !list.isEmpty())
318  {
319  for(TQStringList::ConstIterator it = list.begin();
320  it != list.end();
321  ++it)
322  {
323  if (!kapp->authorize((*it).stripWhiteSpace()))
324  {
325  return false;
326  }
327  }
328  }
329 
330  return true;
331 }
332 
333 
334 void KonqPopupMenu::setup(KonqPopupFlags kpf)
335 {
336  assert( m_lstItems.count() >= 1 );
337 
338  m_ownActions.setWidget( this );
339 
340  const bool bIsLink = (kpf & IsLink);
341  bool currentDir = false;
342  bool sReading = true;
343  bool sDeleting = ( d->m_itemFlags & KParts::BrowserExtension::NoDeletion ) == 0;
344  bool sMoving = sDeleting;
345  bool sWriting = sDeleting && m_lstItems.first()->isWritable();
346  m_sMimeType = m_lstItems.first()->mimetype();
347  TQString mimeGroup = m_sMimeType.left(m_sMimeType.find('/'));
348  mode_t mode = m_lstItems.first()->mode();
349  bool isDirectory = S_ISDIR(mode);
350  bool bTrashIncluded = false;
351  bool mediaFiles = false;
352  bool isReallyLocal = m_lstItems.first()->isLocalFile();
353  bool isLocal = isReallyLocal
354  || m_lstItems.first()->url().protocol()=="media"
355  || m_lstItems.first()->url().protocol()=="system";
356  bool isTrashLink = false;
357  m_lstPopupURLs.clear();
358  int id = 0;
359  setFont(TDEGlobalSettings::menuFont());
360  m_pluginList.setAutoDelete( true );
361  m_ownActions.setHighlightingEnabled( true );
362 
363  attrName = TQString::fromLatin1( "name" );
364 
365  prepareXMLGUIStuff();
366  m_builder = new KonqPopupMenuGUIBuilder( this );
367  m_factory = new KXMLGUIFactory( m_builder );
368 
369  KURL url;
370  KFileItemListIterator it ( m_lstItems );
371  TQStringList mimeTypeList;
372  // Check whether all URLs are correct
373  for ( ; it.current(); ++it )
374  {
375  url = (*it)->url();
376 
377  // Build the list of URLs
378  m_lstPopupURLs.append( url );
379 
380  // Determine if common mode among all URLs
381  if ( mode != (*it)->mode() )
382  mode = 0; // modes are different => reset to 0
383 
384  // Determine if common mimetype among all URLs
385  if ( m_sMimeType != (*it)->mimetype() )
386  {
387  m_sMimeType = TQString::null; // mimetypes are different => null
388 
389  if ( mimeGroup != (*it)->mimetype().left((*it)->mimetype().find('/')))
390  mimeGroup = TQString::null; // mimetype groups are different as well!
391  }
392 
393  if ( mimeTypeList.findIndex( (*it)->mimetype() ) == -1 )
394  mimeTypeList << (*it)->mimetype();
395 
396  if ( isReallyLocal && !url.isLocalFile() )
397  isReallyLocal = false;
398  if ( isLocal && !url.isLocalFile() && url.protocol() != "media" && url.protocol() != "system" )
399  isLocal = false;
400 
401  if ( !bTrashIncluded && (
402  ( url.protocol() == "trash" && url.path().length() <= 1 )
403  || url.url() == "system:/trash" || url.url() == "system:/trash/" ) ) {
404  bTrashIncluded = true;
405  isLocal = false;
406  }
407 
408  if ( sReading )
409  sReading = KProtocolInfo::supportsReading( url );
410 
411  if ( sWriting )
412  sWriting = KProtocolInfo::supportsWriting( url ) && (*it)->isWritable();
413 
414  if ( sDeleting )
415  sDeleting = KProtocolInfo::supportsDeleting( url );
416 
417  if ( sMoving )
418  sMoving = KProtocolInfo::supportsMoving( url );
419  if ( (*it)->mimetype().startsWith("media/") )
420  mediaFiles = true;
421  }
422 
423  // If a local path is available, monitor that instead of the given remote URL...
424  KURL realURL = m_sViewURL;
425  if (!realURL.isLocalFile()) {
426  d->localURLSlotFired = false;
427  TDEIO::LocalURLJob* localURLJob = TDEIO::localURL(m_sViewURL);
428  if (localURLJob) {
429  connect(localURLJob, TQT_SIGNAL(localURL(TDEIO::LocalURLJob*, const KURL&, bool)), this, TQT_SLOT(slotLocalURL(TDEIO::LocalURLJob*, const KURL&, bool)));
430  connect(localURLJob, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotLocalURLKIODestroyed()));
431  while (!d->localURLSlotFired) {
432  kapp->eventLoop()->enterLoop();
433  }
434  if (d->localURLResultIsLocal) {
435  realURL = d->localURLResultURL;
436  }
437  }
438  }
439 
440  url = realURL;
441  url.cleanPath();
442 
443  //check if url is current directory
444  if ( m_lstItems.count() == 1 )
445  {
446  KURL firstPopupURL( m_lstItems.first()->url() );
447  firstPopupURL.cleanPath();
448  //kdDebug(1203) << "View path is " << url.url() << endl;
449  //kdDebug(1203) << "First popup path is " << firstPopupURL.url() << endl;
450  currentDir = firstPopupURL.equals( url, true /* ignore_trailing */, true /* ignore_internalReferenceURLS */ );
451  if ( isLocal && ((m_sMimeType == "application/x-desktop")
452  || (m_sMimeType == "media/builtin-mydocuments")
453  || (m_sMimeType == "media/builtin-mycomputer")
454  || (m_sMimeType == "media/builtin-mynetworkplaces")
455  || (m_sMimeType == "media/builtin-printers")
456  || (m_sMimeType == "media/builtin-trash")
457  || (m_sMimeType == "media/builtin-webbrowser")) ) {
458  KSimpleConfig cfg( firstPopupURL.path(), true );
459  cfg.setDesktopGroup();
460  isTrashLink = ( cfg.readEntry("Type") == "Link" && cfg.readEntry("URL") == "trash:/" );
461  }
462 
463  if ( isTrashLink ) {
464  sDeleting = false;
465  }
466  }
467 
468  m_info.m_Reading = sReading;
469  m_info.m_Writing = sWriting;
470  m_info.m_Deleting = sDeleting;
471  m_info.m_Moving = sMoving;
472  m_info.m_TrashIncluded = bTrashIncluded;
473 
474  // isCurrentTrash: popup on trash:/ itself, or on the trash.desktop link
475  bool isCurrentTrash = ( m_lstItems.count() == 1 && bTrashIncluded ) || isTrashLink;
476  bool isIntoTrash = ( url.protocol() == "trash" || url.url().startsWith( "system:/trash" ) ) && !isCurrentTrash; // trashed file, not trash:/ itself
477  //kdDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " bTrashIncluded=" << bTrashIncluded << endl;
478  bool isSingleMedium = m_lstItems.count() == 1 && mediaFiles;
479  clear();
480 
482 
483  TDEAction * act;
484 
485  if (!isCurrentTrash)
486  addMerge( "konqueror" );
487 
488  bool isKDesktop = TQCString( kapp->name() ) == "kdesktop";
489  TDEAction *actNewWindow = 0;
490 
491  if (( kpf & ShowProperties ) && isKDesktop &&
492  !kapp->authorize("editable_desktop_icons"))
493  {
494  kpf &= ~ShowProperties; // remove flag
495  }
496 
497  // Either 'newview' is in the actions we're given (probably in the tabhandling group)
498  // or we need to insert it ourselves (e.g. for kdesktop). In the first case, actNewWindow must remain 0.
499  if ( ((kpf & ShowNewWindow) != 0) && sReading )
500  {
501  TQString openStr = isKDesktop ? i18n( "&Open" ) : i18n( "Open in New &Window" );
502  actNewWindow = new TDEAction( openStr, "window-new", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupNewView() ), &m_ownActions, "newview" );
503  }
504 
505  if ( actNewWindow && !isKDesktop )
506  {
507  if (isCurrentTrash)
508  actNewWindow->setToolTip( i18n( "Open the trash in a new window" ) );
509  else if (isSingleMedium)
510  actNewWindow->setToolTip( i18n( "Open the medium in a new window") );
511  else
512  actNewWindow->setToolTip( i18n( "Open the document in a new window" ) );
513  }
514 
515  if ( S_ISDIR(mode) && sWriting && !isCurrentTrash ) // A dir, and we can create things into it
516  {
517  if ( currentDir && m_pMenuNew ) // Current dir -> add the "new" menu
518  {
519  // As requested by KNewMenu :
520  m_pMenuNew->slotCheckUpToDate();
521  m_pMenuNew->setPopupFiles( m_lstPopupURLs );
522 
523  addAction( m_pMenuNew );
524 
525  addSeparator();
526  }
527  else
528  {
529  if (d->m_itemFlags & KParts::BrowserExtension::ShowCreateDirectory)
530  {
531  TDEAction *actNewDir = new TDEAction( i18n( "Create &Folder..." ), "folder-new", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupNewDir() ), &m_ownActions, "newdir" );
532  addAction( actNewDir );
533  addSeparator();
534  }
535  }
536  } else if ( isIntoTrash ) {
537  // Trashed item, offer restoring
538  act = new TDEAction( i18n( "&Restore" ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupRestoreTrashedItems() ), &m_ownActions, "restore" );
539  addAction( act );
540  }
541 
542  if (d->m_itemFlags & KParts::BrowserExtension::ShowNavigationItems)
543  {
544  if (d->m_itemFlags & KParts::BrowserExtension::ShowUp)
545  addAction( "up" );
546  addAction( "back" );
547  addAction( "forward" );
548  if (d->m_itemFlags & KParts::BrowserExtension::ShowReload)
549  addAction( "reload" );
550  addSeparator();
551  }
552 
553  // "open in new window" is either provided by us, or by the tabhandling group
554  if (actNewWindow)
555  {
556  addAction( actNewWindow );
557  addSeparator();
558  }
559  addGroup( "tabhandling" ); // includes a separator
560 
561  if ( !bIsLink )
562  {
563  if ( !currentDir && sReading ) {
564  if ( sDeleting ) {
565  addAction( "cut" );
566  }
567  addAction( "copy" );
568  }
569 
570  if ( S_ISDIR(mode) && sWriting ) {
571  if ( currentDir )
572  addAction( "paste" );
573  else
574  addAction( "pasteto" );
575  }
576  if ( !currentDir )
577  {
578  if ( m_lstItems.count() == 1 && sMoving )
579  addAction( "rename" );
580 
581  bool addTrash = false;
582  bool addDel = false;
583 
584  if ( sMoving && !isIntoTrash && !isTrashLink )
585  addTrash = true;
586 
587  if ( sDeleting ) {
588  if ( !isLocal )
589  addDel = true;
590  else if (TDEApplication::keyboardMouseState() & TQt::ShiftButton) {
591  addTrash = false;
592  addDel = true;
593  }
594  else {
595  TDEConfigGroup configGroup( kapp->config(), "KDE" );
596  if ( configGroup.readBoolEntry( "ShowDeleteCommand", false ) )
597  addDel = true;
598  }
599  }
600 
601  if ( addTrash )
602  addAction( "trash" );
603  if ( addDel )
604  addAction( "del" );
605  }
606  }
607  if ( isCurrentTrash )
608  {
609  act = new TDEAction( i18n( "&Empty Trash Bin" ), "emptytrash", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupEmptyTrashBin() ), &m_ownActions, "empytrash" );
610  KSimpleConfig trashConfig( "trashrc", true );
611  trashConfig.setGroup( "Status" );
612  act->setEnabled( !trashConfig.readBoolEntry( "Empty", true ) );
613  addAction( act );
614  }
615  addGroup( "editactions" );
616 
617  if (d->m_itemFlags & KParts::BrowserExtension::ShowTextSelectionItems) {
618  addMerge( 0 );
619  m_factory->addClient( this );
620  return;
621  }
622 
623  if ( !isCurrentTrash && !isIntoTrash && (d->m_itemFlags & KParts::BrowserExtension::ShowBookmark))
624  {
625  addSeparator();
626  TQString caption;
627  if (currentDir)
628  {
629  bool httpPage = (m_sViewURL.protocol().find("http", 0, false) == 0);
630  if (httpPage)
631  caption = i18n("&Bookmark This Page");
632  else
633  caption = i18n("&Bookmark This Location");
634  }
635  else if (S_ISDIR(mode))
636  caption = i18n("&Bookmark This Folder");
637  else if (bIsLink)
638  caption = i18n("&Bookmark This Link");
639  else
640  caption = i18n("&Bookmark This File");
641 
642  act = new TDEAction( caption, "bookmark_add", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupAddToBookmark() ), &m_ownActions, "bookmark_add" );
643  if (m_lstItems.count() > 1)
644  act->setEnabled(false);
645  if (kapp->authorizeTDEAction("bookmarks"))
646  addAction( act );
647  if (bIsLink)
648  addGroup( "linkactions" );
649  }
650 
652 
653  const bool isSingleLocal = m_lstItems.count() == 1 && isLocal;
654  PopupServices s;
655  KURL urlForServiceMenu( m_lstItems.first()->url() );
656  if (isLocal && !isReallyLocal) { // media or system
657  bool dummy;
658  urlForServiceMenu = m_lstItems.first()->mostLocalURL(dummy);
659  }
660 
661  // 1 - Look for builtin and user-defined services
662  if ( ((m_sMimeType == "application/x-desktop")
663  || (m_sMimeType == "media/builtin-mydocuments")
664  || (m_sMimeType == "media/builtin-mycomputer")
665  || (m_sMimeType == "media/builtin-mynetworkplaces")
666  || (m_sMimeType == "media/builtin-printers")
667  || (m_sMimeType == "media/builtin-trash")
668  || (m_sMimeType == "media/builtin-webbrowser")) && isSingleLocal ) // .desktop file
669  {
670  // get builtin services, like mount/unmount
671  s.builtin = KDEDesktopMimeType::builtinServices( urlForServiceMenu );
672  const TQString path = urlForServiceMenu.path();
673  KSimpleConfig cfg( path, true );
674  cfg.setDesktopGroup();
675  const TQString priority = cfg.readEntry("X-TDE-Priority");
676  const TQString submenuName = cfg.readEntry( "X-TDE-Submenu" );
677  if ( cfg.readEntry("Type") == "Link" ) {
678  urlForServiceMenu = cfg.readEntry("URL");
679  // TODO: Do we want to make all the actions apply on the target
680  // of the .desktop file instead of the .desktop file itself?
681  }
682  ServiceList* list = s.selectList( priority, submenuName );
683  (*list) = KDEDesktopMimeType::userDefinedServices( path, cfg, urlForServiceMenu.isLocalFile() );
684  }
685 
686  if ( sReading )
687  {
688 
689  // 2 - Look for "servicesmenus" bindings (konqueror-specific user-defined services)
690 
691  // first check the .directory if this is a directory
692  if (isDirectory && isSingleLocal)
693  {
694  TQString dotDirectoryFile = urlForServiceMenu.path(1).append(".directory");
695  KSimpleConfig cfg( dotDirectoryFile, true );
696  cfg.setDesktopGroup();
697 
698  if (KIOSKAuthorizedAction(cfg))
699  {
700  const TQString priority = cfg.readEntry("X-TDE-Priority");
701  const TQString submenuName = cfg.readEntry( "X-TDE-Submenu" );
702  ServiceList* list = s.selectList( priority, submenuName );
703  (*list) += KDEDesktopMimeType::userDefinedServices( dotDirectoryFile, cfg, true );
704  }
705  }
706 
707  // findAllResources() also removes duplicates
708  const TQStringList entries = TDEGlobal::dirs()->findAllResources("data",
709  "konqueror/servicemenus/*.desktop",
710  false /* recursive */,
711  true /* unique */);
712  TQStringList::ConstIterator eIt = entries.begin();
713  const TQStringList::ConstIterator eEnd = entries.end();
714  for (; eIt != eEnd; ++eIt )
715  {
716  KSimpleConfig cfg( *eIt, true );
717  cfg.setDesktopGroup();
718 
719  if (!KIOSKAuthorizedAction(cfg))
720  {
721  continue;
722  }
723 
724  if ( cfg.hasKey( "X-TDE-ShowIfRunning" ) )
725  {
726  const TQString app = cfg.readEntry( "X-TDE-ShowIfRunning" );
727  if ( !kapp->dcopClient()->isApplicationRegistered( app.utf8() ) )
728  continue;
729  }
730  if ( cfg.hasKey( "X-TDE-ShowIfDcopCall" ) )
731  {
732  TQString dcopcall = cfg.readEntry( "X-TDE-ShowIfDcopCall" );
733  const TQCString app = TQString(dcopcall.section(' ', 0,0)).utf8();
734 
735  //if( !kapp->dcopClient()->isApplicationRegistered( app ))
736  // continue; //app does not exist so cannot send call
737 
738  TQByteArray dataToSend;
739  TQDataStream dataStream(dataToSend, IO_WriteOnly);
740  dataStream << m_lstPopupURLs;
741 
742  TQCString replyType;
743  TQByteArray replyData;
744  TQCString object = TQString(dcopcall.section(' ', 1,-2)).utf8();
745  TQString function = TQString(dcopcall.section(' ', -1));
746  if(!function.endsWith("(KURL::List)")) {
747  kdWarning() << "Desktop file " << *eIt << " contains an invalid X-TDE-ShowIfDcopCall - the function must take the exact parameter (KURL::List) and must be specified." << endl;
748  continue; //Be safe.
749  }
750 
751  if(!kapp->dcopClient()->call( app, object,
752  function.utf8(),
753  dataToSend, replyType, replyData, true, 1000))
754  continue;
755  if(replyType != "bool" || !replyData[0])
756  continue;
757 
758  }
759  if ( cfg.hasKey( "X-TDE-Protocol" ) )
760  {
761  const TQString protocol = cfg.readEntry( "X-TDE-Protocol" );
762  if ( protocol != urlForServiceMenu.protocol() )
763  continue;
764  }
765  else if ( cfg.hasKey( "X-TDE-Protocols" ) )
766  {
767  TQStringList protocols = TQStringList::split( "," , cfg.readEntry( "X-TDE-Protocols" ) );
768  if ( !protocols.contains( urlForServiceMenu.protocol() ) )
769  continue;
770  }
771  else if ( urlForServiceMenu.protocol() == "trash" || urlForServiceMenu.url().startsWith( "system:/trash" ) )
772  {
773  // Require servicemenus for the trash to ask for protocol=trash explicitely.
774  // Trashed files aren't supposed to be available for actions.
775  // One might want a servicemenu for trash.desktop itself though.
776  continue;
777  }
778 
779  if ( cfg.hasKey( "X-TDE-Require" ) )
780  {
781  const TQStringList capabilities = cfg.readListEntry( "X-TDE-Require" );
782  if ( capabilities.contains( "Write" ) && !sWriting )
783  continue;
784  }
785  if ( (cfg.hasKey( "Actions" ) || cfg.hasKey( "X-TDE-GetActionMenu") ) && cfg.hasKey( "X-TDE-ServiceTypes" ) )
786  {
787  const TQStringList types = cfg.readListEntry( "X-TDE-ServiceTypes" );
788  const TQStringList excludeTypes = cfg.readListEntry( "X-TDE-ExcludeServiceTypes" );
789  bool ok = false;
790 
791  // check for exact matches or a typeglob'd mimetype if we have a mimetype
792  for (TQStringList::ConstIterator it = types.begin();
793  it != types.end() && !ok;
794  ++it)
795  {
796  // first check if we have an all mimetype
797  bool checkTheMimetypes = false;
798  if (*it == "all/all" ||
799  *it == "allfiles" /*compat with KDE up to 3.0.3*/)
800  {
801  checkTheMimetypes = true;
802  }
803 
804  // next, do we match all files?
805  if (!ok &&
806  !isDirectory &&
807  *it == "all/allfiles")
808  {
809  checkTheMimetypes = true;
810  }
811 
812  // if we have a mimetype, see if we have an exact or a type globbed match
813  if ((!ok &&
814  (!m_sMimeType.isEmpty() &&
815  *it == m_sMimeType)) ||
816  (!mimeGroup.isEmpty() &&
817  (((*it).right(1) == "*") &&
818  (*it).left((*it).find('/')) == mimeGroup)))
819  {
820  checkTheMimetypes = true;
821  }
822 
823  if (checkTheMimetypes)
824  {
825  ok = true;
826  for (TQStringList::ConstIterator itex = excludeTypes.begin(); itex != excludeTypes.end(); ++itex)
827  {
828  if( ((*itex).right(1) == "*" && (*itex).left((*itex).find('/')) == mimeGroup) ||
829  ((*itex) == m_sMimeType) )
830  {
831  ok = false;
832  break;
833  }
834  }
835  }
836  }
837 
838  if ( ok )
839  {
840  const TQString priority = cfg.readEntry("X-TDE-Priority");
841  const TQString submenuName = cfg.readEntry( "X-TDE-Submenu" );
842 
843  ServiceList* list = s.selectList( priority, submenuName );
844  (*list) += KDEDesktopMimeType::userDefinedServices( *eIt, cfg, url.isLocalFile(), m_lstPopupURLs );
845  }
846  }
847  }
848 
849  TDETrader::OfferList offers;
850 
851  if (kapp->authorizeTDEAction("openwith"))
852  {
853  TQString constraint = "Type == 'Application' and DesktopEntryName != 'kfmclient' and DesktopEntryName != 'kfmclient_dir' and DesktopEntryName != 'kfmclient_html'";
854  TQString subConstraint = " and '%1' in ServiceTypes";
855 
856  TQStringList::ConstIterator it = mimeTypeList.begin();
857  TQStringList::ConstIterator end = mimeTypeList.end();
858  Q_ASSERT( it != end );
859  TQString first = *it;
860  ++it;
861  while ( it != end ) {
862  constraint += subConstraint.arg( *it );
863  ++it;
864  }
865 
866  offers = TDETrader::self()->query( first, constraint );
867  }
868 
870 
871  m_mapPopup.clear();
872  m_mapPopupServices.clear();
873  // "Open With..." for folders is really not very useful, especially for remote folders.
874  // (media:/something, or trash:/, or ftp://...)
875  if ( !isDirectory || isLocal )
876  {
877  if ( hasAction() )
878  addSeparator();
879 
880  if ( !offers.isEmpty() )
881  {
882  // First block, app and preview offers
883  id = 1;
884 
885  TQDomElement menu = m_menuElement;
886 
887  if ( offers.count() > 1 ) // submenu 'open with'
888  {
889  menu = m_doc.createElement( "menu" );
890  menu.setAttribute( "name", "openwith submenu" );
891  m_menuElement.appendChild( menu );
892  TQDomElement text = m_doc.createElement( "text" );
893  menu.appendChild( text );
894  text.appendChild( m_doc.createTextNode( i18n("&Open With") ) );
895  }
896 
897  TDETrader::OfferList::ConstIterator it = offers.begin();
898  for( ; it != offers.end(); it++ )
899  {
900  KService::Ptr service = (*it);
901 
902  // Skip OnlyShowIn=Foo and NotShowIn=TDE entries,
903  // but still offer NoDisplay=true entries, that's the
904  // whole point of such desktop files. This is why we don't
905  // use service->noDisplay() here.
906  const TQString onlyShowIn = service->property("OnlyShowIn", TQVariant::String).toString();
907  if ( !onlyShowIn.isEmpty() ) {
908  const TQStringList aList = TQStringList::split(';', onlyShowIn);
909  if (!aList.contains("TDE"))
910  continue;
911  }
912  const TQString notShowIn = service->property("NotShowIn", TQVariant::String).toString();
913  if ( !notShowIn.isEmpty() ) {
914  const TQStringList aList = TQStringList::split(';', notShowIn);
915  if (aList.contains("TDE"))
916  continue;
917  }
918 
919  TQCString nam;
920  nam.setNum( id );
921 
922  TQString actionName( (*it)->name().replace("&", "&&") );
923  if ( menu == m_menuElement ) // no submenu -> prefix single offer
924  actionName = i18n( "Open with %1" ).arg( actionName );
925 
926  act = new TDEAction( actionName, (*it)->pixmap( TDEIcon::Small ), 0,
927  TQT_TQOBJECT(this), TQT_SLOT( slotRunService() ),
928  &m_ownActions, nam.prepend( "appservice_" ) );
929  addAction( act, menu );
930 
931  m_mapPopup[ id++ ] = *it;
932  }
933 
934  TQString openWithActionName;
935  if ( menu != m_menuElement ) // submenu
936  {
937  addSeparator( menu );
938  openWithActionName = i18n( "&Other..." );
939  }
940  else
941  {
942  openWithActionName = i18n( "&Open With..." );
943  }
944  TDEAction *openWithAct = new TDEAction( openWithActionName, 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupOpenWith() ), &m_ownActions, "openwith" );
945  addAction( openWithAct, menu );
946  }
947  else // no app offers -> Open With...
948  {
949  act = new TDEAction( i18n( "&Open With..." ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupOpenWith() ), &m_ownActions, "openwith" );
950  addAction( act );
951  }
952 
953  }
954  addGroup( "preview" );
955  }
956 
957  // Second block, builtin + user
958  TQDomElement actionMenu = m_menuElement;
959  int userItemCount = 0;
960  if (s.user.count() + s.userSubmenus.count() +
961  s.userPriority.count() + s.userPrioritySubmenus.count() > 1)
962  {
963  // we have more than one item, so let's make a submenu
964  actionMenu = m_doc.createElement( "menu" );
965  actionMenu.setAttribute( "name", "actions submenu" );
966  m_menuElement.appendChild( actionMenu );
967  TQDomElement text = m_doc.createElement( "text" );
968  actionMenu.appendChild( text );
969  text.appendChild( m_doc.createTextNode( i18n("Ac&tions") ) );
970  }
971 
972  userItemCount += insertServicesSubmenus(s.userPrioritySubmenus, actionMenu, false);
973  userItemCount += insertServices(s.userPriority, actionMenu, false);
974 
975  // see if we need to put a separator between our priority items and our regular items
976  if (userItemCount > 0 &&
977  (s.user.count() > 0 ||
978  s.userSubmenus.count() > 0 ||
979  s.builtin.count() > 0) &&
980  actionMenu.lastChild().toElement().tagName().lower() != "separator")
981  {
982  TQDomElement separator = m_doc.createElement( "separator" );
983  actionMenu.appendChild(separator);
984  }
985 
986  userItemCount += insertServicesSubmenus(s.userSubmenus, actionMenu, false);
987  userItemCount += insertServices(s.user, actionMenu, false);
988  userItemCount += insertServices(s.builtin, m_menuElement, true);
989 
990  userItemCount += insertServicesSubmenus(s.userToplevelSubmenus, m_menuElement, false);
991  userItemCount += insertServices(s.userToplevel, m_menuElement, false);
992 
993  if ( userItemCount > 0 )
994  {
995  addPendingSeparator();
996  }
997 
998  if ( !isCurrentTrash && !isIntoTrash && !mediaFiles && sReading )
999  addPlugins(); // now it's time to add plugins
1000 
1001  if ( KPropertiesDialog::canDisplay( m_lstItems ) && (kpf & ShowProperties) )
1002  {
1003  act = new TDEAction( i18n( "&Properties" ), 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupProperties() ),
1004  &m_ownActions, "properties" );
1005  addAction( act );
1006  }
1007 
1008  while ( !m_menuElement.lastChild().isNull() &&
1009  m_menuElement.lastChild().toElement().tagName().lower() == "separator" )
1010  m_menuElement.removeChild( m_menuElement.lastChild() );
1011 
1012  if ( isDirectory && isLocal )
1013  {
1014  if ( KFileShare::authorization() == KFileShare::Authorized )
1015  {
1016  addSeparator();
1017  act = new TDEAction( i18n("Share"), 0, TQT_TQOBJECT(this), TQT_SLOT( slotOpenShareFileDialog() ),
1018  &m_ownActions, "sharefile" );
1019  addAction( act );
1020  }
1021  }
1022 
1023  addMerge( 0 );
1024  //kdDebug() << k_funcinfo << domDocument().toString() << endl;
1025 
1026  m_factory->addClient( this );
1027 }
1028 
1029 void KonqPopupMenu::slotOpenShareFileDialog()
1030 {
1031  KPropertiesDialog* dlg = showPropertiesDialog();
1032  dlg->showFileSharingPage();
1033 }
1034 
1035 KonqPopupMenu::~KonqPopupMenu()
1036 {
1037  m_pluginList.clear();
1038  delete m_factory;
1039  delete m_builder;
1040  delete d;
1041  //kdDebug(1203) << "~KonqPopupMenu leave" << endl;
1042 }
1043 
1044 void KonqPopupMenu::setURLTitle( const TQString& urlTitle )
1045 {
1046  d->m_urlTitle = urlTitle;
1047 }
1048 
1049 void KonqPopupMenu::slotPopupNewView()
1050 {
1051  KURL::List::ConstIterator it = m_lstPopupURLs.begin();
1052  for ( ; it != m_lstPopupURLs.end(); it++ )
1053  (void) new KRun(*it);
1054 }
1055 
1056 void KonqPopupMenu::slotPopupNewDir()
1057 {
1058  if (m_lstPopupURLs.empty())
1059  return;
1060 
1061  KonqOperations::newDir(d->m_parentWidget, m_lstPopupURLs.first());
1062 }
1063 
1064 void KonqPopupMenu::slotPopupEmptyTrashBin()
1065 {
1066  KonqOperations::emptyTrash();
1067 }
1068 
1069 void KonqPopupMenu::slotPopupRestoreTrashedItems()
1070 {
1071  KonqOperations::restoreTrashedItems( m_lstPopupURLs );
1072 }
1073 
1074 void KonqPopupMenu::slotPopupOpenWith()
1075 {
1076  KRun::displayOpenWithDialog( m_lstPopupURLs );
1077 }
1078 
1079 void KonqPopupMenu::slotPopupAddToBookmark()
1080 {
1081  KBookmarkGroup root;
1082  if ( m_lstPopupURLs.count() == 1 ) {
1083  KURL url = m_lstPopupURLs.first();
1084  TQString title = d->m_urlTitle.isEmpty() ? url.prettyURL() : d->m_urlTitle;
1085  root = m_pManager->addBookmarkDialog( url.prettyURL(), title );
1086  }
1087  else
1088  {
1089  root = m_pManager->root();
1090  KURL::List::ConstIterator it = m_lstPopupURLs.begin();
1091  for ( ; it != m_lstPopupURLs.end(); it++ )
1092  root.addBookmark( m_pManager, (*it).prettyURL(), (*it) );
1093  }
1094  m_pManager->emitChanged( root );
1095 }
1096 
1097 void KonqPopupMenu::slotRunService()
1098 {
1099  TQCString senderName = TQT_TQOBJECT_CONST(sender())->name();
1100  int id = senderName.mid( senderName.find( '_' ) + 1 ).toInt();
1101 
1102  // Is it a usual service (application)
1103  TQMap<int,KService::Ptr>::Iterator it = m_mapPopup.find( id );
1104  if ( it != m_mapPopup.end() )
1105  {
1106  KRun::run( **it, m_lstPopupURLs );
1107  return;
1108  }
1109 
1110  // Is it a service specific to desktop entry files ?
1111  TQMap<int,KDEDesktopMimeType::Service>::Iterator it2 = m_mapPopupServices.find( id );
1112  if ( it2 != m_mapPopupServices.end() )
1113  {
1114  KDEDesktopMimeType::executeService( m_lstPopupURLs, it2.data() );
1115  }
1116 
1117  return;
1118 }
1119 
1120 void KonqPopupMenu::slotPopupMimeType()
1121 {
1122  KonqOperations::editMimeType( m_sMimeType );
1123 }
1124 
1125 void KonqPopupMenu::slotPopupProperties()
1126 {
1127  (void)showPropertiesDialog();
1128 }
1129 
1130 KPropertiesDialog* KonqPopupMenu::showPropertiesDialog()
1131 {
1132  // It may be that the tdefileitem was created by hand
1133  // (see KonqKfmIconView::slotMouseButtonPressed)
1134  // In that case, we can get more precise info in the properties
1135  // (like permissions) if we stat the URL.
1136  if ( m_lstItems.count() == 1 )
1137  {
1138  KFileItem * item = m_lstItems.first();
1139  if (item->entry().count() == 0) // this item wasn't listed by a slave
1140  {
1141  // KPropertiesDialog will use stat to get more info on the file
1142  return new KPropertiesDialog( item->url(), d->m_parentWidget );
1143  }
1144  }
1145  return new KPropertiesDialog( m_lstItems, d->m_parentWidget );
1146 }
1147 
1148 TDEAction *KonqPopupMenu::action( const TQDomElement &element ) const
1149 {
1150  TQCString name = element.attribute( attrName ).ascii();
1151  TDEAction *res = m_ownActions.action( static_cast<const char *>(name) );
1152 
1153  if ( !res )
1154  res = m_actions.action( static_cast<const char *>(name) );
1155 
1156  if ( !res && m_pMenuNew && strcmp( name, m_pMenuNew->name() ) == 0 )
1157  return m_pMenuNew;
1158 
1159  return res;
1160 }
1161 
1162 TDEActionCollection *KonqPopupMenu::actionCollection() const
1163 {
1164  return const_cast<TDEActionCollection *>( &m_ownActions );
1165 }
1166 
1167 TQString KonqPopupMenu::mimeType() const
1168 {
1169  return m_sMimeType;
1170 }
1171 
1172 KonqPopupMenu::ProtocolInfo KonqPopupMenu::protocolInfo() const
1173 {
1174  return m_info;
1175 }
1176 
1177 void KonqPopupMenu::addPlugins()
1178 {
1179  // search for Konq_PopupMenuPlugins inspired by simons kpropsdlg
1180  //search for a plugin with the right protocol
1181  TDETrader::OfferList plugin_offers;
1182  unsigned int pluginCount = 0;
1183  plugin_offers = TDETrader::self()->query( m_sMimeType.isNull() ? TQString::fromLatin1( "all/all" ) : m_sMimeType, "'KonqPopupMenu/Plugin' in ServiceTypes");
1184  if ( plugin_offers.isEmpty() )
1185  return; // no plugins installed do not bother about it
1186 
1187  TDETrader::OfferList::ConstIterator iterator = plugin_offers.begin();
1188  TDETrader::OfferList::ConstIterator end = plugin_offers.end();
1189 
1190  addGroup( "plugins" );
1191  // travers the offerlist
1192  for(; iterator != end; ++iterator, ++pluginCount ) {
1193  //kdDebug() << (*iterator)->library() << endl;
1194  KonqPopupMenuPlugin *plugin =
1195  KParts::ComponentFactory::
1196  createInstanceFromLibrary<KonqPopupMenuPlugin>( TQFile::encodeName( (*iterator)->library() ),
1197  TQT_TQOBJECT(this),
1198  (*iterator)->name().latin1() );
1199  if ( !plugin )
1200  continue;
1201  // This make the kuick plugin insert its stuff above "Properties"
1202  TQString pluginClientName = TQString::fromLatin1( "Plugin%1" ).arg( pluginCount );
1203  addMerge( pluginClientName );
1204  plugin->domDocument().documentElement().setAttribute( "name", pluginClientName );
1205  m_pluginList.append( plugin );
1206  insertChildClient( plugin );
1207  }
1208 
1209  // ## Where is this used?
1210  addMerge( "plugins" );
1211 }
1212 
1213 KURL KonqPopupMenu::url() const // ### should be viewURL()
1214 {
1215  return m_sViewURL;
1216 }
1217 
1218 KFileItemList KonqPopupMenu::fileItemList() const
1219 {
1220  return m_lstItems;
1221 }
1222 
1223 KURL::List KonqPopupMenu::popupURLList() const
1224 {
1225  return m_lstPopupURLs;
1226 }
1227 
1228 void KonqPopupMenu::slotLocalURL(TDEIO::LocalURLJob *job, const KURL& url, bool isLocal)
1229 {
1230  d->localURLSlotFired = true;
1231  d->localURLResultURL = url;
1232  d->localURLResultIsLocal = isLocal;
1233  kapp->eventLoop()->exitLoop();
1234 }
1235 
1236 void KonqPopupMenu::slotLocalURLKIODestroyed()
1237 {
1238  if (!d->localURLSlotFired) {
1239  d->localURLSlotFired = true;
1240  d->localURLResultURL = KURL();
1241  d->localURLResultIsLocal = false;
1242  kapp->eventLoop()->exitLoop();
1243  }
1244 }
1245 
1250 KonqPopupMenuPlugin::KonqPopupMenuPlugin( KonqPopupMenu *parent, const char *name )
1251  : TQObject( parent, name )
1252 {
1253 }
1254 
1255 KonqPopupMenuPlugin::~KonqPopupMenuPlugin()
1256 {
1257 }
1258 
1259 #include "konq_popupmenu.moc"
KonqPopupMenu::IsLink
HTML link. If set, we won&#39;t have cut/copy/paste, and we&#39;ll say "bookmark this link".
Definition: konq_popupmenu.h:68
KonqPopupMenu::action
virtual TDEAction * action(const TQDomElement &element) const
Reimplemented for internal purpose.
Definition: konq_popupmenu.cc:1148
KonqPopupMenu::ShowProperties
whether to show the "Properties" menu item
Definition: konq_popupmenu.h:67
KonqPopupMenu::KonqPopupMenu
KonqPopupMenu(KBookmarkManager *manager, const KFileItemList &items, KURL viewURL, TDEActionCollection &actions, KNewMenu *newMenu, bool showPropertiesAndFileType=true) KDE_DEPRECATED
Definition: konq_popupmenu.cc:191
KonqPopupMenu::~KonqPopupMenu
~KonqPopupMenu()
Don&#39;t forget to destroy the object.
Definition: konq_popupmenu.cc:1035
KonqPopupMenu::KonqPopupFlags
uint KonqPopupFlags
Flags set by the calling application (konqueror/kdesktop), unlike KParts::BrowserExtension::PopupFlag...
Definition: konq_popupmenu.h:65
KNewMenu::setPopupFiles
void setPopupFiles(KURL::List &_files)
Set the files the popup is shown for Call this before showing up the menu.
Definition: knewmenu.h:68
KNewMenu::slotCheckUpToDate
void slotCheckUpToDate()
Checks if updating the list is necessary IMPORTANT : Call this in the slot for aboutToShow.
Definition: knewmenu.cc:99
KonqXMLGUIClient::addPendingSeparator
void addPendingSeparator()
only add a separator if an action is added afterwards
Definition: konq_xmlguiclient.cc:147
KonqPopupMenu
This class implements the popup menu for URLs in konqueror and kdesktop It&#39;s usage is very simple : o...
Definition: konq_popupmenu.h:56
KonqPopupMenu::setURLTitle
void setURLTitle(const TQString &urlTitle)
Set the title of the URL, when the popupmenu is opened for a single URL.
Definition: konq_popupmenu.cc:1044
KonqOperations::editMimeType
static void editMimeType(const TQString &mimeType)
Pop up properties dialog for mimetype mimeType.
Definition: konq_operations.cc:77
KNewMenu
The &#39;New&#39; submenu, both for the File menu and the RMB popup menu.
Definition: knewmenu.h:52
KonqOperations::newDir
static void newDir(TQWidget *parent, const KURL &baseURL)
Ask for the name of a new directory and create it.
Definition: konq_operations.cc:733
KParts
Definition: konq_dirpart.h:32

libkonq

Skip menu "libkonq"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libkonq

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