[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KDE1.1.2/PATCH: kfm (#1590)
From:       Waldo Bastian <bastian () suse ! de>
Date:       1999-08-12 14:25:16
[Download RAW message or body]

Hiya,

Please test the following patch so that I can commit it.

Cheers,
Waldo

-- Bug report 1590 --

Package: klipper 
Version: 0.1

When attempt to cut and paste a block of text from a web page (browsing using
kfm), if that block contains a URL, when I attempt to paste it into a number of
other applications (I've tried kedit and kmail composer as well as kjots), only
the URL is pasted into the new application.

I recognize that this may not be a klipper bug -- maybe klipper is only a
history log.  (Sorry I can't give better diagnostic information. I'm an
"end-user" user -- not a programmer (though we're trying to fix that,
Kernighan and Ritchie are on my reading table.)). 

Lisa Williams

PS.  Just upgraded to 1.1.1 and I think it's fantastic.  I'm due to delete my
Windows partition any day now.  Keep up the good work. 

-- End of bugreport --

["kdebase.kfm.12-08-99.diff2" (text/x-c++)]

? cvs.status
? cvs.diff
Index: kfmgui.cpp
===================================================================
RCS file: /home/kde/kdebase/kfm/Attic/kfmgui.cpp,v
retrieving revision 1.167.2.15
diff -u -r1.167.2.15 kfmgui.cpp
--- kfmgui.cpp	1999/08/05 07:17:14	1.167.2.15
+++ kfmgui.cpp	1999/08/12 14:28:39
@@ -606,6 +606,9 @@
     connect( view, SIGNAL( setTitle(const char *)), this, SLOT( slotTitle(const char \
                *)) );
     connect( view, SIGNAL( historyUpdate( bool, bool ) ), this, SLOT( \
                slotUpdateHistory( bool, bool ) ) );
     connect( view, SIGNAL( newURL( const char * ) ), this, SLOT( slotNewURL( const \
char * ) ) ); +    connect( view, SIGNAL( textSelected( KHTMLView *, bool) ), this, \
SLOT( slotTextSelected( KHTMLView *, bool) ) ); +    connect( view, SIGNAL( \
URLSelected( KHTMLView *, const char*, int, const char*) ),  +             this, \
SLOT( slotURLSelected( KHTMLView *, const char*, int, const char*) ) );  connect( \
view, SIGNAL( documentStarted( KHTMLView * ) ),   this, SLOT( slotAddWaitingWidget( \
KHTMLView * ) ) );  connect( view, SIGNAL( documentDone( KHTMLView * ) ), 
@@ -1572,7 +1575,18 @@
        v->getSelectedText( sel );
        QClipboard *cb = KApplication::clipboard();
        cb->setText( sel );
+       view->TextSelected();
     }
+}
+
+void KfmGui::slotURLSelected( KHTMLView *v, const char *_url, 
+                              int _button, const char *_target )
+{
+   QString sel = _url;
+
+   QClipboard *cb = KApplication::clipboard();
+   cb->setText( sel );
+   view->URLSelected();
 }
 
 void KfmGui::slotSaveSettings()
Index: kfmgui.h
===================================================================
RCS file: /home/kde/kdebase/kfm/Attic/kfmgui.h,v
retrieving revision 1.48.2.3
diff -u -r1.48.2.3 kfmgui.h
--- kfmgui.h	1999/03/31 23:32:47	1.48.2.3
+++ kfmgui.h	1999/08/12 14:28:39
@@ -514,6 +514,7 @@
     
     void slotShowLocationBar();
     void slotTextSelected( KHTMLView *, bool );
+    void slotURLSelected( KHTMLView *, const char *, int, const char * );
     void slotPaintRed();
     
 protected:
Index: kfmview.cpp
===================================================================
RCS file: /home/kde/kdebase/kfm/Attic/kfmview.cpp,v
retrieving revision 1.109.2.6
diff -u -r1.109.2.6 kfmview.cpp
--- kfmview.cpp	1999/05/06 21:08:30	1.109.2.6
+++ kfmview.cpp	1999/08/12 14:28:39
@@ -59,6 +59,8 @@
     rectStart = false;
     dPainter = 0L;
     
+    bURLSelected = false;
+
     htmlCache = new HTMLCache();
     if(!_parent_view)
     {
@@ -512,10 +514,12 @@
 void KfmView::slotCopy()
 {
     clipboard->clear();
-    // Are there URLs selected (-> directly into the clipboard) ?
-    view->getSelected( (*clipboard) );
-
-    if (clipboard->isEmpty()) // first test, since selecting URLs selects text
+    if (bURLSelected)
+    {
+       // Are there URLs selected (-> directly into the clipboard) ?
+       view->getSelected( (*clipboard) );
+    }
+    else
     { // no URLs, get selected text
         // Is there selected text ?
         QString txt;
@@ -523,9 +527,6 @@
         if (!txt.isEmpty())
             clipboard->append(txt);
     }
-    // Problem if one selects some text AND a link in a html page :
-    // there is text AND a URL selected. What do we put in the clipboard ?
-    // Currently we put the URL...
 }
 
 void KfmView::slotTrash()
Index: kfmview.h
===================================================================
RCS file: /home/kde/kdebase/kfm/Attic/kfmview.h,v
retrieving revision 1.26
diff -u -r1.26 kfmview.h
--- kfmview.h	1999/01/22 11:03:35	1.26
+++ kfmview.h	1999/08/12 14:28:39
@@ -182,6 +182,9 @@
      */
     static void InitStatic() { clipboard = new QStrList; }
 
+    void URLSelected() { bURLSelected = true; }
+    void TextSelected() { bURLSelected = false; }
+
 signals:
 
     /**
@@ -513,6 +516,7 @@
      */
     QString selectedURL;
 
+    bool bURLSelected;
     /**
      * @see #setUpURL
      */



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic