summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-04-10 12:45:59 (UTC)
committer skyhusker <skyhusker>2005-04-10 12:45:59 (UTC)
commit7a49d0610ae9bc1cadacf9d572c671009cb3c088 (patch) (side-by-side diff)
tree31d98c05af90dc9a3dce9eb01a5af51778ec64fc
parent713db174943e9184bfa68fa430123c52ad3c3b2b (diff)
downloadopie-7a49d0610ae9bc1cadacf9d572c671009cb3c088.zip
opie-7a49d0610ae9bc1cadacf9d572c671009cb3c088.tar.gz
opie-7a49d0610ae9bc1cadacf9d572c671009cb3c088.tar.bz2
Added configuration option for max characters displayed in notes. Fixes bug 1635
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h1
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfigbase.ui55
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h2
5 files changed, 54 insertions, 11 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index 5fd5221..6b7c3ce 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -27,47 +27,51 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
QVBoxLayout *layout = new QVBoxLayout( this );
m_gui = new DatebookPluginConfigBase( this );
layout->addWidget( m_gui );
readConfig();
}
void DatebookPluginConfig::readConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
m_gui->SpinBox1->setValue( m_max_lines_meet );
m_show_location = cfg.readNumEntry( "showlocation", 1 );
m_gui->CheckBox1->setChecked( m_show_location );
m_show_notes = cfg.readNumEntry( "shownotes", 0 );
m_gui->CheckBox2->setChecked( m_show_notes );
m_only_later = cfg.readNumEntry( "onlylater", 1 );
m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) );
m_gui->CheckBox3->setChecked( m_only_later );
m_more_days = cfg.readNumEntry( "moredays", 0 );
m_gui->SpinBox2->setValue( m_more_days );
+ m_maxCharClip = cfg.readNumEntry( "maxcharclip" , 38 );
+ m_gui->SpinBox3->setValue( m_maxCharClip );
}
void DatebookPluginConfig::writeConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = m_gui->SpinBox1->value();
cfg.writeEntry( "maxlinesmeet", m_max_lines_meet);
m_show_location = m_gui->CheckBox1->isChecked();
cfg.writeEntry( "showlocation", m_show_location);
m_show_notes = m_gui->CheckBox2->isChecked();
cfg.writeEntry( "shownotes", m_show_notes );
m_only_later = m_gui->CheckBox3->isChecked();
cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() );
cfg.writeEntry( "onlylater", m_only_later );
m_more_days = m_gui->SpinBox2->value();
cfg.writeEntry( "moredays", m_more_days );
+ m_maxCharClip = m_gui->SpinBox3->value();
+ cfg.writeEntry( "maxcharclip", m_maxCharClip );
cfg.write();
}
DatebookPluginConfig::~DatebookPluginConfig() {
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index 4f4e3f1..61e31e0 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -35,29 +35,30 @@ class DatebookPluginConfig : public TodayConfigWidget {
public:
DatebookPluginConfig( QWidget *parent, const char *name );
~DatebookPluginConfig();
void writeConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
DatebookPluginConfigBase *m_gui;
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
int m_show_location;
// if notes should be shown
int m_show_notes;
// should only later appointments be shown or all for the current day.
int m_only_later;
int m_more_days;
+ int m_maxCharClip;
};
#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui b/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui
index 943e8ec..004204a 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui
+++ b/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui
@@ -1,115 +1,115 @@
<!DOCTYPE UI><UI>
<class>DatebookPluginConfigBase</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>DatebookPluginConfigBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>228</width>
+ <width>224</width>
<height>267</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>DatebookPluginConfigBase</string>
</property>
<property>
<name>whatsThis</name>
<string></string>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget>
+ <widget row="0" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBox1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Show location</string>
</property>
<property>
<name>whatsThis</name>
<string>Check this if the location of an appointment should be shown for each one</string>
</property>
</widget>
- <widget>
+ <widget row="1" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBox2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Show notes</string>
</property>
<property>
<name>whatsThis</name>
<string>Check this if the note attached to an appointment should be shown for each one</string>
</property>
</widget>
- <widget>
+ <widget row="2" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBox3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Show only later appointments</string>
</property>
<property>
<name>whatsThis</name>
<string>Check this if only appointments later then current time should be shown</string>
</property>
</widget>
- <widget>
+ <widget row="3" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBox4</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Show time in extra line</string>
</property>
</widget>
- <widget>
+ <widget row="4" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</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>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>SpinBox1</cstring>
</property>
<property stdset="1">
<name>maxValue</name>
<number>10</number>
</property>
@@ -117,49 +117,49 @@
<name>whatsThis</name>
<string>How many appointments should be shown maximal. In chronical order</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>How many appointment should be shown?</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>WordBreak|AlignVCenter|AlignLeft</set>
</property>
<property>
<name>wordwrap</name>
</property>
</widget>
</hbox>
</widget>
- <widget>
+ <widget row="5" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</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>QSpinBox</class>
<property stdset="1">
<name>name</name>
<cstring>SpinBox2</cstring>
</property>
<property stdset="1">
<name>specialValueText</name>
<string>only today</string>
</property>
@@ -171,48 +171,83 @@
<name>whatsThis</name>
<string>How many more days should be in the range</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>How many more days</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>WordBreak|AlignVCenter|AlignLeft</set>
</property>
<property>
<name>wordwrap</name>
</property>
</widget>
</hbox>
</widget>
- <spacer>
+ <widget row="6" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6</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>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>SpinBox3</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Clip line after X chars</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="7" column="0" >
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- </vbox>
+ </grid>
</widget>
</UI>
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 0820802..eb6d47a 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -33,91 +33,92 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
m_layoutDates = new QVBoxLayout( this );
m_layoutDates->setAutoAdd( true );
m_eventsList.setAutoDelete( true );
readConfig();
getDates();
}
DatebookPluginWidget::~DatebookPluginWidget() {
delete db;
delete m_layoutDates;
}
void DatebookPluginWidget::readConfig() {
Config cfg( "todaydatebookplugin" );
cfg.setGroup( "config" );
m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
m_show_location = cfg.readNumEntry( "showlocation", 1 );
m_show_notes = cfg.readNumEntry( "shownotes", 0 );
m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
m_moreDays = cfg.readNumEntry( "moredays", 0 );
m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
+ m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
}
void DatebookPluginWidget::reinitialize() {
readConfig();
refresh();
}
void DatebookPluginWidget::refresh() {
m_eventsList.clear();
if ( m_layoutDates ) {
delete m_layoutDates;
}
m_layoutDates = new QVBoxLayout( this );
m_layoutDates->setAutoAdd( true );
getDates();
}
/**
* Get all events that are in the datebook xml file for today
*/
void DatebookPluginWidget::getDates() {
if ( db ) {
delete db;
}
db = new DateBookDB;
QDate date = QDate::currentDate();
QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
qBubbleSort( list );
int count = 0;
if ( list.count() > 0 ) {
for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
if ( count < m_max_lines_meet ) {
if ( !m_onlyLater ) {
count++;
- DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
+ DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip );
m_eventsList.append( l );
l->show();
QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
} else {
if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
// Show events which span over many days and are not elapsed.
|| ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
// Show repeated event for today that is not elapsed.
|| ( ( (*it).event().repeatType() != Event::NoRepeat )
&& ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
&& ( QTime::currentTime() < (*it).event().start().time() ) ) )
// Show repeated event for next days.
|| ( ( (*it).event().repeatType() != Event::NoRepeat )
&& ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
)
{
count++;
// show only later appointments
DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
m_eventsList.append( l );
l->show();
QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) );
}
}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
index f8ed89e..65e060e 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.h
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -36,27 +36,29 @@ public:
DatebookPluginWidget( QWidget *parent, const char *name );
~DatebookPluginWidget();
void refresh();
void reinitialize();
private:
DateBookDB* db;
QGuardedPtr<QVBoxLayout> m_layoutDates;
QList<QWidget> m_eventsList;
void readConfig();
void getDates();
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
bool m_show_location;
// if notes should be shown
bool m_show_notes;
// should only later appointments be shown or all for the current day.
bool m_onlyLater;
int m_moreDays;
// true if time of an appointment should be an extra line
bool m_timeExtraLine;
+ //max characters displayed in notes
+ int m_maxCharClip;
};
#endif