summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditorgeneral.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 9df76e7..0045b7f 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -139,193 +139,193 @@ void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *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);
}
void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
{
QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
secrecyLayout->addWidget(mCancelBox);
secrecyLayout->addWidget(secrecyLabel);
mSecrecyCombo = new QComboBox(parent);
mSecrecyCombo->insertStringList(Incidence::secrecyList());
secrecyLayout->addWidget(mSecrecyCombo);
}
void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
{
mDescriptionEdit = new KTextEdit(parent);
mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
mDescriptionEdit->append("");
mDescriptionEdit->setReadOnly(false);
mDescriptionEdit->setOverwriteMode(false);
mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
topLayout->addWidget(mDescriptionEdit);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
#endif
}
void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
{
QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
//mAlarmBell = new QLabel(parent);
//mAlarmBell->setPixmap(SmallIcon("bell"));
//alarmLayout->addWidget(mAlarmBell);
if ( QApplication::desktop()->width() < 320 )
mAlarmButton = new QCheckBox(i18n("Rem."),parent);
else
mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
alarmLayout->addWidget(mAlarmButton);
mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
alarmLayout->addWidget(mAlarmTimeEdit);
mAlarmIncrCombo = new QComboBox(false, parent);
if ( QApplication::desktop()->width() < 320 ) {
mAlarmIncrCombo->insertItem(i18n("min"));
mAlarmIncrCombo->insertItem(i18n("hou"));
mAlarmIncrCombo->insertItem(i18n("day"));
mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
} else {
mAlarmIncrCombo->insertItem(i18n("minute(s)"));
mAlarmIncrCombo->insertItem(i18n("hour(s)"));
mAlarmIncrCombo->insertItem(i18n("day(s)"));
}
// mAlarmIncrCombo->setMinimumHeight(20);
alarmLayout->addWidget(mAlarmIncrCombo);
mAlarmSoundButton = new QPushButton(parent);
mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
mAlarmSoundButton->setToggleButton(true);
QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
alarmLayout->addWidget(mAlarmSoundButton);
mAlarmProgramButton = new QPushButton(parent);
mAlarmProgramButton->setPixmap(SmallIcon("run"));
mAlarmProgramButton->setToggleButton(true);
QToolTip::add(mAlarmProgramButton, i18n("No program set"));
connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
alarmLayout->addWidget(mAlarmProgramButton);
mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
// if ( KOPrefs::instance()->mCompactDialogs ) {
// mAlarmSoundButton->hide();
// mAlarmProgramButton->hide();
// }
}
void KOEditorGeneral::pickAlarmSound()
{
- qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
+ //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
bool oldState = mAlarmSoundButton->isOn();
QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
i18n("*.wav|Wav Files"), 0));
if (!fileName.isEmpty()) {
mAlarmSound = fileName;
QToolTip::remove(mAlarmSoundButton);
QString dispStr = i18n("Playing '%1'").arg(fileName);
QToolTip::add(mAlarmSoundButton, dispStr);
mAlarmProgramButton->setOn(false);
mAlarmSoundButton->setOn(true);
QToolTip::add(mAlarmProgramButton, i18n("No program set"));
} else {
mAlarmProgramButton->setOn(oldState);
mAlarmSoundButton->setOn(!oldState);
}
if (mAlarmProgramButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
if ( mAlarmSoundButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
}
void KOEditorGeneral::pickAlarmProgram()
{
bool oldState = mAlarmProgramButton->isOn();
QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
if (!fileName.isEmpty()) {
mAlarmProgram = fileName;
QToolTip::remove(mAlarmProgramButton);
QString dispStr = i18n("Running '%1'").arg(fileName);
QToolTip::add(mAlarmProgramButton, dispStr);
mAlarmSoundButton->setOn(false);
mAlarmProgramButton->setOn(true);
QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
} else {
mAlarmProgramButton->setOn(!oldState);
mAlarmSoundButton->setOn(oldState);
}
if (mAlarmProgramButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
if ( mAlarmSoundButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
}
QString KOEditorGeneral::getFittingPath( const QString s )
{
int maxlen = 50;
if ( QApplication::desktop()->width() < 640 ) {
if ( QApplication::desktop()->width() < 320 )
maxlen = 22;
else
maxlen = 35;
}
if ( s.length() > maxlen ) {
return "..."+s.right(maxlen -3);
}
return s;
}
void KOEditorGeneral::enableAlarmEdit(bool enable)
{
if ( enable ) {
if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
mAlarmSoundButton->setOn( true );
if ( mAlarmSound.isEmpty() )
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
else {
if ( ! QFile::exists( mAlarmSound ) )
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
}
}
}
((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
mAlarmTimeEdit->setEnabled(enable);
mAlarmSoundButton->setEnabled(enable);
mAlarmProgramButton->setEnabled(enable);
mAlarmIncrCombo->setEnabled(enable);
}
void KOEditorGeneral::disableAlarmEdit(bool disable)
{
enableAlarmEdit( !disable );
}
void KOEditorGeneral::enableAlarm( bool enable )
{
enableAlarmEdit( enable );