author | ulf69 <ulf69> | 2004-06-29 06:30:43 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-06-29 06:30:43 (UTC) |
commit | 2d5b376ae1329d82d1ce1947b972b30866abff9b (patch) (side-by-side diff) | |
tree | 972d674c2c3939ed60c5a4a0c0ae33328ee47674 | |
parent | 5bfd50da45591c581a7703d442b250e6e5294d9f (diff) | |
download | kdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.zip kdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.tar.gz kdepimpi-2d5b376ae1329d82d1ce1947b972b30866abff9b.tar.bz2 |
removed references to moc files
-rw-r--r-- | libkdepim/categoryeditdialog.cpp | 2 | ||||
-rw-r--r-- | libkdepim/categoryeditdialog_base.cpp | 2 | ||||
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 2 | ||||
-rw-r--r-- | libkdepim/categoryselectdialog_base.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kdateedit.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.cpp | 2 | ||||
-rw-r--r-- | libkdepim/libkdepimE.pro | 1 |
8 files changed, 8 insertions, 7 deletions
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp index 87172c1..f719c31 100644 --- a/libkdepim/categoryeditdialog.cpp +++ b/libkdepim/categoryeditdialog.cpp @@ -1,135 +1,135 @@ /* This file is part of libkdepim. Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 <qstringlist.h> #include <qlineedit.h> #include <qlistview.h> #include <qheader.h> #include <qpushbutton.h> #include <qapplication.h> #include "kpimprefs.h" #include "categoryeditdialog.h" using namespace KPIM; CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, const char* name, bool modal, WFlags fl ) : CategoryEditDialog_base( parent, name, modal, fl ), mPrefs( prefs ) { mCategories->header()->hide(); QStringList::Iterator it; bool categoriesExist=false; for (it = mPrefs->mCustomCategories.begin(); it != mPrefs->mCustomCategories.end(); ++it ) { new QListViewItem(mCategories,*it); categoriesExist=true; } connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), SLOT(editItem(QListViewItem *))); connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); mButtonRemove->setEnabled(categoriesExist); mButtonModify->setEnabled(categoriesExist); mButtonAdd->setEnabled(!mEdit->text().isEmpty()); if ( QApplication::desktop()->width() > 460 ) resize( 300, 360 ); } /* * Destroys the object and frees any allocated resources */ CategoryEditDialog::~CategoryEditDialog() { // no need to delete child widgets, Qt does it all for us } void CategoryEditDialog::slotTextChanged(const QString &text) { mButtonAdd->setEnabled(!text.isEmpty()); } void CategoryEditDialog::add() { if (!mEdit->text().isEmpty()) { new QListViewItem(mCategories,mEdit->text()); mEdit->setText(""); mButtonRemove->setEnabled(mCategories->childCount()>0); mButtonModify->setEnabled(mCategories->childCount()>0); } } void CategoryEditDialog::remove() { if (mCategories->currentItem()) { delete mCategories->currentItem(); mButtonRemove->setEnabled(mCategories->childCount()>0); mButtonModify->setEnabled(mCategories->childCount()>0); } } void CategoryEditDialog::modify() { if (!mEdit->text().isEmpty()) { if (mCategories->currentItem()) { mCategories->currentItem()->setText(0,mEdit->text()); } } } void CategoryEditDialog::accept() { slotOk(); } void CategoryEditDialog::slotOk() { slotApply(); QDialog::accept(); } void CategoryEditDialog::slotApply() { mPrefs->mCustomCategories.clear(); QListViewItem *item = mCategories->firstChild(); while(item) { mPrefs->mCustomCategories.append(item->text(0)); item = item->nextSibling(); } mPrefs->writeConfig(); emit categoryConfigChanged(); } void CategoryEditDialog::editItem(QListViewItem *item) { mEdit->setText(item->text(0)); mButtonRemove->setEnabled(true); mButtonModify->setEnabled(true); } -#include "categoryeditdialog.moc" +//US #include "categoryeditdialog.moc" diff --git a/libkdepim/categoryeditdialog_base.cpp b/libkdepim/categoryeditdialog_base.cpp index ac99190..2390bbd 100644 --- a/libkdepim/categoryeditdialog_base.cpp +++ b/libkdepim/categoryeditdialog_base.cpp @@ -1,154 +1,154 @@ #include <klocale.h> /**************************************************************************** ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' ** ** Created: Sat Mar 29 21:46:09 2003 ** by: The User Interface Compiler () ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "categoryeditdialog_base.h" #include <qvariant.h> #include <qheader.h> #include <qlineedit.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> /* * Constructs a CategoryEditDialog_base as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, true, fl ) { if ( !name ) setName( "CategoryEditDialog_base" ); CategoryEditDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout"); mEdit = new QLineEdit( this, "mEdit" ); CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); Layout13 = new QHBoxLayout( 0, 0, 6, "Layout13"); // mButtonHelp = new QPushButton( this, "mButtonHelp" ); //mButtonHelp->setAutoDefault( TRUE ); //Layout13->addWidget( mButtonHelp ); //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); //Layout13->addItem( spacer ); //mApply = new QPushButton( this, "mApply" ); // Layout13->addWidget( mApply ); mButtonOk = new QPushButton( this, "mButtonOk" ); mButtonOk->setAutoDefault( TRUE ); mButtonOk->setDefault( TRUE ); Layout13->addWidget( mButtonOk ); mButtonCancel = new QPushButton( this, "mButtonCancel" ); mButtonCancel->setAutoDefault( TRUE ); Layout13->addWidget( mButtonCancel ); CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 ); mCategories = new QListView( this, "mCategories" ); mCategories->addColumn( tr2i18n( "Category" ) ); CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 ); layout103 = new QVBoxLayout( 0, 0, 6, "layout103"); mButtonAdd = new QPushButton( this, "mButtonAdd" ); layout103->addWidget( mButtonAdd ); mButtonModify = new QPushButton( this, "mButtonModify" ); layout103->addWidget( mButtonModify ); mButtonRemove = new QPushButton( this, "mButtonRemove" ); layout103->addWidget( mButtonRemove ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); layout103->addItem( spacer_2 ); CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 ); languageChange(); resize( sizeHint() ); // signals and slots connections connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) ); connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) ); connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) ); connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); // tab order // setTabOrder( mCategories, mEdit ); // setTabOrder( mEdit, mButtonAdd ); // setTabOrder( mButtonAdd, mButtonModify ); // setTabOrder( mButtonModify, mButtonRemove ); // setTabOrder( mButtonRemove, mButtonHelp ); // setTabOrder( mButtonHelp, mApply ); // setTabOrder( mApply, mButtonOk ); // setTabOrder( mButtonOk, mButtonCancel ); } /* * Destroys the object and frees any allocated resources */ CategoryEditDialog_base::~CategoryEditDialog_base() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void CategoryEditDialog_base::languageChange() { setCaption( tr2i18n( "Edit Categories" ) ); // mButtonHelp->setText( tr2i18n( "&Help" ) ); // mApply->setText( tr2i18n( "&Apply" ) ); mButtonOk->setText( tr2i18n( "&OK" ) ); mButtonCancel->setText( tr2i18n( "&Cancel" ) ); mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); mButtonAdd->setText( tr2i18n( "A&dd" ) ); mButtonModify->setText( tr2i18n( "&Modify" ) ); mButtonRemove->setText( tr2i18n( "&Remove" ) ); } void CategoryEditDialog_base::add() { qWarning( "CategoryEditDialog_base::add(): Not implemented yet" ); } void CategoryEditDialog_base::modify() { qWarning( "CategoryEditDialog_base::modify(): Not implemented yet" ); } void CategoryEditDialog_base::slotApply() { qWarning( "CategoryEditDialog_base::slotApply(): Not implemented yet" ); } void CategoryEditDialog_base::remove() { qWarning( "CategoryEditDialog_base::remove(): Not implemented yet" ); } void CategoryEditDialog_base::slotOk() { qWarning( "CategoryEditDialog_base::slotOk(): Not implemented yet" ); } -#include "categoryeditdialog_base.moc" +//US #include "categoryeditdialog_base.moc" diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 7b0aced..943d35c 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp @@ -1,173 +1,173 @@ /* This file is part of libkdepim. Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 <qlistview.h> #include <qpushbutton.h> #include <qheader.h> #include <qapp.h> #include <qmessagebox.h> #include <libkdepim/categoryeditdialog.h> #include "categoryselectdialog.h" #include "kpimprefs.h" using namespace KPIM; CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, const char* name, bool modal, WFlags fl ) : CategorySelectDialog_base( parent, name, true, fl ), mPrefs( prefs ) { mCategories->header()->hide(); setCategories(); connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); if ( qApp->desktop()->height() < 321 ) setMaximumHeight( QApplication::desktop()->height() - 50 ); else setMaximumHeight( QApplication::desktop()->height() - 80 ); if ( QApplication::desktop()->width() > 460 ) resize( 260, 360 ); } void CategorySelectDialog::editCategoriesDialog() { KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); ced->exec(); delete ced; setCategories(); } void CategorySelectDialog::setCategories() { mCategories->clear(); mCategoryList.clear(); QStringList::Iterator it; for (it = mPrefs->mCustomCategories.begin(); it != mPrefs->mCustomCategories.end(); ++it ) { new QCheckListItem(mCategories,*it,QCheckListItem::CheckBox); } } CategorySelectDialog::~CategorySelectDialog() { } void CategorySelectDialog::setSelected(const QStringList &selList) { clear(); QStringList::ConstIterator it; QStringList notFound; bool found = false; for (it=selList.begin();it!=selList.end();++it) { //qDebug(" CategorySelectDialog::setSelected("); QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->text() == *it) { item->setOn(true); found = true; break; } item = (QCheckListItem *)item->nextSibling(); } // if ( ! found ) { //emit updateCategoriesGlobal(); // QMessageBox::information( this, "KO/E: Information!", // "Categories found, which were not\n" // "in list of categories!\n" // "message", // "OK", "", 0, // 0, 1 ); // setSelected(selList); // return; // } } } QStringList CategorySelectDialog::selectedCategories() const { return mCategoryList; } void CategorySelectDialog::slotApply() { QStringList categories; QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->isOn()) { categories.append(item->text()); } item = (QCheckListItem *)item->nextSibling(); } QString categoriesStr = categories.join(","); mCategoryList = categories; emit categoriesSelected(categories); emit categoriesSelected(categoriesStr); } void CategorySelectDialog::accept() { slotOk(); } void CategorySelectDialog::slotOk() { slotApply(); QDialog::accept(); } void CategorySelectDialog::clear() { QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { item->setOn(false); item = (QCheckListItem *)item->nextSibling(); } } void CategorySelectDialog::updateCategoryConfig() { QStringList selected; QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); while (item) { if (item->isOn()) { selected.append(item->text()); } item = (QCheckListItem *)item->nextSibling(); } setCategories(); setSelected(selected); } -#include "categoryselectdialog.moc" +//#include "categoryselectdialog.moc" diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp index 5e5fa72..3f050cf 100644 --- a/libkdepim/categoryselectdialog_base.cpp +++ b/libkdepim/categoryselectdialog_base.cpp @@ -1,128 +1,128 @@ #include <klocale.h> /**************************************************************************** ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' ** ** Created: Sat Mar 29 21:46:05 2003 ** by: The User Interface Compiler () ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "categoryselectdialog_base.h" #include <qvariant.h> #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> /* * Constructs a CategorySelectDialog_base as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "CategorySelectDialog_base" ); CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout"); mCategories = new QListView( this, "mCategories" ); mCategories->addColumn( i18n( "Category" ) ); CategorySelectDialog_baseLayout->addWidget( mCategories ); Layout12 = new QHBoxLayout( 0, 0, 6, "Layout12"); mClear = new QPushButton( this, "mClear" ); Layout12->addWidget( mClear ); // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); //Layout12->addItem( spacer ); mButtonEdit = new QPushButton( this, "mButtonEdit" ); Layout12->addWidget( mButtonEdit ); CategorySelectDialog_baseLayout->addLayout( Layout12 ); Layout11 = new QHBoxLayout( 0, 0, 6, "Layout11"); //mButtonHelp = new QPushButton( this, "mButtonHelp" ); //Layout11->addWidget( mButtonHelp ); //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); // Layout11->addItem( spacer_2 ); //mApply = new QPushButton( this, "mApply" ); // Layout11->addWidget( mApply ); mButtonOk = new QPushButton( this, "mButtonOk" ); mButtonOk->setOn( FALSE ); mButtonOk->setDefault( TRUE ); Layout11->addWidget( mButtonOk ); mButtonCancel = new QPushButton( this, "mButtonCancel" ); Layout11->addWidget( mButtonCancel ); CategorySelectDialog_baseLayout->addLayout( Layout11 ); languageChange(); // resize( sizeHint() ); // signals and slots connections connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) ); //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); // tab order setTabOrder( mCategories, mClear ); setTabOrder( mClear, mButtonEdit ); setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp ); // setTabOrder( mButtonHelp, mApply ); // setTabOrder( mApply, mButtonOk ); setTabOrder( mButtonOk, mButtonCancel ); // showMaximized(); //raise(); } /* * Destroys the object and frees any allocated resources */ CategorySelectDialog_base::~CategorySelectDialog_base() { // no need to delete child widgets, Qt does it all for us } /* * Sets the strings of the subwidgets using the current * language. */ void CategorySelectDialog_base::languageChange() { setCaption( i18n( "Select Categories" ) ); mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); mClear->setText( i18n( " &Deselect All " ) ); mButtonEdit->setText( i18n( " &Edit Categories " ) ); // mButtonHelp->setText( tr2i18n( "&Help" ) ); //mApply->setText( i18n( "&Apply" ) ); mButtonOk->setText( i18n( "&OK" ) ); mButtonCancel->setText( i18n( "&Cancel" ) ); } void CategorySelectDialog_base::clear() { qWarning( "CategorySelectDialog_base::clear(): Not implemented yet" ); } void CategorySelectDialog_base::slotApply() { qWarning( "CategorySelectDialog_base::slotApply(): Not implemented yet" ); } void CategorySelectDialog_base::slotOk() { qWarning( "CategorySelectDialog_base::slotOk(): Not implemented yet" ); } -#include "categoryselectdialog_base.moc" +//US#include "categoryselectdialog_base.moc" diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 60bd2cf..5fb948a 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -1,486 +1,486 @@ /* This file is part of libkdepim. Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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., 675 Mass Ave, Cambridge, MA 02139, 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 <qapplication.h> #include <qevent.h> #include <qlineedit.h> #include <qpixmap.h> #include <qpushbutton.h> #include <kdatepicker.h> #include <kdebug.h> #include <kglobal.h> #include <kiconloader.h> #include <klocale.h> #include <kmessagebox.h> #include <knotifyclient.h> #include <qpalette.h> #include "kdateedit.h" -#include "kdateedit.moc" +//#include "kdateedit.moc" KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) : QHBox(parent, name) { dateFormShort = true; withoutDp = withoutDP; mDateEdit = new QLineEdit(this); mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort)); setFocusProxy(mDateEdit); mDateEdit->installEventFilter(this); // Highlight Background and Textcolor QPalette palette = QWidget::palette(); unsigned char red, green, blue; red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); mDateEdit->setPalette( palette ); if ( withoutDP ) { mDateFrame = 0; mDateButton = 0; mDatePicker = 0; } else { QPixmap pixmap = SmallIcon("smallcal"); mDateButton = new QPushButton(this); mDateButton->setPixmap(pixmap); mDateFrame = new QVBox(0,0,WType_Popup); // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); mDateFrame->setLineWidth(3); mDateFrame->hide(); mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); //mDateFrame->resize( 400, 300 ); } connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); connect(mDateEdit,SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &))); // Create the keyword list. This will be used to match against when the user // enters information. mKeywordMap[i18n("tomorrow")] = 1; mKeywordMap[i18n("today")] = 0; mKeywordMap[i18n("yesterday")] = -1; /* * This loop uses some math tricks to figure out the offset in days * to the next date the given day of the week occurs. There * are two cases, that the new day is >= the current day, which means * the new day has not occured yet or that the new day < the current day, * which means the new day is already passed (so we need to find the * day in the next week). */ QString dayName; int currentDay = QDate::currentDate().dayOfWeek(); for (int i = 1; i <= 7; ++i) { dayName = KGlobal::locale()->weekDayName(i).lower(); if (i >= currentDay) mKeywordMap[dayName] = i - currentDay; else mKeywordMap[dayName] = 7 - currentDay + i; } mTextChanged = false; mHandleInvalid = false; QWidget::setTabOrder( mDateEdit, mDateButton ); } KDateEdit::~KDateEdit() { delete mDateFrame; } void KDateEdit::setDate(QDate newDate) { if (!newDate.isValid() && !mHandleInvalid) return; if ( readDate() == newDate ) return; QString dateString = ""; if(newDate.isValid()) dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); mTextChanged = false; // We do not want to generate a signal here, since we explicity setting // the date bool b = mDateEdit->signalsBlocked(); mDateEdit->blockSignals(true); mDateEdit->setText(dateString); mDateEdit->blockSignals(b); } void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort) { QString dateForm = dateFormShort ? KGlobal::locale()->dateFormatShort() : KGlobal::locale()->dateFormat(); int begin = dateForm.find("%"); int space = 0; int allStrLength = 0; int strLength = 0; int repeat = 0; // witch? Day, Month or Year switch? while(1){ switch ( dateForm.at(begin + 1).latin1() ) { case 'd':// 16 (month day) strLength = 2; //Ok break; case 'm':// 01 (month) strLength = 2; //Ok break; case 'a':// Mon (Weekday) strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); break; case 'A':// Monday (Weekday) strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); break; case 'b':// Jan (monthName) strLength = KGlobal::locale()->monthName(date.month(), true).length(); break; case 'B':// January (monthName) strLength = KGlobal::locale()->monthName(date.month(), false).length(); break; case 'y':// 04 (year short) strLength = 2; //Ok break; case 'Y':// 2004 (year) strLength = 4; //Ok break; default: break; } space = begin - (repeat++ * 2); // all select? then dayswitch if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && ( (dateForm.at(begin + 1).latin1() == 'd') || (dateForm.at(begin + 1).latin1() == 'a') || (dateForm.at(begin + 1).latin1() == 'A') ) ) { break; } // mDateEdit-StringPos == CursorPosition(cpos) then break and set date if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { break; } allStrLength += strLength; begin = dateForm.find("%", begin +1); } // set date switch ( dateForm.at(begin + 1).latin1() ) { case 'd': case 'a': case 'A': if(key == Key_Up) { setDate( date.addDays( 1 ) ); } else if(key == Key_Down) { setDate( date.addDays( -1 ) ); } maxDay = readDate().day(); break; case 'm': case 'b': case 'B': if(key == Key_Up) { int year = ((date.month()+1)>12)?date.year()+1:date.year(); int month = ((date.month()+1)>12)?1:date.month()+1; int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; setDate( QDate( year, month, day ) ); } else if(key == Key_Down) { int year = ((date.month()-1)<1)?date.year()-1:date.year(); int month = ((date.month()-1)<1)?12:date.month()-1; int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; setDate( QDate( year, month, day ) ); } break; case 'y': case 'Y': if(key == Key_Up) { setDate( QDate( date.year() + 1, date.month() , date.day()) ); } else if(key == Key_Down) { setDate( QDate( date.year() - 1, date.month() , date.day()) ); } break; /* default: if(key == Key_Up) { setDate( date.addDays( 1 ) ); } else if(key == Key_Down) { setDate( date.addDays( -1 ) ); } break;*/ } date = readDate(); begin = dateForm.find("%"); int allSelectStrLength = 0; int selectStrLength = 0; // set selection do new date an set cursor at end of selection for(int i = 0; i < repeat; i++){ switch ( dateForm.at(begin + 1).latin1() ) { case 'd':// 16 (month day) selectStrLength = 2; //Ok break; case 'm':// 01 (month) selectStrLength = 2; //Ok break; case 'a':// Mon (Weekday short) selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); break; case 'A':// Monday (Weekday) selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); break; case 'b':// Jan (monthName short) selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); break; case 'B':// January (monthName) selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); break; case 'y':// 04 (year short) selectStrLength = 2; //Ok break; case 'Y':// 2004 (year) selectStrLength = 4; //Ok break; default: break; } space = begin - (i * 2); allSelectStrLength += selectStrLength; begin = dateForm.find("%", begin +1); } // set selection from begin of date setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); *cpos = space + allSelectStrLength; emit(dateChanged(date)); return; } void KDateEdit::setHandleInvalid(bool handleInvalid) { mHandleInvalid = handleInvalid; } void KDateEdit::setEnabled(bool on) { mDateEdit->setEnabled(on); mDateButton->setEnabled(on); } QDate KDateEdit::date() const { QDate date = readDate(); if (date.isValid() || mHandleInvalid) { return date; } else { KNotifyClient::beep(); return QDate::currentDate(); } } void KDateEdit::keyPressEvent(QKeyEvent *e) { QDate date = readDate(); int cpos = mDateEdit->cursorPosition(); switch(e->key()) { case Key_Escape: mDateEdit->deselect(); case Key_Tab: QHBox::keyPressEvent(e); break; case Key_Up: // when date invalid then set to currend and return if(!date.isValid()) { date = QDate::currentDate(); setDate(date); mDateEdit->setCursorPosition(cpos); emit(dateChanged(date)); QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); KMessageBox::information( 0, text ); return; } setDate(date, &cpos, Key_Up, dateFormShort); break; case Key_Down: // when date invalid then set to current and return if(!date.isValid()) { date = QDate::currentDate(); setDate(date); mDateEdit->setCursorPosition(cpos); emit(dateChanged(date)); QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); KMessageBox::information( 0, text ); return; } setDate(date, &cpos, Key_Down, dateFormShort); break; default: QHBox::keyPressEvent(e); break; } // switch mDateEdit->setCursorPosition(cpos); } void KDateEdit::setSelect( int from, int to ) { // return; mDateEdit->setSelection( from , to ); } void KDateEdit::toggleDatePicker() { if( mDateFrame->isVisible() ) { mDateFrame->hide(); } else { QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); QSize datepickersize = mDatePicker->sizeHint(); if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); int h = QApplication::desktop()->height(); if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); QDate date = readDate(); if(date.isValid()) { mDatePicker->setDate(date); } else { mDatePicker->setDate(QDate::currentDate()); } mDateFrame->show(); } } void KDateEdit::lineEnterPressed() { QDate date = readDate(); if(date.isValid()) { // Update the edit. This is needed if the user has entered a // word rather than the actual date. setDate(date); emit(dateChanged(date)); emit returnPressed(); } else { if ( withoutDp ) { KNotifyClient::beep(); } else { if ( !mDateEdit->text().isEmpty() ) { mTextChanged = false; QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { setDate( QDate::currentDate() ); emit dateChanged( QDate::currentDate() ); } } } } } bool KDateEdit::inputIsValid() { return readDate().isValid(); } QDate KDateEdit::readDate() const { QString text = mDateEdit->text(); QDate date; if (mKeywordMap.contains(text.lower())) { date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); } else { date = KGlobal::locale()->readDate(text); } return date; } bool KDateEdit::eventFilter(QObject *, QEvent *e) { // We only process the focus out event if the text has changed // since we got focus if ((e->type() == QEvent::FocusOut) && mTextChanged) { lineEnterPressed(); mTextChanged = false; } // switch dateFormShort by double klick with mouse else if (e->type() == QEvent::MouseButtonDblClick) { dateFormShort = dateFormShort?false:true; mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); } else if (e->type() == QEvent::FocusIn) { maxDay = readDate().day(); } return false; } void KDateEdit::textChanged(const QString &) { if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { QDate date; //invalid date emit(dateChanged(date)); } else { mTextChanged = true; } maxDay = readDate().day(); } diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 6e5ec0f..3fe139c 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp @@ -1,472 +1,472 @@ /* -*- C++ -*- This file is part of the KDE libraries Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) (C) 1998-2001 Mirko Boehm (mirko@kde.org) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kdatepicker.h" #include <kglobal.h> #include <kapplication.h> #include <klocale.h> #include <kiconloader.h> #include <qframe.h> #include <qpainter.h> #include <qdialog.h> #include <qtoolbutton.h> #include <qfont.h> #include <qapplication.h> #include <qlineedit.h> #include <qvalidator.h> #include <kdebug.h> #include <knotifyclient.h> #include "kdatetbl.h" #include "kdateedit.h" -#include "kdatepicker.moc" +//#include "kdatepicker.moc" KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) : QFrame(parent,name), yearForward(new QToolButton(this)), yearBackward(new QToolButton(this)), monthForward(new QToolButton(this)), monthBackward(new QToolButton(this)), selectMonth(new QToolButton(this)), selectYear(new QToolButton(this)), //line(new QLineEdit(this)), val(new KDateValidator(this)) //table(new KDateTable(this)), //fontsize(1) { // ----- int size = 12; if ( QApplication::desktop()->width() >= 480 ) size = 18; fontsize = size; setFont ( QFont("helvetica",size) ); table = new KDateTable(this); setFontSize(size); //line->setValidator(val); lineDate = new KDateEdit( this, "dateediipicker", true ); yearForward->setPixmap(SmallIcon("2rightarrowB")); yearBackward->setPixmap(SmallIcon("2leftarrowB")); monthForward->setPixmap(SmallIcon("1rightarrowB")); monthBackward->setPixmap(SmallIcon("1leftarrowB")); setDate(dt); // set button texts connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); table->setFocus(); } KDatePicker::~KDatePicker() { } void KDatePicker::resizeEvent(QResizeEvent*) { QWidget *buttons[] = { yearBackward, monthBackward, selectMonth, selectYear, monthForward, yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); QSize sizes[NoOfButtons]; int buttonHeight=0; int count; int w; int x=0; // ----- calculate button row height: for(count=0; count<NoOfButtons; ++count) { int xS = buttons[count]->sizeHint().width(); int yS = buttons[count]->sizeHint().height(); sizes[count]=QSize ( xS+10, yS ); buttonHeight=QMAX(buttonHeight, sizes[count].height()); } buttonHeight += 10; // ----- calculate size of the month button: w=0; for(count=0; count<NoOfButtons; ++count) { if(buttons[count]!=selectMonth) { w+=sizes[count].width(); } else { x=count; } } sizes[x].setWidth(width()-w); // stretch the month button // ----- place the buttons: x=0; for(count=0; count<NoOfButtons; ++count) { w=sizes[count].width(); buttons[count]->setGeometry(x, 0, w, buttonHeight); x+=w; } // ----- place the line edit for direct input: sizes[0]=lineDate->sizeHint(); //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); // ----- adjust the table: table->setGeometry(0, buttonHeight, width(), height()-buttonHeight-sizes[0].height()); } void KDatePicker::dateChangedSlot(QDate date) { lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); //line->setText(KGlobal::locale()->formatDate(date, true)); emit(dateChanged(date)); } void KDatePicker::tableClickedSlot() { emit(dateSelected(table->getDate())); emit(tableClicked()); } const QDate& KDatePicker::getDate() const { return table->getDate(); } const QDate & KDatePicker::date() const { return table->getDate(); } void KDatePicker::slotSetDate( QDate date ) { if(date.isValid()) { QString temp; // ----- table->setDate(date); selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); temp.setNum(date.year()); selectYear->setText(temp); //line->setText(KGlobal::locale()->formatDate(date, true)); lineDate->setDate( date ); } } bool KDatePicker::setDate(const QDate& date) { table->setFocus(); if(date.isValid()) { QString temp; // ----- table->setDate(date); selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); temp.setNum(date.year()); selectYear->setText(temp); //line->setText(KGlobal::locale()->formatDate(date, true)); lineDate->setDate( date ); return true; } else { return false; } } void KDatePicker::monthForwardClicked() { QDate temp=table->getDate(); int day=temp.day(); // ----- if(temp.month()==12) { temp.setYMD(temp.year()+1, 1, 1); } else { temp.setYMD(temp.year(), temp.month()+1, 1); } if(temp.daysInMonth()<day) { temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); } else { temp.setYMD(temp.year(), temp.month(), day); } // assert(temp.isValid()); setDate(temp); } void KDatePicker::monthBackwardClicked() { QDate temp=table->getDate(); int day=temp.day(); // ----- if(temp.month()==1) { temp.setYMD(temp.year()-1, 12, 1); } else { temp.setYMD(temp.year(), temp.month()-1, 1); } if(temp.daysInMonth()<day) { temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); } else { temp.setYMD(temp.year(), temp.month(), day); } // assert(temp.isValid()); setDate(temp); } void KDatePicker::yearForwardClicked() { QDate temp=table->getDate(); int day=temp.day(); // ----- temp.setYMD(temp.year()+1, temp.month(), 1); if(temp.daysInMonth()<day) { temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); } else { temp.setYMD(temp.year(), temp.month(), day); } // assert(temp.isValid()); setDate(temp); } void KDatePicker::yearBackwardClicked() { QDate temp=table->getDate(); int day=temp.day(); // ----- temp.setYMD(temp.year()-1, temp.month(), 1); if(temp.daysInMonth()<day) { temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); } else { temp.setYMD(temp.year(), temp.month(), day); } // assert(temp.isValid()); setDate(temp); } void KDatePicker::selectMonthClicked() { int month; KPopupFrame* popup = new KPopupFrame(this); KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(fontsize, popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); picker->setFocus(); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) { QDate date; int day; // ----- month=picker->getResult(); date=table->getDate(); day=date.day(); // ----- construct a valid date in this month: date.setYMD(date.year(), month, 1); date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); // ----- set this month setDate(date); } else { KNotifyClient::beep(); } delete popup; } void KDatePicker::selectYearClicked() { int year; KPopupFrame* popup = new KPopupFrame(this); KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); picker->setFocus(); if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) { QDate date; int day; // ----- year=picker->getYear(); date=table->getDate(); day=date.day(); // ----- construct a valid date in this month: date.setYMD(year, date.month(), 1); date.setYMD(year, date.month(), QMIN(day, date.daysInMonth())); // ----- set this month setDate(date); } else { KNotifyClient::beep(); } delete popup; } void KDatePicker::setEnabled(bool enable) { QWidget *widgets[]= { yearForward, yearBackward, monthForward, monthBackward, selectMonth, selectYear, lineDate, table }; const int Size=sizeof(widgets)/sizeof(widgets[0]); int count; // ----- for(count=0; count<Size; ++count) { widgets[count]->setEnabled(enable); } } void KDatePicker::lineEnterPressed() { QDate temp; // ----- temp = lineDate->date(); //if(val->date(line->text(), temp)==QValidator::Acceptable) //{ emit(dateEntered(temp)); setDate(temp); // } else { // KNotifyClient::beep(); // } } QSize KDatePicker::sizeHint() const { QSize tableSize=table->sizeHint(); QWidget *buttons[]={ yearBackward, monthBackward, selectMonth, selectYear, monthForward, yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); QSize sizes[NoOfButtons]; int cx=0, cy=0, count; // ----- store the size hints: for(count=0; count<NoOfButtons; ++count) { sizes[count]=buttons[count]->sizeHint(); if(buttons[count]==selectMonth) { cx+=maxMonthRect.width()+15; } else { cx+=sizes[count].width()+15; } cy=QMAX(sizes[count].height(), cy); } // ----- calculate width hint: cx=QMAX(cx, tableSize.width()); // line edit ignored if ( cx > QApplication::desktop()->width() -5 ) cx = QApplication::desktop()->width() -5; // ----- calculate height hint: cy+=tableSize.height()+lineDate->sizeHint().height(); return QSize(cx, cy); } void KDatePicker::setFontSize(int s) { QWidget *buttons[]= { // yearBackward, // monthBackward, selectMonth, selectYear, // monthForward, // yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); int count; QFont font; QRect r; // ----- fontsize=s; for(count=0; count<NoOfButtons; ++count) { font=buttons[count]->font(); font.setPointSize(s); buttons[count]->setFont(font); } QFontMetrics metrics(selectMonth->fontMetrics()); for(int i=1; i <= 12; ++i) { // maxMonthRect is used by sizeHint() r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); } table->setFontSize(s); } void KDatePicker::virtual_hook( int id, void* data ) { /*BASE::virtual_hook( id, data );*/ } void KDatePicker::keyPressEvent ( QKeyEvent * e ) { switch ( e->key() ) { case Qt::Key_Right: monthForwardClicked(); break; case Qt::Key_Left: monthBackwardClicked(); break; case Qt::Key_Down: yearForwardClicked(); break; case Qt::Key_Up: yearBackwardClicked(); break; case Qt::Key_Return: tableClickedSlot(); break; default: break; } } diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index 3a39ea9..205c526 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp @@ -1,410 +1,410 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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. */ // $Id$ #include <qlayout.h> #include <qlabel.h> #include <qgroupbox.h> #include <qbuttongroup.h> #include <qlineedit.h> #include <qfont.h> #include <qslider.h> #include <qfile.h> #include <qtextstream.h> #include <qvbox.h> #include <qhbox.h> #include <qspinbox.h> #include <qdatetime.h> #include <qframe.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qradiobutton.h> #include <qpushbutton.h> #include <qapplication.h> #include <kcolorbutton.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kfontdialog.h> #include <kmessagebox.h> #include <kcolordialog.h> #include <kiconloader.h> #include "kprefs.h" #include "kprefsdialog.h" -#include "kprefsdialog.moc" +//#include "kprefsdialog.moc" KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, QWidget *parent) { mReference = reference; mCheck = new QCheckBox(text,parent); } void KPrefsWidBool::readConfig() { mCheck->setChecked(*mReference); } void KPrefsWidBool::writeConfig() { *mReference = mCheck->isChecked(); } QCheckBox *KPrefsWidBool::checkBox() { return mCheck; } KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, QWidget *parent) { mReference = reference; mButton = new KColorButton(parent); mLabel = new QLabel(mButton, text, parent); mButton->setColor( *mReference ); mButton->setColor( Qt::red ); } KPrefsWidColor::~KPrefsWidColor() { // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; } void KPrefsWidColor::readConfig() { mButton->setColor(*mReference); } void KPrefsWidColor::writeConfig() { *mReference = mButton->color(); } QLabel *KPrefsWidColor::label() { return mLabel; } KColorButton *KPrefsWidColor::button() { return mButton; } KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, QFont *reference,QWidget *parent) { mReference = reference; mLabel = new QLabel(labelText, parent); mPreview = new QLabel(sampleText,parent); mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); mButton = new QPushButton(i18n("Choose..."), parent); connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); } KPrefsWidFont::~KPrefsWidFont() { } void KPrefsWidFont::readConfig() { mPreview->setFont(*mReference); } void KPrefsWidFont::writeConfig() { *mReference = mPreview->font(); } QLabel *KPrefsWidFont::label() { return mLabel; } QLabel *KPrefsWidFont::preview() { return mPreview; } QPushButton *KPrefsWidFont::button() { return mButton; } void KPrefsWidFont::selectFont() { QFont myFont(mPreview->font()); bool ok; myFont = KFontDialog::getFont(myFont, ok); if ( ok ) { mPreview->setFont(myFont); } } KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, QWidget *parent) { mReference = reference; mLabel = new QLabel(text,parent); mSpin = new QSpinBox(0,23,1,parent); mSpin->setSuffix(":00"); } void KPrefsWidTime::readConfig() { mSpin->setValue(*mReference); } void KPrefsWidTime::writeConfig() { *mReference = mSpin->value(); } QLabel *KPrefsWidTime::label() { return mLabel; } QSpinBox *KPrefsWidTime::spinBox() { return mSpin; } KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, QWidget *parent) { mReference = reference; mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); } KPrefsWidRadios::~KPrefsWidRadios() { } void KPrefsWidRadios::addRadio(const QString &text) { new QRadioButton(text,mBox); } QButtonGroup *KPrefsWidRadios::groupBox() { return mBox; } void KPrefsWidRadios::readConfig() { mBox->setButton(*mReference); } void KPrefsWidRadios::writeConfig() { *mReference = mBox->id(mBox->selected()); } KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, QWidget *parent, QLineEdit::EchoMode echomode) { mReference = reference; mLabel = new QLabel(text,parent); mEdit = new QLineEdit(parent); mEdit->setEchoMode( echomode ); } KPrefsWidString::~KPrefsWidString() { } void KPrefsWidString::readConfig() { mEdit->setText(*mReference); } void KPrefsWidString::writeConfig() { *mReference = mEdit->text(); } QLabel *KPrefsWidString::label() { return mLabel; } QLineEdit *KPrefsWidString::lineEdit() { return mEdit; } KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, name,modal,true) { mPrefs = prefs; // This seems to cause a crash on exit. Investigate later. // mPrefsWids.setAutoDelete(true); connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); } KPrefsDialog::~KPrefsDialog() { } void KPrefsDialog::addWid(KPrefsWid *wid) { mPrefsWids.append(wid); } KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) { KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); addWid(w); return w; } KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) { KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); addWid(w); return w; } KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) { KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); addWid(w); return w; } KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) { KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); addWid(w); return w; } KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) { KPrefsWidString *w = new KPrefsWidString(text,reference,parent); addWid(w); return w; } KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) { KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); addWid(w); return w; } KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, QFont *reference,QWidget *parent) { KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); addWid(w); return w; } void KPrefsDialog::setDefaults() { mPrefs->setDefaults(); readConfig(); } void KPrefsDialog::readConfig() { // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; KPrefsWid *wid; for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { wid->readConfig(); } usrReadConfig(); } void KPrefsDialog::writeConfig() { // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; KPrefsWid *wid; for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { wid->writeConfig(); } usrWriteConfig(); // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; mPrefs->writeConfig(); // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; } void KPrefsDialog::slotApply() { writeConfig(); emit configChanged(); } void KPrefsDialog::slotOk() { slotApply(); QDialog::accept(); } void KPrefsDialog::accept() { slotOk(); } void KPrefsDialog::slotDefault() { if (KMessageBox::warningContinueCancel(this, i18n("You are about to set all\npreferences to default values.\nAll " "custom modifications will be lost."),i18n("Setting Default Preferences"), i18n("Continue")) == KMessageBox::Continue) setDefaults(); } diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro index 05abaa5..414ac2b 100644 --- a/libkdepim/libkdepimE.pro +++ b/libkdepim/libkdepimE.pro @@ -1,43 +1,44 @@ TEMPLATE = lib CONFIG += qt warn_on TARGET = microkdepim INCLUDEPATH += ../microkde ../qtcompat ../libkabcwrap ../microkde/kdecore INCLUDEPATH += . .. LIBS += -lmicrokde +LIBS += -L$(QPEDIR)/lib OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/lib INTERFACES = \ HEADERS = \ categoryeditdialog.h \ categoryeditdialog_base.h \ categoryselectdialog.h \ categoryselectdialog_base.h \ kdateedit.h \ kdatepicker.h \ kinputdialog.h \ kincidenceformatter.h \ kpimprefs.h \ kprefs.h \ kprefsdialog.h \ addresseeview.h \ ksyncprofile.h SOURCES = \ categoryeditdialog.cpp \ categoryeditdialog_base.cpp \ categoryselectdialog.cpp \ categoryselectdialog_base.cpp \ kdateedit.cpp \ kinputdialog.cpp \ kdatepicker.cpp \ kincidenceformatter.cpp \ kpimprefs.cpp \ kprefs.cpp \ kprefsdialog.cpp \ addresseeview.cpp \ ksyncprofile.cpp |