summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-06 09:41:54 (UTC)
committer zautrix <zautrix>2005-04-06 09:41:54 (UTC)
commit03c5656deeec67eefcefb4faa1bfc9a9bc3254ef (patch) (side-by-side diff)
treeb514080a9b5256373967602d3a0ec41c68a70126 /korganizer
parentcf4848d972efe96640f2d5f5d52704306d0cbe4c (diff)
downloadkdepimpi-03c5656deeec67eefcefb4faa1bfc9a9bc3254ef.zip
kdepimpi-03c5656deeec67eefcefb4faa1bfc9a9bc3254ef.tar.gz
kdepimpi-03c5656deeec67eefcefb4faa1bfc9a9bc3254ef.tar.bz2
focus fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp13
-rw-r--r--korganizer/koeditorgeneral.h3
-rw-r--r--korganizer/koeventeditor.cpp1
3 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index abc80d4..f54660f 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -38,103 +38,108 @@
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <libkcal/todo.h>
#include <libkcal/event.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koglobals.h"
#include "koeditorgeneral.h"
#include "kolocationbox.h"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
QObject( parent, name)
{
+ mNextFocus = 0;
}
KOEditorGeneral::~KOEditorGeneral()
{
}
void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
{
QGridLayout *headerLayout = new QGridLayout(topLayout);
#if 0
mOwnerLabel = new QLabel(i18n("Owner:"),parent);
headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
#endif
QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
headerLayout->addWidget(summaryLabel,1,0);
mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
//mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
//qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
if ( QApplication::desktop()->width() > 320 )
mSummaryEdit->setMaximumHeight( hei +6 );
//qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
// SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
// mSummaryEdit = new QLineEdit(parent);
headerLayout->addWidget(mSummaryEdit,1,1);
connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
headerLayout->addWidget(locationLabel,2,0);
mLocationEdit = new KOLocationBox(TRUE,parent,10);
mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
if ( QApplication::desktop()->width() > 320 )
mLocationEdit->setMaximumHeight( hei + 6);
// mLocationEdit = new QLineEdit(parent);
connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
headerLayout->addWidget(mLocationEdit,2,1);
headerLayout->setColStretch( 1, 10);
}
void KOEditorGeneral::setFocusOn( int i )
{
- qApp->processEvents();
- if ( i == 1 ) {
+ mNextFocus = i;
+ QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
+}
+void KOEditorGeneral::slotSetFocusOn()
+{
+ mNextFocus;
+ if ( mNextFocus == 1 ) {
mDescriptionEdit->setFocus();
mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
}
- if ( i == 2 ) {
+ if ( mNextFocus == 2 ) {
mSummaryEdit->setFocus();
}
-
}
void KOEditorGeneral::editCategories()
{
// qDebug("KOEditorGeneral::editCategories() ");
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
//KOGlobals::fitDialogToScreen( csd );
csd->setColorEnabled();
csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
csd->exec();
delete csd;
}
void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
{
QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
mCategoriesButton = new QPushButton(parent);
mCategoriesButton->setText(i18n("Categories..."));
connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
categoriesLayout->addWidget(mCategoriesButton);
mCategoriesLabel = new QLabel(parent);
mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
categoriesLayout->addWidget(mCategoriesLabel,1);
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index f4728c7..2069e9c 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -60,54 +60,55 @@ class KOEditorGeneral : public QObject
void initAlarm(QWidget *,QBoxLayout *);
/** Set widgets to default values */
void setDefaults(bool allDay);
/** Read event object and setup widgets accordingly */
void readIncidence(Incidence *);
/** Write event settings to event object */
void writeIncidence(Incidence *);
/** Check if the input is valid. */
bool validateInput() { return true; }
void enableAlarm( bool enable );
void setSecrecy( int num );
public slots:
void setCategories(const QString &);
void editCategories();
protected slots:
void enableAlarmEdit( bool enable );
void disableAlarmEdit( bool disable );
void alarmDisable( bool disable );
void pickAlarmSound();
void pickAlarmProgram();
-
+ void slotSetFocusOn();
signals:
void openCategoryDialog();
void allAccepted();
protected:
+ int mNextFocus;
//QLineEdit *mSummaryEdit;
//QLineEdit *mLocationEdit;
KOLocationBox *mSummaryEdit;
KOLocationBox *mLocationEdit;
QLabel *mAlarmBell;
QCheckBox *mAlarmButton;
QSpinBox *mAlarmTimeEdit;
QPushButton *mAlarmSoundButton;
QPushButton *mAlarmProgramButton;
QComboBox *mAlarmIncrCombo;
KTextEdit *mDescriptionEdit;
QLabel *mOwnerLabel;
QComboBox *mSecrecyCombo;
QCheckBox *mCancelBox;
QPushButton *mCategoriesButton;
QLabel *mCategoriesLabel;
private:
QString getFittingPath( const QString ) ;
QString mAlarmSound;
QString mAlarmProgram;
QString mAlarmMessage;
};
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 337db9b..e23e680 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -165,49 +165,48 @@ void KOEventEditor::setupGeneral()
QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
mGeneral->initCategories( topFrame, detailsLayout );
mGeneral->initSecrecy( topFrame, detailsLayout );
}
mGeneral->finishSetup();
}
void KOEventEditor::setupRecurrence()
{
QFrame *topFrame = addPage( i18n("Recurrence") );
QBoxLayout *topLayout = new QVBoxLayout( topFrame );
mRecurrence = new KOEditorRecurrence( topFrame );
topLayout->addWidget( mRecurrence );
}
void KOEventEditor::editEvent(Event *event, bool showDescription)
{
// init();
mEvent = event;
readEvent(mEvent);
- qApp->processEvents();
if ( showDescription ) {
showPage( 1 );
mGeneral->setFocusOn( 1 );
} else {
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
}
void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
{
// init();
mEvent = 0;
setDefaults(from,to,allDay);
}
void KOEventEditor::loadDefaults()
{
int fmt = KOPrefs::instance()->mStartTime;
QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
QDateTime to(QDate::currentDate(),
QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));