summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/configuretableviewdialog.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/views/configuretableviewdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/configuretableviewdialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp
index 0e36abd..c329cd9 100644
--- a/kaddressbook/views/configuretableviewdialog.cpp
+++ b/kaddressbook/views/configuretableviewdialog.cpp
@@ -14,193 +14,193 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qvbox.h>
#include <qbuttongroup.h>
#include <qtabwidget.h>
#include <qwhatsthis.h>
#include <qpushbutton.h>
#include <kglobal.h>
#include <klocale.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <kiconloader.h>
#include <kfontdialog.h>
#ifndef KAB_EMBEDDED
#include <kimageio.h>
#else //KAB_EMBEDDED
#endif //KAB_EMBEDDED
#include <kconfig.h>
#include "colorlistbox.h"
#include "configuretableviewdialog.h"
ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab,
QWidget *parent,
const char *name )
: ViewConfigureWidget( ab, parent, name )
{
QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
KGlobal::iconLoader()->loadIcon( "looknfeel",
KIcon::Panel ) );
mPage = new LookAndFeelPage( page );
}
ConfigureTableViewWidget::~ConfigureTableViewWidget()
{
}
void ConfigureTableViewWidget::restoreSettings( KConfig *config )
{
ViewConfigureWidget::restoreSettings( config );
mPage->restoreSettings( config );
}
void ConfigureTableViewWidget::saveSettings( KConfig *config )
{
ViewConfigureWidget::saveSettings( config );
mPage->saveSettings( config );
}
LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name)
: QVBox(parent, name)
{
initGUI();
// Set initial state
enableBackgroundToggled(mBackgroundBox->isChecked());
}
void LookAndFeelPage::restoreSettings( KConfig *config )
{
mAlternateButton->setChecked(config->readBoolEntry("ABackground", true));
mLineButton->setChecked(config->readBoolEntry("SingleLine", false));
mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true));
if (!mAlternateButton->isChecked() & !mLineButton->isChecked())
mNoneButton->setChecked(true);
mBackgroundBox->setChecked(config->readBoolEntry("Background", false));
mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName"));
// colors
cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) );
QColor c;
-qDebug("LookAndFeelPage::restoreSettings make base color configurable");
+ //qDebug("LookAndFeelPage::restoreSettings make base color configurable");
#ifndef KAB_EMBEDDED
c = KGlobalSettings::baseColor();
#else //KAB_EMBEDDED
c = QColor(0,0,0);
#endif //KAB_EMBEDDED
c = colorGroup().background();
lbColors->insertItem( new ColorListItem( i18n("Background Color"),
config->readColorEntry( "BackgroundColor", &c ) ) );
c = colorGroup().foreground();
lbColors->insertItem( new ColorListItem( i18n("Text Color"),
config->readColorEntry( "TextColor", &c ) ) );
c = colorGroup().button();
lbColors->insertItem( new ColorListItem( i18n("Header Background Color"),
config->readColorEntry( "HeaderBackgroundColor", &c ) ) );
c = colorGroup().buttonText();
lbColors->insertItem( new ColorListItem( i18n("Header Text Color"),
config->readColorEntry( "HeaderTextColor", &c ) ) );
c = colorGroup().highlight();
lbColors->insertItem( new ColorListItem( i18n("Highlight Color"),
config->readColorEntry( "HighlightColor", &c ) ) );
c = colorGroup().highlightedText();
lbColors->insertItem( new ColorListItem( i18n("Highlighted Text Color"),
config->readColorEntry( "HighlightedTextColor", &c ) ) );
c = colorGroup().background();
lbColors->insertItem( new ColorListItem( i18n("Alternating Background Color"),
config->readColorEntry( "AlternatingBackgroundColor", &c ) ) );
enableColors();
// fonts
QFont fnt = font();
updateFontLabel( config->readFontEntry( "TextFont", &fnt ), (QLabel*)lTextFont );
fnt.setBold( true );
updateFontLabel( config->readFontEntry( "HeaderFont", &fnt ), (QLabel*)lHeaderFont );
cbEnableCustomFonts->setChecked( config->readBoolEntry( "EnableCustomFonts", false ) );
enableFonts();
}
void LookAndFeelPage::saveSettings( KConfig *config )
{
config->writeEntry("ABackground", mAlternateButton->isChecked());
config->writeEntry("SingleLine", mLineButton->isChecked());
config->writeEntry("ToolTips", mToolTipBox->isChecked());
config->writeEntry("Background", mBackgroundBox->isChecked());
config->writeEntry("BackgroundName", mBackgroundName->lineEdit()->text());
// colors
config->writeEntry( "EnableCustomColors", cbEnableCustomColors->isChecked() );
if ( cbEnableCustomColors->isChecked() ) // ?? - Hmmm.
{
config->writeEntry( "BackgroundColor", lbColors->color( 0 ) );
config->writeEntry( "TextColor", lbColors->color( 1 ) );
config->writeEntry( "HeaderBackgroundColor", lbColors->color( 2 ) );
config->writeEntry( "HeaderTextColor", lbColors->color( 3 ) );
config->writeEntry( "HighlightColor", lbColors->color( 4 ) );
config->writeEntry( "HighlightedTextColor", lbColors->color( 5 ) );
config->writeEntry( "AlternatingBackgroundColor", lbColors->color( 6 ) );
}
// fonts
config->writeEntry( "EnableCustomFonts", cbEnableCustomFonts->isChecked() );
if ( cbEnableCustomFonts->isChecked() )
{
config->writeEntry( "TextFont", lTextFont->font() );
config->writeEntry( "HeaderFont", lHeaderFont->font() );
}
}
void LookAndFeelPage::setTextFont()
{
QFont f( lTextFont->font() );
#ifndef KAB_EMBEDDED
if ( KFontDialog::getFont( f, false, this ) == QDialog::Accepted )
updateFontLabel( f, lTextFont );
#else //KAB_EMBEDDED
bool ok;
QFont fout = KFontDialog::getFont( f, ok);
if ( ok )
updateFontLabel( fout, lTextFont );
#endif //KAB_EMBEDDED
}
void LookAndFeelPage::setHeaderFont()
{
QFont f( lHeaderFont->font() );
#ifndef KAB_EMBEDDED
if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
updateFontLabel( f, lHeaderFont );
#else //KAB_EMBEDDED
bool ok;
QFont fout = KFontDialog::getFont( f, ok);
if ( ok )
updateFontLabel( fout, lHeaderFont );