|
Lines 1-150
Link Here
|
| 1 |
/* |
|
|
| 2 |
* advancedTabDialog.cpp |
| 3 |
* |
| 4 |
* Copyright (c) 2002 Aaron J. Seigo <aseigo@olympusproject.org> |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; either version 2 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
|
| 19 |
-------------------------------------------------------------- |
| 20 |
Additional changes: |
| 21 |
- 2013/10/16 Michele Calgaro |
| 22 |
* centralized "tabbed browsing" options in this dialog |
| 23 |
*/ |
| 24 |
|
| 25 |
#include <tqbuttongroup.h> |
| 26 |
#include <tqcheckbox.h> |
| 27 |
#include <tqlayout.h> |
| 28 |
#include <tqpushbutton.h> |
| 29 |
#include <tqradiobutton.h> |
| 30 |
#include <tqslider.h> |
| 31 |
|
| 32 |
#include <tdeapplication.h> |
| 33 |
#include <dcopclient.h> |
| 34 |
#include <kcolorbutton.h> |
| 35 |
#include <tdelocale.h> |
| 36 |
#include <tdeconfig.h> |
| 37 |
|
| 38 |
#include "advancedTabDialog.h" |
| 39 |
#include "advancedTabOptions.h" |
| 40 |
#include "main.h" |
| 41 |
|
| 42 |
advancedTabDialog::advancedTabDialog(TQWidget* parent, TDEConfig* config, const char* name) |
| 43 |
: KDialogBase(KDialogBase::Plain, |
| 44 |
i18n("Advanced Options"), |
| 45 |
KDialogBase::Ok | |
| 46 |
KDialogBase::Apply | |
| 47 |
KDialogBase::Cancel, |
| 48 |
KDialogBase::Ok, |
| 49 |
parent, |
| 50 |
name, |
| 51 |
true, true), |
| 52 |
m_pConfig(config) |
| 53 |
{ |
| 54 |
connect(this, TQT_SIGNAL(applyClicked()), |
| 55 |
this, TQT_SLOT(save())); |
| 56 |
connect(this, TQT_SIGNAL(okClicked()), |
| 57 |
this, TQT_SLOT(save())); |
| 58 |
actionButton(Apply)->setEnabled(false); |
| 59 |
TQFrame* page = plainPage(); |
| 60 |
TQVBoxLayout* layout = new TQVBoxLayout(page); |
| 61 |
m_advancedWidget = new advancedTabOptions(page); |
| 62 |
layout->addWidget(m_advancedWidget); |
| 63 |
layout->addSpacing( 20 ); |
| 64 |
layout->addStretch(); |
| 65 |
|
| 66 |
connect(m_advancedWidget->m_pShowMMBInTabs, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); |
| 67 |
connect(m_advancedWidget->m_pDynamicTabbarHide, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); |
| 68 |
connect(m_advancedWidget->m_pDynamicTabbarCycle, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); |
| 69 |
connect(m_advancedWidget->m_pNewTabsInBackground, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 70 |
connect(m_advancedWidget->m_pOpenAfterCurrentPage, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 71 |
connect(m_advancedWidget->m_pTabConfirm, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 72 |
connect(m_advancedWidget->m_pTabCloseActivatePrevious, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 73 |
connect(m_advancedWidget->m_pPermanentCloseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 74 |
connect(m_advancedWidget->m_pHoverCloseButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 75 |
connect(m_advancedWidget->m_pKonquerorTabforExternalURL, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 76 |
connect(m_advancedWidget->m_pPopupsWithinTabs, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); |
| 77 |
|
| 78 |
load(); |
| 79 |
} |
| 80 |
|
| 81 |
advancedTabDialog::~advancedTabDialog() |
| 82 |
{ |
| 83 |
} |
| 84 |
|
| 85 |
void advancedTabDialog::load() |
| 86 |
{ |
| 87 |
m_pConfig->setGroup("FMSettings"); |
| 88 |
m_advancedWidget->m_pShowMMBInTabs->setChecked( m_pConfig->readBoolEntry( "MMBOpensTab", false ) ); |
| 89 |
m_advancedWidget->m_pDynamicTabbarHide->setChecked( !(m_pConfig->readBoolEntry( "AlwaysTabbedMode", false )) ); |
| 90 |
m_advancedWidget->m_pDynamicTabbarCycle->setChecked( m_pConfig->readBoolEntry( "TabsCycleWheel", true ) ); |
| 91 |
m_advancedWidget->m_pNewTabsInBackground->setChecked( ! (m_pConfig->readBoolEntry( "NewTabsInFront", false )) ); |
| 92 |
m_advancedWidget->m_pOpenAfterCurrentPage->setChecked( m_pConfig->readBoolEntry( "OpenAfterCurrentPage", false ) ); |
| 93 |
m_advancedWidget->m_pPermanentCloseButton->setChecked( m_pConfig->readBoolEntry( "PermanentCloseButton", false ) ); |
| 94 |
m_advancedWidget->m_pHoverCloseButton->setChecked( m_pConfig->readBoolEntry( "HoverCloseButton", false ) ); |
| 95 |
m_advancedWidget->m_pKonquerorTabforExternalURL->setChecked( m_pConfig->readBoolEntry( "KonquerorTabforExternalURL", false ) ); |
| 96 |
m_advancedWidget->m_pPopupsWithinTabs->setChecked( m_pConfig->readBoolEntry( "PopupsWithinTabs", false ) ); |
| 97 |
m_advancedWidget->m_pTabCloseActivatePrevious->setChecked( m_pConfig->readBoolEntry( "TabCloseActivatePrevious", false ) ); |
| 98 |
|
| 99 |
m_pConfig->setGroup("Notification Messages"); |
| 100 |
m_advancedWidget->m_pTabConfirm->setChecked( !m_pConfig->hasKey("MultipleTabConfirm") ); |
| 101 |
|
| 102 |
if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) |
| 103 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(false); |
| 104 |
else |
| 105 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(true); |
| 106 |
actionButton(Apply)->setEnabled(false); |
| 107 |
} |
| 108 |
|
| 109 |
void advancedTabDialog::save() |
| 110 |
{ |
| 111 |
m_pConfig->setGroup("FMSettings"); |
| 112 |
m_pConfig->writeEntry( "MMBOpensTab", (m_advancedWidget->m_pShowMMBInTabs->isChecked()) ); |
| 113 |
m_pConfig->writeEntry( "AlwaysTabbedMode", ( !(m_advancedWidget->m_pDynamicTabbarHide->isChecked())) ); |
| 114 |
m_pConfig->writeEntry( "TabsCycleWheel", (m_advancedWidget->m_pDynamicTabbarCycle->isChecked()) ); |
| 115 |
m_pConfig->writeEntry( "NewTabsInFront", !(m_advancedWidget->m_pNewTabsInBackground->isChecked()) ); |
| 116 |
m_pConfig->writeEntry( "OpenAfterCurrentPage", m_advancedWidget->m_pOpenAfterCurrentPage->isChecked() ); |
| 117 |
m_pConfig->writeEntry( "PermanentCloseButton", m_advancedWidget->m_pPermanentCloseButton->isChecked() ); |
| 118 |
m_pConfig->writeEntry( "HoverCloseButton", m_advancedWidget->m_pHoverCloseButton->isChecked() ); |
| 119 |
m_pConfig->writeEntry( "KonquerorTabforExternalURL", m_advancedWidget->m_pKonquerorTabforExternalURL->isChecked() ); |
| 120 |
m_pConfig->writeEntry( "PopupsWithinTabs", m_advancedWidget->m_pPopupsWithinTabs->isChecked() ); |
| 121 |
m_pConfig->writeEntry( "TabCloseActivatePrevious", m_advancedWidget->m_pTabCloseActivatePrevious->isChecked() ); |
| 122 |
m_pConfig->sync(); |
| 123 |
|
| 124 |
// It only matters whether the key is present, its value has no meaning |
| 125 |
m_pConfig->setGroup("Notification Messages"); |
| 126 |
if ( m_advancedWidget->m_pTabConfirm->isChecked() ) m_pConfig->deleteEntry( "MultipleTabConfirm" ); |
| 127 |
else m_pConfig->writeEntry( "MultipleTabConfirm", true ); |
| 128 |
|
| 129 |
TQByteArray data; |
| 130 |
if ( !TDEApplication::kApplication()->dcopClient()->isAttached() ) |
| 131 |
kapp->dcopClient()->attach(); |
| 132 |
TDEApplication::kApplication()->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data ); |
| 133 |
|
| 134 |
if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) |
| 135 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(false); |
| 136 |
else |
| 137 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(true); |
| 138 |
actionButton(Apply)->setEnabled(false); |
| 139 |
} |
| 140 |
|
| 141 |
void advancedTabDialog::changed() |
| 142 |
{ |
| 143 |
if ( m_advancedWidget->m_pPermanentCloseButton->isChecked() ) |
| 144 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(false); |
| 145 |
else |
| 146 |
m_advancedWidget->m_pHoverCloseButton->setEnabled(true); |
| 147 |
actionButton(Apply)->setEnabled(true); |
| 148 |
} |
| 149 |
|
| 150 |
#include "advancedTabDialog.moc" |