From kfm-devel Thu Dec 21 06:42:26 2006 From: Juan Carlos Torres Date: Thu, 21 Dec 2006 06:42:26 +0000 To: kfm-devel Subject: Patch for Konqueror: Enable/disable "Middle click on tab to close" Message-Id: <200612211442.26745.carlosdgtorres () gmail ! com> X-MARC-Message: https://marc.info/?l=kfm-devel&m=116668326409111 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_SziiF2GyvorgETx" --Boundary-00=_SziiF2GyvorgETx Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/ --Boundary-00=_SziiF2GyvorgETx Content-Type: text/x-diff; charset="us-ascii"; name="kcontrol_middleclick.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kcontrol_middleclick.diff" Index: kcontrol/konqhtml/advancedTabOptions.ui =================================================================== --- kcontrol/konqhtml/advancedTabOptions.ui (revision 614674) +++ kcontrol/konqhtml/advancedTabOptions.ui (working copy) @@ -126,6 +126,18 @@ 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. + + + m_pMiddleClickClose + + + Middle-click on a tab to close it + + + 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) + + 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 --Boundary-00=_SziiF2GyvorgETx--