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

List:       kfm-devel
Subject:    Patch for Konqueror: Enable/disable "Middle click on tab to close"
From:       Juan Carlos Torres <carlosdgtorres () gmail ! com>
Date:       2006-12-21 6:42:26
Message-ID: 200612211442.26745.carlosdgtorres () gmail ! com
[Download RAW message or body]

Greetings!

For quite some time now, Konqueror has had the feature that lets the user 
middle-click on a tab to close it, similar to what Firefox and Opera have 
been doing. This feature has been left as a hidden setting that requires 
users to manually edit konquerorrc. Some users have expressed the desire to 
have an easy and graphical means of enabling or disabling this feature.

When I asked in #kde whether such a feature would be included in KDE 3.5.x, 
Aaron Seigo encouraged me to write a patch for it (thanks Aaron, for pointing 
me to the right file). As I have no programming experience, specially in Qt 
or KDE, I thought it would be impossible for me to do it. But it nagged me so 
much that I gave in and tried to look into the files. So here is the simple 
patch I made for Konqueror. 

This is my first ever patch, my first attempt at making one, and my first 
attempt at submitting it. So I'm not absolutely sure I did everything 
properly. All I know is that it works on the system on which I compiled KDE 
3.5.5 from SVN.

Here's a screenshot of how the setting looks like: 
http://jucato.org/stuff/kcontrol_konqhtml.png


Regards,

Juan Carlos Torres
-- 
http://jucato.org/

["kcontrol_middleclick.diff" (text/x-diff)]

Index: kcontrol/konqhtml/advancedTabOptions.ui
===================================================================
--- kcontrol/konqhtml/advancedTabOptions.ui	(revision 614674)
+++ kcontrol/konqhtml/advancedTabOptions.ui	(working copy)
@@ -126,6 +126,18 @@
                         <string>When you click a URL in another KDE program or call \
kfmclient to open a URL, the current desktop will be searched for a non-minimized \
Konqueror and, if found, the URL opened as a new tab within it. Otherwise a new \
Konqueror window will be opened with the required URL.</string>  </property>
                 </widget>
+		<widget class="QCheckBox">
+			<property name="name">
+				<cstring>m_pMiddleClickClose</cstring>
+			</property>
+			<property name="text">
+				<string>Middle-click on a tab to close it</string>
+			</property>
+			<property name="whatsThis" stdset="0">
+				<string>When you click on a tab using the middle mouse button or mouse wheel, it \
will close  +that tab. (Konqueror needs to be restarted for changes to take \
effect)</string> +			</property>
+                </widget>
             </vbox>
         </widget>
         <spacer>
Index: kcontrol/konqhtml/advancedTabDialog.cpp
===================================================================
--- kcontrol/konqhtml/advancedTabDialog.cpp	(revision 614674)
+++ kcontrol/konqhtml/advancedTabDialog.cpp	(working copy)
@@ -65,6 +65,7 @@
     connect(m_advancedWidget->m_pPermanentCloseButton, SIGNAL(clicked()), this, \
                SLOT(changed()));
     connect(m_advancedWidget->m_pKonquerorTabforExternalURL, SIGNAL(clicked()), \
                this, SLOT(changed()));
     connect(m_advancedWidget->m_pPopupsWithinTabs, SIGNAL(clicked()), this, \
SLOT(changed())); +    connect(m_advancedWidget->m_pMiddleClickClose, \
SIGNAL(clicked()), this, SLOT(changed()));  
     load();
 }
@@ -82,6 +83,7 @@
     m_advancedWidget->m_pKonquerorTabforExternalURL->setChecked( \
                m_pConfig->readBoolEntry( "KonquerorTabforExternalURL", false ) );
     m_advancedWidget->m_pPopupsWithinTabs->setChecked( m_pConfig->readBoolEntry( \
                "PopupsWithinTabs", false ) );
     m_advancedWidget->m_pTabCloseActivatePrevious->setChecked( \
m_pConfig->readBoolEntry( "TabCloseActivatePrevious", false ) ); +    \
m_advancedWidget->m_pMiddleClickClose->setChecked( m_pConfig->readBoolEntry( \
"MouseMiddleClickClosesTab", false ) );  
     m_pConfig->setGroup("Notification Messages");
     m_advancedWidget->m_pTabConfirm->setChecked( \
!m_pConfig->hasKey("MultipleTabConfirm") ); @@ -98,6 +100,7 @@
     m_pConfig->writeEntry( "KonquerorTabforExternalURL", \
                m_advancedWidget->m_pKonquerorTabforExternalURL->isChecked() );
     m_pConfig->writeEntry( "PopupsWithinTabs", \
                m_advancedWidget->m_pPopupsWithinTabs->isChecked() );
     m_pConfig->writeEntry( "TabCloseActivatePrevious", \
m_advancedWidget->m_pTabCloseActivatePrevious->isChecked() ); +    \
m_pConfig->writeEntry( "MouseMiddleClickClosesTab", \
m_advancedWidget->m_pMiddleClickClose->isChecked() );  m_pConfig->sync();
 
     // It only matters wether the key is present, its value has no meaning



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

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