Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

addresspluginconfig.cpp

Go to the documentation of this file.
00001 /*
00002  * addresspluginconfig.cpp
00003  *
00004  * copyright   : (c) 2003 by Stefan Eilers
00005  * email       : eilers.stefan@epost.de
00006  *
00007  * This implementation was derived from the todolist plugin implementation
00008  *
00009  */
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #include "addresspluginconfig.h"
00020 
00021 #include <qpe/config.h>
00022 
00023 #include <qlayout.h>
00024 #include <qhbox.h>
00025 #include <qlabel.h>
00026 #include <qwhatsthis.h>
00027 #include <qvgroupbox.h>
00028 
00029 
00030 AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent,  const char* name)
00031     : TodayConfigWidget(parent,  name ) {
00032 
00033     QVBoxLayout * layout = new QVBoxLayout( this );
00034     layout->setMargin( 5 );
00035 
00036     // Buttongroup to enable/disable shown stuff
00037     QVGroupBox* b_group = new QVGroupBox( this, "name" );
00038     b_group -> setTitle( tr("Enable/Disable Views") );
00039     m_showBirthdayButton = new QCheckBox( b_group );
00040     m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) );
00041     m_showAnniversaryButton = new QCheckBox( b_group );
00042     m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) );
00043 
00044     QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) );
00045     QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) );
00046 
00047     // Max lines settings
00048     QHBox *box1 = new QHBox( this );
00049     QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
00050     TextLabel6->setText( tr( "Max Lines: " ) );
00051     SpinBox2 = new QSpinBox( box1, "SpinBox2" );
00052     SpinBox2->setMaxValue( 40 );
00053     QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) );
00054 
00055     // Look ahead settings
00056     QHBox *box3 = new QHBox( this );
00057     QLabel* daysLabel = new QLabel( box3, "" );
00058     daysLabel->setText( tr( "Days look ahead: " ) );
00059     SpinDaysClip = new QSpinBox( box3, "SpinDays" );
00060     SpinDaysClip->setMaxValue( 200 );
00061     QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
00062 
00063 
00064     QHBox *box5 = new QHBox( this );
00065     QLabel* colorLabel2 = new QLabel( box5, "" );
00066     colorLabel2->setText( tr( "Set Headline Color: " ) );
00067     headlineColor = new Opie::OColorButton( box5, black , "headlineColor" );
00068     QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
00069     QHBox *box6 = new QHBox( this );
00070 
00071     // Entry color settings
00072     QLabel* colorLabel3= new QLabel( box6, "" );
00073     colorLabel3->setText( tr( "Set Entry Color: " ) );
00074     entryColor = new Opie::OColorButton( box6, black , "entryColor" );
00075     QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
00076 
00077     // Urgent color settings
00078     QHBox *box7 = new QHBox( this );
00079     QLabel* colorLabel5 = new QLabel( box7, "" );
00080     colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
00081     SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
00082     SpinUrgentClip->setMaxValue( 200 );
00083     QLabel* colorLabel6 = new QLabel( box7, "" );
00084     colorLabel6->setText( tr( " days: " ) );
00085     urgentColor = new Opie::OColorButton( box7, red , "urgentColor" );
00086     QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
00087     QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
00088 
00089 
00090     layout->addWidget( b_group );
00091     layout->addWidget( box1 );
00092     layout->addWidget( box3 );
00093     layout->addWidget( box5 );
00094     layout->addWidget( box6 );
00095     layout->addWidget( box7 );
00096     
00097     /*
00098      * pack the widgets together
00099      */
00100     QSpacerItem *item = new QSpacerItem( 1, 2, QSizePolicy::Minimum,
00101                                           QSizePolicy::MinimumExpanding );
00102     layout->addItem( item );
00103 
00104     readConfig();
00105 
00106 }
00107 
00108 void AddressBookPluginConfig::readConfig() {
00109     Config cfg( "todayaddressplugin" );
00110     cfg.setGroup( "config" );
00111     m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
00112     SpinBox2->setValue( m_max_lines_task );
00113 //     m_maxCharClip =  cfg.readNumEntry( "maxcharclip", 38 );
00114 //     SpinBoxClip->setValue( m_maxCharClip );
00115     m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
00116     SpinDaysClip->setValue( m_daysLookAhead );
00117     m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
00118     SpinUrgentClip->setValue( m_urgentDays );
00119 
00120     m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() );
00121     entryColor->setColor( QColor( m_entryColor ) );
00122     m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
00123     headlineColor->setColor( QColor( m_headlineColor ) );
00124     m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
00125     urgentColor->setColor( QColor( m_urgentColor ) );
00126 
00127     m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) );
00128     m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) );
00129 
00130 }
00131 
00132 
00133 void AddressBookPluginConfig::writeConfig() {
00134     Config cfg( "todayaddressplugin" );
00135     cfg.setGroup( "config" );
00136     m_max_lines_task = SpinBox2->value();
00137     cfg.writeEntry( "maxlinestask", m_max_lines_task );
00138 //     m_maxCharClip = SpinBoxClip->value();
00139 //     cfg.writeEntry( "maxcharclip",  m_maxCharClip );
00140     m_daysLookAhead = SpinDaysClip->value();
00141     cfg.writeEntry( "dayslookahead",  m_daysLookAhead );
00142     m_urgentDays = SpinUrgentClip->value();
00143     if ( m_urgentDays > m_daysLookAhead )
00144         m_urgentDays = m_daysLookAhead;
00145     cfg.writeEntry( "urgentdays", m_urgentDays );
00146 
00147     m_entryColor = entryColor->color().name();
00148     cfg.writeEntry( "entrycolor", m_entryColor );
00149     m_headlineColor = headlineColor->color().name();
00150     cfg.writeEntry( "headlinecolor", m_headlineColor );
00151     m_urgentColor = urgentColor->color().name();
00152     cfg.writeEntry( "urgentcolor", m_urgentColor );
00153 
00154     cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() );
00155     cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() );
00156 
00157     cfg.write();
00158 }
00159 
00160 
00161 AddressBookPluginConfig::~AddressBookPluginConfig() {
00162 }

Generated on Sat Nov 5 16:15:54 2005 for OPIE by  doxygen 1.4.2