[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: Konqueror RMB popup menu & khtml referrer
From: Waldo Bastian <bastian () kde ! org>
Date: 2003-08-11 11:36:41
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 11 August 2003 12:57, David Faure wrote:
> On Sunday 10 August 2003 16:53, Waldo Bastian wrote:
> > Hi David,
> >
> > I have a problem with konqie's popup menu. There are several actions that
> > operate on the selected URL, such as "Open in New Window" and for those
> > to work correctly, the referrer must be set correctly. Konqueror doesn't
> > know how to do that, it only knows about the URL of the part as a whole,
> > but it doesn't know about frames that may influence the referrer. So
> > khtml should tell konqueror about the refererrer.
>
> This could be accessible via a property of the part....
>
> > I have made a patch that makes it possible to attach the referrer to a
> > KFileItem.
>
> I don't like this idea very much. KFileItems tend to be created in very
> large number, and when listing /usr we really don't need a referrer per
> item (ok an empty QString is only 4 bytes, but still...). I feel that
> KFileItem is much too low-level for this kind of information.
It doesn't cause any overhead, see attached patch.
> > now everything works great except that void
> > KonqMainWindow::slotPopupMenu(...) sets "bool showPropsAndFileType"
> > depending on the function signature that was used.
>
> Hmm, yeah, the problem of a generic framework which wants to adapt
> popup menus to the kind of part requesting the popupmenu....
>
> > Any ideas how to set showPropsAndFileType based on something else?
>
> Can I suggest to rewind a little bit on the possible solutions?
>
> We have 4 variants of the popupMenu signal already... I feel that this
> should have been done with a struct as parameter instead, like we did with
> URLArgs. What about adding a 5th popupMenu signal, with a struct as param?
> In fact we could even use URLArgs for this, AFAICS, since opening the url
> which the popup menu is about, is just like a openURL call - we need all
> the URLArgs data, including all the metadata etc.
>
> So I'd suggest
> void popupMenu( KXMLGUIClient *client,
> const QPoint &global, const KURL &url,
> const URLArgs& args, mode_t mode = (mode_t)-1 );
>
> (Note that the URLArgs ship the mimetype already, in the "serviceType"
> member).
Fine with me as well. I didn't want to add yet another popupMenu signal since
we have so many already.
Cheers,
Waldo
- --
bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE/N3/JN4pvrENfboIRAqOFAJ46Se4ZZ6+sdAvj8bCQPdBuRoup4QCgmKsn
LWvsZpoD3qAN3SHq3rIk1wM=
=Tesj
-----END PGP SIGNATURE-----
["kfileitem.patch" (text/x-diff)]
Index: kfileitem.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kfileitem.cpp,v
retrieving revision 1.147
diff -u -r1.147 kfileitem.cpp
--- kfileitem.cpp 24 Jul 2003 11:04:59 -0000 1.147
+++ kfileitem.cpp 11 Aug 2003 11:29:19 -0000
@@ -780,6 +780,33 @@
return m_metaInfo;
}
+QString KFileItem::referrer() const
+{
+ // Extract it from the KIO::UDSEntry
+ KIO::UDSEntry::ConstIterator it = m_entry.begin();
+ for( ; it != m_entry.end(); it++ )
+ if ( (*it).m_uds == KIO::UDS_REFERRER )
+ return (*it).m_str;
+
+ return QString::null;
+}
+
+void KFileItem::setReferrer(const QString &_referrer)
+{
+ KIO::UDSEntry::Iterator it = m_entry.begin();
+ for( ; it != m_entry.end(); it++ )
+ if ( (*it).m_uds == KIO::UDS_REFERRER )
+ {
+ (*it).m_str = _referrer;
+ return;
+ }
+
+ KIO::UDSAtom ref;
+ ref.m_uds = KIO::UDS_REFERRER;
+ ref.m_str = _referrer;
+ m_entry.prepend(ref);
+}
+
void KFileItem::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
Index: kfileitem.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kfileitem.h,v
retrieving revision 1.85
diff -u -r1.85 kfileitem.h
--- kfileitem.h 9 Dec 2002 12:20:28 -0000 1.85
+++ kfileitem.h 11 Aug 2003 11:29:19 -0000
@@ -432,6 +432,17 @@
*/
void assign( const KFileItem & item );
+ /**
+ * Returns the referrer to use when opening this item
+ * @since 3.2
+ */
+ QString referrer() const;
+
+ /**
+ * Sets the referrer to use when opening this item
+ * @since 3.2
+ */
+ void setReferrer(const QString &_referrer);
/////////////
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic