kpilot

datebookWidget.cc

Go to the documentation of this file.
00001 /* KPilot
00002 **
00003 ** Copyright (C) 2003 by Dan Pilone.
00004 **  Authored by Adriaan de Groot
00005 **
00006 ** This is the viewer for datebook data.
00007 */
00008 
00009 /*
00010 ** This program is free software; you can redistribute it and/or modify
00011 ** it under the terms of the GNU General Public License as published by
00012 ** the Free Software Foundation; either version 2 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018 ** GNU General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU General Public License
00021 ** along with this program in a file called COPYING; if not, write to
00022 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00023 ** MA 02110-1301, USA.
00024 */
00025 
00026 /*
00027 ** Bug reports and questions can be sent to kde-pim@kde.org
00028 */
00029 
00030 
00031 #include "options.h"
00032 
00033 
00034 #include <qlayout.h>
00035 #include <qdir.h>
00036 #include <qpushbutton.h>
00037 
00038 #include <klistview.h>
00039 #include <kdatepicker.h>
00040 #include <kmessagebox.h>
00041 
00042 #include "datebookWidget.moc"
00043 
00044 DatebookWidget::DatebookWidget(QWidget *parent, const QString &dbpath) :
00045     PilotComponent(parent,"component_generic",dbpath)
00046 {
00047     FUNCTIONSETUP;
00048 
00049     QGridLayout *g = new QGridLayout(this,1,1,SPACING);
00050 
00051     fDatePicker = new KDatePicker( this, "fDatePicker" );
00052     fDatePicker->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)5, 0, 0, fDatePicker->sizePolicy().hasHeightForWidth() ) );
00053     g->addMultiCellWidget(fDatePicker,0,0,0,2);
00054 
00055     QSpacerItem* spacer = new QSpacerItem( 20, 180, QSizePolicy::Minimum, QSizePolicy::Expanding );
00056     g->addItem( spacer, 1, 1 );
00057 
00058     fAddButton = new QPushButton( i18n( "&Add..." ), this, "pushButton1" );
00059     g->addWidget( fAddButton, 2, 0 );
00060 
00061     fEditButton = new QPushButton( i18n( "&Edit..." ), this, "pushButton2" );
00062     g->addWidget( fEditButton, 2, 1 );
00063 
00064     fDeleteButton = new QPushButton( i18n( "&Delete..." ), this, "pushButton3" );
00065     g->addWidget( fDeleteButton, 2, 2 );
00066 
00067     fEventList = new KListView( this, "kListView1" );
00068     fEventList->addColumn( i18n( "Time" ) );
00069     fEventList->addColumn( i18n( "Al" ) );
00070     fEventList->addColumn( i18n( "Rec" ) );
00071     fEventList->addColumn( i18n( "Description" ) );
00072 //  fEventList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, fEventList->sizePolicy().hasHeightForWidth() ) );
00073     fEventList->setAllColumnsShowFocus( TRUE );
00074     fEventList->setShowSortIndicator( TRUE );
00075     fEventList->setResizeMode( KListView::/*LastColumn*/AllColumns );
00076     fEventList->setFullWidth( TRUE );
00077 //  fEventList->setAlternateBackground( QColor( 221, 146, 240 ) );
00078     g->addMultiCellWidget(fEventList, 0, 2, 3, 3);
00079 
00080     connect(fDatePicker, SIGNAL(dateChanged()), SLOT(slotDayChanged()));
00081     connect(fAddButton, SIGNAL(clicked()), SLOT(slotAddEvent()));
00082     connect(fEditButton, SIGNAL(clicked()), SLOT(slotEditEvent()));
00083     connect(fDeleteButton, SIGNAL(clicked()), SLOT(slotDeleteEvent()));
00084 }
00085 
00086 DatebookWidget::~DatebookWidget()
00087 {
00088     FUNCTIONSETUP;
00089 }
00090 
00091 
00092 void DatebookWidget::showComponent()
00093 {
00094     FUNCTIONSETUP;
00095 
00096     // TODO: Open the calendar database
00097     // TODO: Initialize the current month
00098     // TODO: Fill the calendar and the event list
00099 }
00100 
00101 void DatebookWidget::hideComponent()
00102 {
00103     FUNCTIONSETUP;
00104 
00105     // TODO: Close the calendar database if open
00106     // TODO: clear the calendar and the event list
00107 }
00108 
00109 void DatebookWidget::slotDayChanged()
00110 {
00111     FUNCTIONSETUP;
00112     KMessageBox::information(this, CSL1("slotDayChanged"));
00113 }
00114 
00115 void DatebookWidget::slotAddEvent()
00116 {
00117     FUNCTIONSETUP;
00118     KMessageBox::information(this, CSL1("slotAddEvent"));
00119 }
00120 
00121 void DatebookWidget::slotEditEvent()
00122 {
00123     FUNCTIONSETUP;
00124     KMessageBox::information(this, CSL1("slotEditEvent"));
00125 }
00126 
00127 void DatebookWidget::slotDeleteEvent()
00128 {
00129     FUNCTIONSETUP;
00130     KMessageBox::information(this, CSL1("slotDeleteEvent"));
00131 }
00132 
00133