summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--konqueror/konq_mainwindow.cc7
-rw-r--r--libkonq/konq_popupmenu.cc76
-rw-r--r--libkonq/konq_xmlguiclient.cc17
-rw-r--r--libkonq/konq_xmlguiclient.h22
4 files changed, 69 insertions, 53 deletions
diff --git a/konqueror/konq_mainwindow.cc b/konqueror/konq_mainwindow.cc
index 193d2ebca..4ae1f63c1 100644
--- a/konqueror/konq_mainwindow.cc
+++ b/konqueror/konq_mainwindow.cc
@@ -4789,7 +4789,12 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const TQPoint &_globa
connectActionCollection( pPopupMenu->actionCollection() );
- pPopupMenu->factory()->addClient( konqyMenuClient );
+ if (pPopupMenu->hasGroup("tabhandling"))
+ {
+ // "tabhandling" group in inserted in the popup menu if no encrypted media devices are part of "_items"
+ // see libkonq/konq_popupmenu.cc KonqPopupMenu::setup() method
+ pPopupMenu->factory()->addClient( konqyMenuClient );
+ }
if ( client )
pPopupMenu->factory()->addClient( client );
diff --git a/libkonq/konq_popupmenu.cc b/libkonq/konq_popupmenu.cc
index 482c152c5..6a562526c 100644
--- a/libkonq/konq_popupmenu.cc
+++ b/libkonq/konq_popupmenu.cc
@@ -337,22 +337,22 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
m_ownActions.setWidget( this );
- const bool bIsLink = (kpf & IsLink);
- bool currentDir = false;
- bool sReading = true;
- bool sDeleting = ( d->m_itemFlags & KParts::BrowserExtension::NoDeletion ) == 0;
- bool sMoving = sDeleting;
- bool sWriting = sDeleting && m_lstItems.first()->isWritable();
- m_sMimeType = m_lstItems.first()->mimetype();
+ const bool bIsLink = (kpf & IsLink);
+ bool currentDir = false;
+ bool sReading = true;
+ bool sDeleting = ( d->m_itemFlags & KParts::BrowserExtension::NoDeletion ) == 0;
+ bool sMoving = sDeleting;
+ bool sWriting = sDeleting && m_lstItems.first()->isWritable();
+ m_sMimeType = m_lstItems.first()->mimetype();
TQString mimeGroup = m_sMimeType.left(m_sMimeType.find('/'));
- mode_t mode = m_lstItems.first()->mode();
- bool isDirectory = S_ISDIR(mode);
- bool bTrashIncluded = false;
- bool mediaFiles = false;
- bool isReallyLocal = m_lstItems.first()->isLocalFile();
- bool isLocal = isReallyLocal
- || m_lstItems.first()->url().protocol()=="media"
- || m_lstItems.first()->url().protocol()=="system";
+ mode_t mode = m_lstItems.first()->mode();
+ bool isDirectory = S_ISDIR(mode);
+ bool isMediaFile = false;
+ bool isEncryptedMediaFile = false;
+ bool isReallyLocal = m_lstItems.first()->isLocalFile();
+ bool isLocal = isReallyLocal || m_lstItems.first()->url().protocol()=="media" ||
+ m_lstItems.first()->url().protocol()=="system";
+ bool isTrashIncluded = false;
bool isTrashLink = false;
m_lstPopupURLs.clear();
int id = 0;
@@ -398,10 +398,10 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
if ( isLocal && !url.isLocalFile() && url.protocol() != "media" && url.protocol() != "system" )
isLocal = false;
- if ( !bTrashIncluded && (
+ if ( !isTrashIncluded && (
( url.protocol() == "trash" && url.path().length() <= 1 )
|| url.url() == "system:/trash" || url.url() == "system:/trash/" ) ) {
- bTrashIncluded = true;
+ isTrashIncluded = true;
isLocal = false;
}
@@ -416,8 +416,12 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
if ( sMoving )
sMoving = KProtocolInfo::supportsMoving( url );
- if ( (*it)->mimetype().startsWith("media/") )
- mediaFiles = true;
+ if ( (*it)->mimetype().startsWith("media/") ) {
+ isMediaFile = true;
+ if ( (*it)->mimetype().contains("encrypted")) {
+ isEncryptedMediaFile = true;
+ }
+ }
}
// If a local path is available, monitor that instead of the given remote URL...
@@ -469,13 +473,12 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
m_info.m_Writing = sWriting;
m_info.m_Deleting = sDeleting;
m_info.m_Moving = sMoving;
- m_info.m_TrashIncluded = bTrashIncluded;
+ m_info.m_TrashIncluded = isTrashIncluded;
// isCurrentTrash: popup on trash:/ itself, or on the trash.desktop link
- bool isCurrentTrash = ( m_lstItems.count() == 1 && bTrashIncluded ) || isTrashLink;
+ bool isCurrentTrash = ( m_lstItems.count() == 1 && isTrashIncluded ) || isTrashLink;
bool isIntoTrash = ( url.protocol() == "trash" || url.url().startsWith( "system:/trash" ) ) && !isCurrentTrash; // trashed file, not trash:/ itself
- //kdDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " bTrashIncluded=" << bTrashIncluded << endl;
- bool isSingleMedium = m_lstItems.count() == 1 && mediaFiles;
+ //kdDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " isTrashIncluded=" << isTrashIncluded << endl;
clear();
//////////////////////////////////////////////////////////////////////////
@@ -486,7 +489,6 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
addMerge( "konqueror" );
bool isKDesktop = TQCString( kapp->name() ) == "kdesktop";
- TDEAction *actNewWindow = 0;
if (( kpf & ShowProperties ) && isKDesktop &&
!kapp->authorize("editable_desktop_icons"))
@@ -496,20 +498,13 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
// Either 'newview' is in the actions we're given (probably in the tabhandling group)
// or we need to insert it ourselves (e.g. for kdesktop). In the first case, actNewWindow must remain 0.
- if ( ((kpf & ShowNewWindow) != 0) && sReading )
+ if ( ((kpf & ShowNewWindow) != 0) && sReading && !isEncryptedMediaFile)
{
TQString openStr = isKDesktop ? i18n( "&Open" ) : i18n( "Open in New &Window" );
- actNewWindow = new TDEAction( openStr, "window-new", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupNewView() ), &m_ownActions, "newview" );
- }
-
- if ( actNewWindow && !isKDesktop )
- {
- if (isCurrentTrash)
- actNewWindow->setToolTip( i18n( "Open the trash in a new window" ) );
- else if (isSingleMedium)
- actNewWindow->setToolTip( i18n( "Open the medium in a new window") );
- else
- actNewWindow->setToolTip( i18n( "Open the document in a new window" ) );
+ TDEAction *actNewWindow = new TDEAction( openStr, "window-new", 0, TQT_TQOBJECT(this), TQT_SLOT( slotPopupNewView() ), &m_ownActions, "newview" );
+ actNewWindow->setToolTip( i18n( "Open item in a new window" ) );
+ addAction( actNewWindow );
+ addSeparator();
}
if ( S_ISDIR(mode) && sWriting && !isCurrentTrash ) // A dir, and we can create things into it
@@ -550,13 +545,10 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
addSeparator();
}
- // "open in new window" is either provided by us, or by the tabhandling group
- if (actNewWindow)
+ if (!isEncryptedMediaFile)
{
- addAction( actNewWindow );
- addSeparator();
+ addGroup( "tabhandling" ); // includes a separator
}
- addGroup( "tabhandling" ); // includes a separator
if ( !bIsLink )
{
@@ -995,7 +987,7 @@ void KonqPopupMenu::setup(KonqPopupFlags kpf)
addPendingSeparator();
}
- if ( !isCurrentTrash && !isIntoTrash && !mediaFiles && sReading )
+ if ( !isCurrentTrash && !isIntoTrash && !isMediaFile && sReading )
addPlugins(); // now it's time to add plugins
if ( KPropertiesDialog::canDisplay( m_lstItems ) && (kpf & ShowProperties) )
diff --git a/libkonq/konq_xmlguiclient.cc b/libkonq/konq_xmlguiclient.cc
index c3c7215b9..a12d237c6 100644
--- a/libkonq/konq_xmlguiclient.cc
+++ b/libkonq/konq_xmlguiclient.cc
@@ -154,4 +154,21 @@ bool KonqXMLGUIClient::hasAction() const
return d->hasAction;
}
+bool KonqXMLGUIClient::hasGroup(const TQString &name) const
+{
+ if (name.isEmpty())
+ {
+ return false;
+ }
+ TQDomNodeList groups = m_doc.elementsByTagName("definegroup");
+ for (uint idx = 0; idx < groups.count(); ++idx)
+ {
+ TQDomElement group = groups.item(idx).toElement();
+ if (group.hasAttribute(d->attrName) && group.attribute(d->attrName) == name)
+ {
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/libkonq/konq_xmlguiclient.h b/libkonq/konq_xmlguiclient.h
index 685b58a34..5696573da 100644
--- a/libkonq/konq_xmlguiclient.h
+++ b/libkonq/konq_xmlguiclient.h
@@ -34,24 +34,26 @@
class LIBKONQ_EXPORT KonqXMLGUIClient : public KXMLGUIClient
{
public:
- KonqXMLGUIClient( );
- KonqXMLGUIClient( KXMLGUIClient *parent );
- virtual ~KonqXMLGUIClient( );
+ KonqXMLGUIClient();
+ KonqXMLGUIClient(KXMLGUIClient *parent);
+ virtual ~KonqXMLGUIClient();
/**
* Reimplemented for internal purpose
*/
- TQDomDocument domDocument( ) const;
+ TQDomDocument domDocument() const;
+ TQDomElement DomElement() const; // KDE4: s/D/d/
- TQDomElement DomElement( ) const; // KDE4: s/D/d/
+ // @return true if the group named "name" exists
+ bool hasGroup(const TQString &name) const;
protected:
- void addAction( TDEAction *action, const TQDomElement &menu = TQDomElement() );
- void addAction( const char *name, const TQDomElement &menu = TQDomElement() );
- void addSeparator( const TQDomElement &menu = TQDomElement() );
+ void addAction(TDEAction *action, const TQDomElement &menu = TQDomElement());
+ void addAction(const char *name, const TQDomElement &menu = TQDomElement());
+ void addSeparator(const TQDomElement &menu = TQDomElement());
/// only add a separator if an action is added afterwards
void addPendingSeparator();
- void addGroup( const TQString &grp );
- void addMerge( const TQString &name );
+ void addGroup(const TQString &grp);
+ void addMerge(const TQString &name);
// @return true if addAction was called at least once
bool hasAction() const;