summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp46
-rw-r--r--core/pim/datebook/datebook.h2
-rw-r--r--core/pim/datebook/datebooksettings.cpp5
-rw-r--r--core/pim/datebook/datebooksettings.h1
-rw-r--r--core/pim/datebook/datebooksettingsbase.ui165
5 files changed, 199 insertions, 20 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 6dd8918..cf1eeca 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -233,37 +233,53 @@ DateBook::~DateBook()
}
void DateBook::slotSettings()
{
DateBookSettings frmSettings( ampm, this );
frmSettings.setStartTime( startTime );
frmSettings.setAlarmPreset( aPreset, presetTime );
frmSettings.setJumpToCurTime( bJumpToCurTime );
frmSettings.setRowStyle( rowStyle );
frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
+ bool found=false;
+ for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
+ if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
+ frmSettings.comboLocation->setCurrentItem(i);
+ found=true;
+ break;
+ }
+ }
+ if(!found) {
+ frmSettings.comboLocation->insertItem(defaultLocation);
+ frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
+ }
+ frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
+
#if defined (Q_WS_QWS) || defined(_WS_QWS_)
frmSettings.showMaximized();
#endif
if ( frmSettings.exec() ) {
aPreset = frmSettings.alarmPreset();
presetTime = frmSettings.presetTime();
startTime = frmSettings.startTime();
bJumpToCurTime = frmSettings.jumpToCurTime();
rowStyle = frmSettings.rowStyle();
defaultView=frmSettings.comboDefaultView->currentItem()+1;
weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
+ defaultLocation=frmSettings.comboLocation->currentText();
+ defaultCategories=frmSettings.comboCategory->currentCategories();
if ( dayView ) {
dayView->setStartViewTime( startTime );
dayView->setJumpToCurTime( bJumpToCurTime );
dayView->setRowStyle( rowStyle );
}
if ( weekView ) {
weekView->setStartViewTime( startTime );
}
saveSettings();
// make the change obvious
@@ -376,26 +392,28 @@ void DateBook::viewWeek() {
}
void DateBook::viewWeekLst() {
view(WEEKLST,currentDate());
}
void DateBook::viewMonth() {
view(MONTH,currentDate());
}
void DateBook::insertEvent( const Event &e )
{
- qWarning("Adding Event!");
- db->addEvent(e);
+ Event dupEvent=e;
+ dupEvent.setLocation(defaultLocation);
+ dupEvent.setCategories(defaultCategories);
+ db->addEvent(dupEvent);
emit newEvent();
}
void DateBook::duplicateEvent( const Event &e )
{
qWarning("Hmmm...");
// Alot of code duplication, as this is almost like editEvent();
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
return;
}
@@ -597,38 +615,54 @@ void DateBook::loadSettings()
ampm = qpeconfig.readBoolEntry( "AMPM", TRUE );
onMonday = qpeconfig.readBoolEntry( "MONDAY" );
Config config("DateBook");
config.setGroup("Main");
startTime = config.readNumEntry("startviewtime", 8);
aPreset = config.readBoolEntry("alarmpreset");
presetTime = config.readNumEntry("presettime");
bJumpToCurTime = config.readBoolEntry("jumptocurtime");
rowStyle = config.readNumEntry("rowstyle");
defaultView = config.readNumEntry("defaultview",DAY);
weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL);
+
+ defaultLocation=config.readEntry("defaultLocation");
+ QString tmpString=config.readEntry("defaultCategories");
+ QStringList tmpStringList=QStringList::split(",",tmpString);
+ defaultCategories.truncate(0);
+ for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) {
+ defaultCategories.resize(defaultCategories.count()+1);
+ defaultCategories[defaultCategories.count()-1]=(*i).toInt();
+ }
}
void DateBook::saveSettings()
{
Config config( "qpe" );
Config configDB( "DateBook" );
configDB.setGroup( "Main" );
configDB.writeEntry("startviewtime",startTime);
configDB.writeEntry("alarmpreset",aPreset);
configDB.writeEntry("presettime",presetTime);
configDB.writeEntry("jumptocurtime", bJumpToCurTime);
configDB.writeEntry("rowstyle", rowStyle);
configDB.writeEntry("defaultview",defaultView);
configDB.writeEntry("weeklistviewconfig",weeklistviewconfig);
+
+ configDB.writeEntry("defaultLocation",defaultLocation);
+ QStringList tmpStringList;
+ for( uint i=0; i<defaultCategories.count(); i++) {
+ tmpStringList << QString::number(defaultCategories[i]);
+ }
+ configDB.writeEntry("defaultCategories",tmpStringList.join(","));
}
void DateBook::appMessage(const QCString& msg, const QByteArray& data)
{
bool needShow = FALSE;
if ( msg == "alarm(QDateTime,int)" ) {
QDataStream ds(data,IO_ReadOnly);
QDateTime when; int warn;
ds >> when >> warn;
// check to make it's okay to continue,
// this is the case that the time was set ahead, and
@@ -832,44 +866,48 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
DateEntry *e;
QVBoxLayout *vb = new QVBoxLayout( &newDlg );
QScrollView *sv = new QScrollView( &newDlg );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
Event ev;
ev.setDescription( str );
// When the new gui comes in, change this...
if(location==0) {
+ if(defaultLocation.isEmpty()) {
ev.setLocation( tr("(Unknown)") );
} else {
+ ev.setLocation( defaultLocation );
+ }
+ } else {
ev.setLocation(location);
}
+ ev.setCategories(defaultCategories);
ev.setStart( start );
ev.setEnd( end );
e = new DateEntry( onMonday, ev, ampm, &newDlg );
e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
sv->addChild( e );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
newDlg.showMaximized();
#endif
while (newDlg.exec()) {
ev = e->event();
ev.assignUid();
QString error = checkEvent( ev );
if ( !error.isNull() ) {
- if ( QMessageBox::warning( this, tr("Error!"),
- error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
+ if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
continue;
}
db->addEvent( ev );
emit newEvent();
break;
}
}
void DateBook::setDocument( const QString &filename )
{
if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index 3f57d4a..eeb8666 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -112,24 +112,26 @@ private:
QWidgetStack *views;
DateBookDay *dayView;
DateBookWeek *weekView;
DateBookMonth *monthView;
DateBookWeekLst *weekLstView;
QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
int weeklistviewconfig;
bool aPreset; // have everything set to alarm?
int presetTime; // the standard time for the alarm
int startTime;
int rowStyle;
int defaultView;
+ QArray<int> defaultCategories;
+ QString defaultLocation;
bool bJumpToCurTime; //should jump to current time in dayview?
bool ampm;
bool onMonday;
bool syncing;
bool inSearch;
int alarmCounter;
QString checkEvent(const Event &);
};
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp
index 49fcd17..675b17f 100644
--- a/core/pim/datebook/datebooksettings.cpp
+++ b/core/pim/datebook/datebooksettings.cpp
@@ -23,26 +23,27 @@
#include <qpe/qpeapplication.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qcombobox.h>
DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent,
const char *name, bool modal, WFlags fl )
: DateBookSettingsBase( parent, name, modal, fl ),
ampm( whichClock )
{
init();
- QObject::connect( qApp, SIGNAL( clockChanged( bool ) ),
- this, SLOT( slotChangeClock( bool ) ) );
+ QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( slotChangeClock( bool ) ) );
+ QArray<int> categories;
+ comboCategory->setCategories( categories, "Calendar", tr("Calendar") );
}
DateBookSettings::~DateBookSettings()
{
}
void DateBookSettings::setStartTime( int newStartViewTime )
{
if ( ampm ) {
if ( newStartViewTime >= 12 ) {
newStartViewTime %= 12;
if ( newStartViewTime == 0 )
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h
index 90a07f9..c3036e1 100644
--- a/core/pim/datebook/datebooksettings.h
+++ b/core/pim/datebook/datebooksettings.h
@@ -12,24 +12,25 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef DATEBOOKSETTINGS_H
#define DATEBOOKSETTINGS_H
#include "datebooksettingsbase.h"
+#include <qpe/categoryselect.h>
class DateBookSettings : public DateBookSettingsBase
{
public:
DateBookSettings( bool whichClock, QWidget *parent = 0,
const char *name = 0, bool modal = TRUE, WFlags = 0 );
~DateBookSettings();
void setStartTime( int newStartViewTime );
int startTime() const;
void setAlarmPreset( bool bAlarm, int presetTime );
bool alarmPreset() const;
int presetTime() const;
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui
index 3836330..e613db1 100644
--- a/core/pim/datebook/datebooksettingsbase.ui
+++ b/core/pim/datebook/datebooksettingsbase.ui
@@ -24,25 +24,25 @@
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>DateBookSettingsBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>273</width>
- <height>303</height>
+ <height>340</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Preferences</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
@@ -521,50 +521,187 @@
<name>wrapping</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>maxValue</name>
<number>23</number>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
- <spacer>
- <property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer9</cstring>
+ <cstring>GroupBox5_2_2</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
+ <name>title</name>
+ <string>Defaults</string>
</property>
+ <vbox>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
+ <name>margin</name>
+ <number>11</number>
</property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6_2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Location:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <item>
<property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <name>text</name>
+ <string></string>
</property>
- </spacer>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Office</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Home</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboLocation</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7_2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_2_2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Category:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>CategorySelect</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboCategory</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
</vbox>
</widget>
</widget>
</vbox>
</widget>
+<customwidgets>
+ <customwidget>
+ <class>CategorySelect</class>
+ <header location="global">qpe/categoryselect.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>7</hordata>
+ <verdata>1</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
<connections>
<connection>
<sender>chkAlarmPreset</sender>
<signal>toggled(bool)</signal>
<receiver>spinPreset</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>spinStart</sender>
<signal>valueChanged(int)</signal>
<receiver>DateBookSettingsBase</receiver>
<slot>slot12Hour( int )</slot>