summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp10
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kodialogmanager.cpp28
-rw-r--r--korganizer/kodialogmanager.h1
-rw-r--r--korganizer/koprefsdialog.cpp24
-rw-r--r--korganizer/mainwindow.cpp7
6 files changed, 51 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7c7466b..4794414 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2427,213 +2427,215 @@ void CalendarView::updateTodoViews()
mViewManager->currentView()->updateView();
}
void CalendarView::updateView(const QDate &start, const QDate &end)
{
mTodoList->updateView();
mViewManager->updateView(start, end);
//mDateNavigator->updateView();
}
void CalendarView::clearAllViews()
{
mTodoList->clearList();
mViewManager->clearAllViews();
SearchDialog * sd = mDialogManager->getSearchDialog();
if ( sd ) {
KOListView* kol = sd->listview();
if ( kol )
kol->clearList();
}
}
void CalendarView::updateView()
{
DateList tmpList = mNavigator->selectedDates();
if ( KOPrefs::instance()->mHideNonStartedTodos )
mTodoList->updateView();
// We assume that the navigator only selects consecutive days.
updateView( tmpList.first(), tmpList.last() );
}
void CalendarView::updateUnmanagedViews()
{
mDateNavigator->updateDayMatrix();
}
int CalendarView::msgItemDelete(const QString name)
{
return KMessageBox::warningContinueCancel(this,name +"\n\n"+
i18n("This item will be\npermanently deleted."),
i18n("KO/Pi Confirmation"),i18n("Delete"));
}
void CalendarView::edit_cut()
{
Event *anEvent=0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
factory.cutIncidence(anEvent);
changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
}
void CalendarView::edit_copy()
{
Event *anEvent=0;
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
if (!anEvent) {
KNotifyClient::beep();
return;
}
DndFactory factory( mCalendar );
factory.copyIncidence(anEvent);
}
void CalendarView::edit_paste()
{
QDate date = mNavigator->selectedDates().first();
DndFactory factory( mCalendar );
Event *pastedEvent = (Event *)factory.pasteIncidence( date );
changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
}
-
-void CalendarView::edit_options()
+void CalendarView::edit_global_options()
{
QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
emit save();
emit saveStopTimer();
- mDialogManager->showOptionsDialog();
+ mDialogManager->showGlobalOptionsDialog();
if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
emit saveStopTimer();
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
i18n("Timezone settings"),i18n("Reload"))) {
qDebug("KO: TZ reload cancelled ");
return;
}
qDebug("KO: Timezone change ");
openCalendar( MainWindow::defaultFileName() );
setModified(true);
}
else
qDebug("KO: No tz change ");
-
+}
+void CalendarView::edit_options()
+{
+ mDialogManager->showOptionsDialog();
}
void CalendarView::slotSelectPickerDate( QDate d)
{
mDateFrame->hide();
if ( mDatePickerMode == 1 ) {
mNavigator->slotDaySelect( d );
} else if ( mDatePickerMode == 2 ) {
if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
QTime tim;
int len = 0;
if ( to->hasStartDate() && to->hasDueDate() )
len = to->dtStart().secsTo( to->dtDue());
if ( to->hasDueDate() )
tim = to->dtDue().time();
else {
tim = QTime ( 0,0,0 );
to->setFloats( true );
to->setHasDueDate( true );
}
QDateTime dt ( d,tim );
to->setDtDue( dt );
if ( to->hasStartDate() ) {
if ( len>0 )
to->setDtStart(to->dtDue().addSecs( -len ));
else
if (to->dtStart() > to->dtDue() )
to->setDtStart(to->dtDue().addDays( -3 ));
}
todoChanged( to );
} else {
if ( mMoveIncidence->doesRecur() ) {
#if 0
// PENDING implement this
Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
mCalendar()->addIncidence( newInc );
if ( mMoveIncidence->typeID() == todoID )
emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
mMoveIncidence = newInc;
#endif
}
QTime tim = mMoveIncidence->dtStart().time();
int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
QDateTime dt ( d,tim );
mMoveIncidence->setDtStart( dt );
((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
}
mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
}
}
void CalendarView::removeCategories()
{
QPtrList<Incidence> incList = mCalendar->rawIncidences();
QStringList catList = KOPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
Incidence* inc = incList.first();
int i;
int count = 0;
while ( inc ) {
newCatList.clear();
catIncList = inc->categories() ;
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i]))
newCatList.append( catIncList[i] );
}
newCatList.sort();
inc->setCategories( newCatList.join(",") );
inc = incList.next();
}
}
int CalendarView::addCategories()
{
QPtrList<Incidence> incList = mCalendar->rawIncidences();
QStringList catList = KOPrefs::instance()->mCustomCategories;
QStringList catIncList;
Incidence* inc = incList.first();
int i;
int count = 0;
while ( inc ) {
catIncList = inc->categories() ;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 4600090..1215a99 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -256,192 +256,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
/** create new event without having a date hint. Takes current date as
default hint. */
void newEvent();
void newFloatingEvent();
/** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
void showIncidence(Incidence *);
void showIncidence(QString uid);
/** Create an editor for the supplied incidence. It calls the correct editXXX method*/
void editIncidence(Incidence *);
/** Delete the supplied incidence. It calls the correct deleteXXX method*/
void deleteIncidence(Incidence *);
void cloneIncidence(Incidence *);
void cancelIncidence(Incidence *);
/** Create an editor for the supplied event. */
void editEvent(Event *);
/** Delete the supplied event. */
void deleteEvent(Event *);
/** Delete the event with the given unique ID. Returns false, if event wasn't
found. */
bool deleteEvent(const QString &uid);
/** Create a read-only viewer dialog for the supplied event. */
void showEvent(Event *);
void editJournal(Journal *);
void showJournal(Journal *);
void deleteJournal(Journal *);
/** Create an editor dialog for a todo */
void editTodo(Todo *);
/** Create a read-only viewer dialog for the supplied todo */
void showTodo(Todo *);
/** create new todo */
void newTodo();
void newTodoDateTime(QDateTime, bool allday);
/** create new todo with a parent todo */
void newSubTodo();
/** create new todo with a parent todo */
void newSubTodo(Todo *);
/** Delete todo */
void deleteTodo(Todo *);
/** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
* emitted as result. */
void checkClipboard();
/** using the KConfig associated with the kapp variable, read in the
* settings from the config file.
*/
void readSettings();
/** write current state to config file. */
void writeSettings();
/** read settings for calendar filters */
void readFilterSettings(KConfig *config);
/** write settings for calendar filters */
void writeFilterSettings(KConfig *config);
/** passes on the message that an event has changed to the currently
* activated view so that it can make appropriate display changes. */
void changeEventDisplay(Event *, int);
void changeIncidenceDisplay(Incidence *, int);
void changeTodoDisplay(Todo *, int);
void eventAdded(Event *);
void eventChanged(Event *);
void eventToBeDeleted(Event *);
void eventDeleted();
void todoAdded(Todo *);
void todoChanged(Todo *);
void todoToBeDeleted(Todo *);
void todoDeleted();
void updateView(const QDate &start, const QDate &end);
void updateView();
void clearAllViews();
/** Full update of visible todo views */
void updateTodoViews();
void updateUnmanagedViews();
/** cut the current appointment to the clipboard */
void edit_cut();
/** copy the current appointment(s) to the clipboard */
void edit_copy();
/** paste the current vobject(s) in the clipboard buffer into calendar */
void edit_paste();
/** edit viewing and configuration options. */
void edit_options();
+ void edit_global_options();
/**
Functions for printing, previewing a print, and setting up printing
parameters.
*/
void print();
void printSetup();
void printPreview();
/** Export as iCalendar file */
void exportICalendar();
/** Export as vCalendar file */
bool exportVCalendar( QString fn);
/** pop up a dialog to show an existing appointment. */
void appointment_show();
/**
* pop up an Appointment Dialog to edit an existing appointment. Get
* information on the appointment from the list of unique IDs that is
* currently in the View, called currIds.
*/
void appointment_edit();
/**
* pop up dialog confirming deletion of currently selected event in the
* View.
*/
void appointment_delete();
/** mails the currently selected event to a particular user as a vCalendar
attachment. */
void action_mail();
/* frees a subtodo from it's relation */
void todo_unsub( Todo * );
void todo_resub( Todo * parent, Todo * sub );
/** Take ownership of selected event. */
void takeOverEvent();
/** Take ownership of all events in calendar. */
void takeOverCalendar();
/** query whether or not the calendar is "dirty". */
bool isModified();
/** set the state of calendar. Modified means "dirty", i.e. needing a save. */
void setModified(bool modified=true);
/** query if the calendar is read-only. */
bool isReadOnly();
/** set state of calendar to read-only */
void setReadOnly(bool readOnly=true);
void eventUpdated(Incidence *);
/* iTIP scheduling actions */
void schedule_publish(Incidence *incidence = 0);
void schedule_request(Incidence *incidence = 0);
void schedule_refresh(Incidence *incidence = 0);
void schedule_cancel(Incidence *incidence = 0);
void schedule_add(Incidence *incidence = 0);
void schedule_reply(Incidence *incidence = 0);
void schedule_counter(Incidence *incidence = 0);
void schedule_declinecounter(Incidence *incidence = 0);
void schedule_publish_freebusy(int daysToPublish = 30);
void openAddressbook();
void editFilters();
void toggleFilerEnabled();
QPtrList<CalFilter> filters();
void toggleFilter();
void showFilter(bool visible);
void updateFilter();
void filterEdited();
void selectFilter( int );
KOFilterView *filterView();
void showIntro();
/** Move the curdatepient view date to today */
void goToday();
/** Move to the next date(s) in the current view */
void goNext();
/** Move to the previous date(s) in the current view */
void goPrevious();
/** Move to the next date(s) in the current view */
void goNextMonth();
/** Move to the previous date(s) in the current view */
void goPreviousMonth();
void toggleExpand();
void toggleDateNavigatorWidget();
void toggleAllDaySize();
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index c927b37..aa30c52 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,212 +1,228 @@
/*
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.
*/
#include <libkdepim/categoryeditdialog.h>
#include "calendarview.h"
#include "incomingdialog.h"
#include "outgoingdialog.h"
#include "koprefsdialog.h"
#include "koeventeditor.h"
#include "koprefs.h"
#include "datenavigator.h"
#include "kotodoeditor.h"
#include "searchdialog.h"
#include "filtereditdialog.h"
#ifndef KORG_NOPLUGINS
#include "plugindialog.h"
#endif
#ifndef KORG_NOARCHIVE
#include "archivedialog.h"
#endif
#include "kconfig.h"
#include "kodialogmanager.h"
#include <kapplication.h>
KODialogManager::KODialogManager( CalendarView *mainView ) :
QObject(), mMainView( mainView )
{
mOutgoingDialog = 0;
mIncomingDialog = 0;
mOptionsDialog = 0;
mSearchDialog = 0;
mArchiveDialog = 0;
mFilterEditDialog = 0;
mPluginDialog = 0;
// mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
//KOGlobals::fitDialogToScreen( mCategoryEditDialog );
}
KODialogManager::~KODialogManager()
{
delete mOutgoingDialog;
delete mIncomingDialog;
delete mOptionsDialog;
delete mSearchDialog;
#ifndef KORG_NOARCHIVE
delete mArchiveDialog;
#endif
delete mFilterEditDialog;
#ifndef KORG_NOPLUGINS
delete mPluginDialog;
#endif
}
OutgoingDialog *KODialogManager::outgoingDialog()
{
createOutgoingDialog();
return mOutgoingDialog;
}
void KODialogManager::createOutgoingDialog()
{
if (!mOutgoingDialog) {
mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
mMainView,SIGNAL(numOutgoingChanged(int)));
}
}
+void KODialogManager::showGlobalOptionsDialog( bool showSync )
+{
+ if (!mOptionsDialog) {
+ mOptionsDialog = new KOPrefsDialog(0);
+ connect(mOptionsDialog,SIGNAL(configChanged()),
+ mMainView,SLOT(updateConfig()));
+ }
+ mOptionsDialog->readConfig();
+#ifndef DESKTOP_VERSION
+ mOptionsDialog->showMaximized();
+#else
+ mOptionsDialog->show();
+#endif
+ if ( showSync )
+ mOptionsDialog->showSyncPage();
+ mOptionsDialog->exec();
+ delete mOptionsDialog;
+ mOptionsDialog = 0;
+}
void KODialogManager::showOptionsDialog( bool showSync )
{
if (!mOptionsDialog) {
mOptionsDialog = new KOPrefsDialog(mMainView);
- //mOptionsDialog->readConfig();
connect(mOptionsDialog,SIGNAL(configChanged()),
mMainView,SLOT(updateConfig()));
- //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
- // mOptionsDialog,SLOT(updateCategories()));
-
}
mOptionsDialog->readConfig();
#ifndef DESKTOP_VERSION
mOptionsDialog->showMaximized();
#else
mOptionsDialog->show();
#endif
if ( showSync )
mOptionsDialog->showSyncPage();
mOptionsDialog->exec();
-
+ delete mOptionsDialog;
+ mOptionsDialog = 0;
}
void KODialogManager::showSyncOptions()
{
- showOptionsDialog( true );
+ showGlobalOptionsDialog( true );
}
void KODialogManager::showOutgoingDialog()
{
createOutgoingDialog();
mOutgoingDialog->show();
mOutgoingDialog->raise();
}
IncomingDialog *KODialogManager::incomingDialog()
{
createOutgoingDialog();
if (!mIncomingDialog) {
mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
mMainView,SIGNAL(numIncomingChanged(int)));
connect(mIncomingDialog,SIGNAL(calendarUpdated()),
mMainView,SLOT(updateView()));
}
return mIncomingDialog;
}
void KODialogManager::createIncomingDialog()
{
createOutgoingDialog();
if (!mIncomingDialog) {
mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
mMainView,SIGNAL(numIncomingChanged(int)));
connect(mIncomingDialog,SIGNAL(calendarUpdated()),
mMainView,SLOT(updateView()));
}
}
void KODialogManager::showIncomingDialog()
{
createIncomingDialog();
mIncomingDialog->show();
mIncomingDialog->raise();
}
/*
void KODialogManager::showCategoryEditDialog()
{
mCategoryEditDialog->show();
}
*/
void KODialogManager::hideSearchDialog()
{
if (mSearchDialog)
mSearchDialog->hide();
}
void KODialogManager::showSearchDialog()
{
if (!mSearchDialog) {
mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
KOListView * lview = mSearchDialog->listview();
connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
mMainView, SLOT(cloneIncidence(Incidence *)));
connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
mMainView, SLOT(beamIncidence(Incidence *)));
connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
mMainView, SLOT(moveIncidence(Incidence *)));
connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
// connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
// mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
#ifndef DESKTOP_VERSION
mSearchDialog->setMaximumSize( QApplication::desktop()->size());
mSearchDialog->showMaximized();
#else
KConfig *config = KOGlobals::config();
config->setGroup("WidgetLayout");
QStringList list;
list = config->readListEntry("SearchLayout");
int x,y,w,h;
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
mSearchDialog->setGeometry(x,y,w,h);
}
diff --git a/korganizer/kodialogmanager.h b/korganizer/kodialogmanager.h
index a6cc621..b68ddc2 100644
--- a/korganizer/kodialogmanager.h
+++ b/korganizer/kodialogmanager.h
@@ -1,100 +1,101 @@
/*
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.
*/
#ifndef KODIALOGMANAGER_H
#define KODIALOGMANAGER_H
#include <qobject.h>
#include <qptrlist.h>
#include <libkcal/calfilter.h>
class CalendarView;
class OutgoingDialog;
class IncomingDialog;
class KOPrefsDialog;
//namespace KPIM { class CategoryEditDialog; }
class KOEventEditor;
class KOTodoEditor;
class SearchDialog;
class ArchiveDialog;
class PluginDialog;
class KConfig;
class FilterEditDialog;
using namespace KCal;
/**
This class manages the dialogs used by the calendar view. It owns the objects
and handles creation and selection.
*/
class KODialogManager : public QObject
{
Q_OBJECT
public:
KODialogManager( CalendarView * );
virtual ~KODialogManager();
/** Get an editor dialog for an Event. */
KOEventEditor *getEventEditor();
/** Get an editor dialog for a Todo. */
KOTodoEditor *getTodoEditor();
OutgoingDialog *outgoingDialog();
IncomingDialog *incomingDialog();
void writeSettings( KConfig *config);
void updateSearchDialog();
SearchDialog * getSearchDialog();
void setDocumentId( const QString &id );
public slots:
void showOptionsDialog( bool showSync = false);
+ void showGlobalOptionsDialog(bool showSync = false);
void showSyncOptions();
void showIncomingDialog();
void showOutgoingDialog();
// void showCategoryEditDialog();
void showSearchDialog();
void showArchiveDialog();
void showFilterEditDialog(QPtrList<CalFilter> *filters);
void showPluginDialog();
void hideSearchDialog();
private:
void createOutgoingDialog();
void createIncomingDialog();
CalendarView *mMainView;
OutgoingDialog *mOutgoingDialog;
IncomingDialog *mIncomingDialog;
KOPrefsDialog *mOptionsDialog;
// KPIM::CategoryEditDialog *mCategoryEditDialog;
SearchDialog *mSearchDialog;
ArchiveDialog *mArchiveDialog;
FilterEditDialog *mFilterEditDialog;
PluginDialog *mPluginDialog;
};
#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index c9477e3..4b5b66a 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,339 +1,341 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,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.
*/
#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 <qcombobox.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qstrlist.h>
#include <qapplication.h>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include <kemailsettings.h>
#include <kstandarddirs.h>
#include <kglobalsettings.h>
#include <kurlrequester.h>
#include <klineedit.h>
#if defined(USE_SOLARIS)
#include <sys/param.h>
#define ZONEINFODIR "/usr/share/lib/zoneinfo"
#define INITFILE "/etc/default/init"
#endif
#include "koprefs.h"
#include "koprefsdialog.h"
#include "kpimglobalprefs.h"
KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
KPrefsDialog(KOPrefs::instance(),parent,name,true)
{
setFont( KGlobalSettings::generalMaxFont() );
setCaption( i18n("Preferences - some settings need a restart (nr)"));
mCategoryDict.setAutoDelete(true);
KGlobal::locale()->insertCatalogue("timezones");
mSpacingHint = spacingHintSmall();
mMarginHint = marginHintSmall();
#ifndef DESKTOP_VERSION
if ( QApplication::desktop()->height() == 480 )
hideButtons();
#endif
-
+ kdelibcfg = 0;
+ if ( !parent )
setupGlobalTab();
+ else {
setupMainTab();
// setupLocaleTab();
//setupTimeZoneTab();
setupTimeTab();
//setupLocaleDateTab();
setupFontsTab();
setupColorsTab();
setupViewsTab();
//setupSyncTab();
//setupSyncAlgTab();
//setupPrinterTab();
//setupGroupSchedulingTab();
//setupGroupAutomationTab();
-
+ }
}
KOPrefsDialog::~KOPrefsDialog()
{
}
void KOPrefsDialog::setupGlobalTab()
{
- QFrame *topFrame = addPage(i18n("Global"),0,0);
- kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
- QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
- topLayout->addWidget( kdelibcfg );
+ //QFrame *topFrame = addPage(i18n("Global"),0,0);
+ kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), this, "KCMKdeLibConfig" );
+ setMainWidget( kdelibcfg );
+ setCaption( i18n("KDE-Pim Global Settings"));
}
void KOPrefsDialog::setupLocaleDateTab()
{
#if 0
QFrame *topFrame = addPage(i18n("Date Format"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
KPrefsDialogWidRadios *syncPrefsGroup =
addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
QString format;
if ( QApplication::desktop()->width() < 480 )
format = "(%d.%m.%Y)";
else
format = "(%d.%m.%Y|%A %d %B %Y)";
syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%m.%d.%Y)";
else
format = "(%m.%d.%Y|%A %B %d %Y)";
syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%Y-%m-%d)";
else
format = "(%Y-%m-%d|%A %Y %B %d)";
syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
syncPrefsGroup->addRadio(i18n("User defined"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
++iii;
QLabel * lab;
mUserDateFormatLong = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatLong,iii,1);
++iii;
mUserDateFormatShort = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatShort,iii,1);
++iii;
lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupLocaleTab()
{
#if 0
QFrame *topFrame = addPage(i18n("Locale"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
KPrefsDialogWidRadios *syncPrefsGroup =
addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
syncPrefsGroup->addRadio(i18n("English"));
syncPrefsGroup->addRadio(i18n("German"));
syncPrefsGroup->addRadio(i18n("French"));
syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
if ( QApplication::desktop()->width() < 300 )
;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
syncPrefsGroup =
addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
if ( QApplication::desktop()->width() > 300 )
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
syncPrefsGroup->addRadio(i18n("24:00"));
syncPrefsGroup->addRadio(i18n("12:00am"));
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
KPrefsDialogWidBool *sb;
if ( QApplication::desktop()->width() < 300 ) {
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
}
else {
QWidget * hb = new QWidget( topFrame );
QHBoxLayout *hbLayout = new QHBoxLayout(hb);
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),hb);
hbLayout->addWidget(sb->checkBox() );
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),hb);
hbLayout->addWidget(sb->checkBox() );
topLayout->addMultiCellWidget(hb, iii,iii,0,1);
}
// KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
#if 0
++iii;
sb =
addWidBool(i18n("Quick load/save (w/o Unicode)"),
&(KOPrefs::instance()->mUseQuicksave),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
#endif
#endif
}
void KOPrefsDialog::showSyncPage()
{
- showPage ( 0 ) ;
+ // showPage ( 0 ) ;
kdelibcfg->showTimeZoneTab() ;
}
void KOPrefsDialog::setupSyncAlgTab()
{
#if 0
QLabel * lab;
QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
mSetupSyncAlgTab = topFrame;
QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
KPrefsDialogWidBool *sb =
addWidBool(i18n("Ask for preferences before syncing"),
&(KOPrefs::instance()->mAskForPreferences),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
KPrefsDialogWidRadios *syncPrefsGroup =
addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
topFrame);
syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
syncPrefsGroup->addRadio(i18n("Force take local entry always"));
syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Show summary after syncing"),
&(KOPrefs::instance()->mShowSyncSummary),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupSyncTab()
{
#if 0
QLabel * lab;
QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
int iii = 0;
topLayout->addMultiCellWidget(lab , iii,iii,0,1);
++iii;
mRemoteIPEdit = new QLineEdit(topFrame);
lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteIPEdit,iii,1);
++iii;
mRemoteUser = new QLineEdit(topFrame);
lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteUser, iii,1);
++iii;
mRemoteFile = new QLineEdit(topFrame);
lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteFile,iii,1);
++iii;
mLocalTempFile = new QLineEdit(topFrame);
lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mLocalTempFile,iii,1);
++iii;
KPrefsDialogWidBool *wb =
addWidBool(i18n("Write back synced file"),
&(KOPrefs::instance()->mWriteBackFile),topFrame);
topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
++iii;
wb =
addWidBool(i18n("Write back existing entries only"),
&(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupMainTab()
@@ -1365,301 +1367,305 @@ void KOPrefsDialog::setupGroupSchedulingTab()
mAMails->addColumn(i18n("Email"),300);
topLayout->addMultiCellWidget(mAMails,3,3,0,1);
topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
aEmailsEdit = new QLineEdit(topFrame);
aEmailsEdit->setEnabled(false);
topLayout->addWidget(aEmailsEdit,4,1);
QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
topLayout->addWidget(add,5,0);
QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
topLayout->addWidget(del,5,1);
//topLayout->setRowStretch(2,1);
connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
#endif
}
void KOPrefsDialog::setupGroupAutomationTab()
{
return;
QFrame *topFrame = addPage(i18n("Group Automation"),0,
DesktopIcon("personal",KIcon::SizeMedium));
QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
KPrefsDialogWidRadios *autoRefreshGroup =
addWidRadios(i18n("Auto Send Refresh"),
&(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
autoRefreshGroup->addRadio(i18n("Never"));
autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
//autoRefreshGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
KPrefsDialogWidRadios *autoInsertGroup =
addWidRadios(i18n("Auto Insert IMIP Replies"),
&(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
autoInsertGroup->addRadio(i18n("Never"));
autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
KPrefsDialogWidRadios *autoRequestGroup =
addWidRadios(i18n("Auto Insert IMIP Requests"),
&(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
autoRequestGroup->addRadio(i18n("Never"));
autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
KPrefsDialogWidRadios *autoFreeBusyGroup =
addWidRadios(i18n("Auto Send FreeBusy Information"),
&(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
autoFreeBusyGroup->addRadio(i18n("Never"));
autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
//autoFreeBusyGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
addWidRadios(i18n("Auto Save FreeBusy Replies"),
&(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
autoFreeBusyReplyGroup->addRadio(i18n("Never"));
autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
//autoFreeBusyGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
}
void KOPrefsDialog::showPrinterTab()
{
showPage(pageIndex(mPrinterTab));
}
void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
const QStringList *tags)
{
if (tags) {
int i = tags->findIndex(text);
if (i > 0) combo->setCurrentItem(i);
} else {
for(int i=0;i<combo->count();++i) {
if (combo->text(i) == text) {
combo->setCurrentItem(i);
break;
}
}
}
}
void KOPrefsDialog::usrReadConfig()
{
+ if ( kdelibcfg )
kdelibcfg->readConfig();
+ else {
mNameEdit->setText(KOPrefs::instance()->fullName());
mEmailEdit->setText(KOPrefs::instance()->email());
mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
// QDate current ( 2001, 1,1);
//mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
//mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
//setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
//mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
// if (KOPrefs::instance()->mAllDaySize > 47 )
// KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
//mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
// mAMails->clear();
// for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
// QListViewItem *item = new QListViewItem(mAMails);
// item->setText(0,*it);
// mAMails->insertItem(item);
// }
// mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
//mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
//mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
//mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
//that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
//QString dummy = KOPrefs::instance()->mUserDateFormatLong;
//mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
//dummy = KOPrefs::instance()->mUserDateFormatShort;
//mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
updateCategories();
mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
}
+}
void KOPrefsDialog::usrWriteConfig()
{
-
+ if ( kdelibcfg )
kdelibcfg->writeConfig();
+ else {
// KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
//KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
//KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
//KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
//KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
//KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
//KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
KOPrefs::instance()->setFullName(mNameEdit->text());
KOPrefs::instance()->setEmail(mEmailEdit->text());
KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
// KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
//QDate date;
//date = mStartDateSavingEdit->date();
//int sub = 0;
//if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
// sub = 1;
// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
// date = mEndDateSavingEdit->date();
// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
// sub = 1;
// else
// sub = 0;
// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
//KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
QDictIterator<QColor> it(mCategoryDict);
while (it.current()) {
KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
++it;
}
KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
KOPrefs::instance()->mAdditionalMails.clear();
// QListViewItem *item;
// item = mAMails->firstChild();
// while (item)
// {
// KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
// item = item->nextSibling();
// }
KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
-
+ }
}
void KOPrefsDialog::updateCategories()
{
mCategoryCombo->clear();
mCategoryDict.clear();
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
updateCategoryColor();
}
void KOPrefsDialog::warningGroupScheduling()
{
warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
}
void KOPrefsDialog::warningProjectView()
{
warningExperimental(mEnableProjectView->checkBox()->isChecked());
}
void KOPrefsDialog::warningExperimental(bool on)
{
if (on) {
KMessageBox::information(this,i18n("This is an experimental feature. "
"It may not work, it may do nothing useful and it may cause data loss. "
"Use with care.\n"
"You have to restart KOrganizer for this setting to take effect."));
} else {
KMessageBox::information(this,
i18n("You have to restart KOrganizer for this setting to take effect."));
}
}
void KOPrefsDialog::toggleEmailSettings(bool on)
{
if (on) {
mEmailEdit->setEnabled(false);
mNameEdit->setEnabled(false);
mEmailLabel->setEnabled(false);
mNameLabel->setEnabled(false);
KEMailSettings settings;
mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
} else {
mEmailEdit->setEnabled(true);
mNameEdit->setEnabled(true);
mEmailLabel->setEnabled(true);
mNameLabel->setEnabled(true);
}
}
void KOPrefsDialog::addItem()
{
// aEmailsEdit->setEnabled(true);
// QListViewItem *item = new QListViewItem(mAMails);
// mAMails->insertItem(item);
// mAMails->setSelected(item,true);
// aEmailsEdit->setText(i18n("(EmptyEmail)"));
}
void KOPrefsDialog::removeItem()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// mAMails->takeItem(item);
// item = mAMails->selectedItem();
// if (!item) {
// aEmailsEdit->setText("");
// aEmailsEdit->setEnabled(false);
// }
// if (mAMails->childCount() == 0) {
// aEmailsEdit->setEnabled(false);
// }
}
void KOPrefsDialog::updateItem()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// item->setText(0,aEmailsEdit->text());
}
void KOPrefsDialog::updateInput()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// aEmailsEdit->setEnabled(true);
// aEmailsEdit->setText(item->text(0));
}
void KOPrefsDialog::updateTimezoneOffset( int index )
{
/*
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 25e76ee..2c04852 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -631,196 +631,201 @@ void MainWindow::initActions()
}
} else {
pathString += "iconsmini/";
pixWid = 18; pixHei = 16;
}
if ( KOPrefs::instance()->mShowFullMenu ) {
QMenuBar *menuBar1;
menuBar1 = menuBar();
menuBar1->insertItem( i18n("File"), importMenu );
menuBar1->insertItem( i18n("View"), viewMenu );
menuBar1->insertItem( i18n("Actions"), actionMenu );
#ifdef DESKTOP_VERSION
menuBar1->insertItem( i18n("Synchronize"), syncMenu );
menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
#else
menuBar1->insertItem( i18n("Sync"), syncMenu );
menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
#endif
//menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
menuBar1->insertItem( i18n("Help"), helpMenu );
} else {
QPEMenuBar *menuBar1;
menuBar1 = new QPEMenuBar( iconToolBar );
QPopupMenu *menuBar = new QPopupMenu( this );
icon = loadPixmap( pathString + "z_menu" );
menuBar1->insertItem( icon.pixmap(), menuBar);
//menuBar1->insertItem( i18n("ME"), menuBar);
menuBar->insertItem( i18n("File"), importMenu );
menuBar->insertItem( i18n("View"), viewMenu );
menuBar->insertItem( i18n("Actions"), actionMenu );
menuBar->insertItem( i18n("Synchronize"), syncMenu );
menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar->insertItem( i18n("Filter"),selectFilterMenu );
menuBar->insertItem( i18n("Help"), helpMenu );
//menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
menuBar1->setMaximumSize( menuBar1->sizeHint( ));
}
connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
mWeekBgColor = iconToolBar->backgroundColor();
mWeekPixmap.resize( pixWid , pixHei );
mWeekPixmap.fill( mWeekBgColor );
icon = mWeekPixmap;
mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
if ( p-> mShowIconWeekNum )
mWeekAction->addTo( iconToolBar );
mWeekFont = font();
int fontPoint = mWeekFont.pointSize();
QFontMetrics f( mWeekFont );
int fontWid = f.width( "30" );
while ( fontWid > pixWid ) {
--fontPoint;
mWeekFont.setPointSize( fontPoint );
QFontMetrics f( mWeekFont );
fontWid = f.width( "30" );
//qDebug("dec-- ");
}
connect( mWeekAction, SIGNAL( activated() ),
this, SLOT( weekAction() ) );
connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
if ( p->mShowIconFilterview ) {
icon = loadPixmap( pathString + "filter" );
actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
connect( actionFilterMenuTB, SIGNAL( activated() ),
this, SLOT( fillFilterMenuTB() ) );
actionFilterMenuTB->addTo( iconToolBar );
selectFilterMenuTB = new QPopupMenu( this );
selectFilterMenuTB->setCheckable( true );
connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
}
//#endif
// ******************
QAction *action;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
configureToolBarMenu->setCheckable( true );
configureAgendaMenu->setCheckable( true );
int iii ;
for ( iii = 1;iii<= 10 ;++iii ){
configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
}
//configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
connect( configureAgendaMenu, SIGNAL( aboutToShow()),
this, SLOT( showConfigureAgenda( ) ) );
icon = loadPixmap( pathString + "configure" );
- action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
+ action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( edit_options() ) );
+ icon = loadPixmap( pathString + "configure" );
+ action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
+ action->addTo( actionMenu );
+ connect( action, SIGNAL( activated() ),
+ mView, SLOT( edit_global_options() ) );
actionMenu->insertSeparator();
action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( undo_delete() ) );
actionMenu->insertSeparator();
icon = loadPixmap( pathString + "newevent" );
configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(i18n("Week Number"), 400);
configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
ne_action->addTo( actionMenu );
connect( ne_action, SIGNAL( activated() ),
mView, SLOT( newEvent() ) );
icon = loadPixmap( pathString + "newtodo" );
configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
nt_action->addTo( actionMenu );
connect( nt_action, SIGNAL( activated() ),
mView, SLOT( newTodo() ) );
icon = loadPixmap( pathString + "today" );
QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
today_action->addTo( viewMenu );
connect( today_action, SIGNAL( activated() ),
mView, SLOT( goToday() ) );
viewMenu->insertSeparator();
// ***********************
if ( KOPrefs::instance()->mVerticalScreen ) {
icon = SmallIcon( "1updownarrow" );
} else {
icon = SmallIcon("1leftrightarrow" );
}
configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
FSaction->addTo( viewMenu );
connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
icon = loadPixmap( pathString + "navi" );
configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleDateNavigatorWidget() ) );
mToggleNav = action ;
icon = loadPixmap( pathString + "filter" );
configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleFilter() ) );
mToggleFilter = action;
icon = loadPixmap( pathString + "allday" );
configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleAllDaySize() ) );
mToggleAllday = action;
connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
mToggleNav, SLOT( setEnabled ( bool ) ) );
connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
mToggleFilter, SLOT( setEnabled ( bool ) ) );
connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
mToggleAllday, SLOT( setEnabled ( bool ) ) );
// connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
// configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
viewMenu->insertSeparator();
icon = loadPixmap( pathString + "picker" );
action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( showDatePicker() ) );
action->addTo( iconToolBar );
viewMenu->insertSeparator();
if ( p-> mShowIconToggleFull )
FSaction->addTo( iconToolBar );
if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
//********************
if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
icon = loadPixmap( pathString + "whatsnext" );
configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );