summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp12
-rw-r--r--korganizer/koeventviewer.h1
-rw-r--r--korganizer/koeventviewerdialog.cpp26
-rw-r--r--korganizer/searchdialog.cpp2
4 files changed, 30 insertions, 11 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 417d89c..44da058 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -648,48 +648,60 @@ void KOEventViewer::setTodo(Todo *event, bool clearV )
if ( clearV )
appendTodo(event,1 );
else
appendTodo(event,2);
} else
appendTodo(event);
}
void KOEventViewer::setJournal(Journal *event, bool clearV )
{
if ( clearV )
clearEvents();
if ( mSyncMode ) {
if ( clearV )
appendJournal(event, 1);
else
appendJournal(event, 2);
} else
appendJournal(event);
}
void KOEventViewer::setEvent(Event *event)
{
clearEvents();
if ( mSyncMode )
appendEvent(event, 1);
else
appendEvent(event);
}
void KOEventViewer::addEvent(Event *event)
{
if ( mSyncMode )
appendEvent(event, 2);
else
appendEvent(event);
}
void KOEventViewer::clearEvents(bool now)
{
mText = "";
if (now) setText(mText);
}
void KOEventViewer::addText(QString text)
{
mText.append(text);
setText(mText);
}
+void KOEventViewer::keyPressEvent ( QKeyEvent * e )
+{
+ switch ( e->key() ) {
+ case Qt::Key_Return:
+ case Qt::Key_Enter :
+ e->ignore();
+ break;
+ default:
+ QTextBrowser::keyPressEvent ( e );
+ break;
+ }
+}
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index cf44284..d8142ca 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -15,61 +15,62 @@
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.
*/
#ifndef KOEVENTVIEWER_H
#define KOEVENTVIEWER_H
//
// Viewer widget for events.
//
#include <qtextbrowser.h>
#include <libkcal/event.h>
#include <libkcal/journal.h>
using namespace KCal;
class KOEventViewer : public QTextBrowser {
Q_OBJECT
public:
KOEventViewer(QWidget *parent=0,const char *name=0);
virtual ~KOEventViewer();
void setSource(const QString &);
void setEvent(Event *event);
void addEvent(Event *event);
void setTodo(Todo *event, bool clearV = true );
void setJournal(Journal *jour, bool clearV = true );
void appendEvent(Event *event, int mode = 0 );
void appendTodo(Todo *event, int mode = 0 );
void appendJournal(Journal *jour, int mode = 0 );
void clearEvents(bool now=false);
void addText(QString text);
void setSyncMode( bool );
void setColorMode( int );
void mailToAttendees( bool all );
protected:
int mColorMode;
void addTag(const QString & tag,const QString & text);
void formatCategories(Incidence *event);
void formatAttendees(Incidence *event);
void formatReadOnly(Incidence *event);
+ void keyPressEvent ( QKeyEvent * e );
private:
QTextBrowser *mEventTextView;
bool mSyncMode;
QString mText;
QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
void launchaddressbook(QString uid);
};
#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index f6f7258..23e62d3 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -32,229 +32,235 @@ extern int globalFlagBlockAgenda;
KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
: KDialogBase(parent,name,
#ifndef DESKTOP_VERSION
true ,
#else
false,
#endif
i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
{
mEventViewer = new KOEventViewer(this);
mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
setMainWidget(mEventViewer);
setButtonText(Ok, i18n("Edit") );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),
SLOT(editIncidence()));
QObject::connect(this,SIGNAL(user1Clicked()),
SLOT(showIncidence()));
mIncidence = 0;
// TODO: Set a sensible size (based on the content?).
//showMaximized();
//qDebug("++++++++++++KOEventViewerDialog() ");
// if ( KOPrefs::instance()->mCompactDialogs ) {
// setFixedSize( 240,284 );
// move( 0, 15 );
// } else {
// setMinimumSize(300,200);
// resize(320,300);
// }
mSyncMode = false;
mSyncResult = 0;
}
KOEventViewerDialog::~KOEventViewerDialog()
{
//qDebug("-------~KOEventViewerDialog() ");
}
void KOEventViewerDialog::showMe()
{
#ifdef DESKTOP_VERSION
show();
#else
showMaximized();
#endif
- setFocus();
setActiveWindow();
+ mEventViewer->setFocus();
}
void KOEventViewerDialog::setSyncMode( bool b )
{
mSyncMode = b;
//qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
if ( mSyncMode ) {
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
} else {
findButton( Close )->setText( i18n("Close"));
findButton( Ok )->setText( i18n("Edit"));
findButton( User1 )->setText( i18n("Agenda"));
}
mEventViewer->setSyncMode( b );
}
void KOEventViewerDialog::setColorMode( int m )
{
mEventViewer->setColorMode( m );
}
int KOEventViewerDialog::executeS( bool local )
{
mSyncResult = 3;
if ( local )
findButton( User1 )->setFocus();
else
findButton( Ok )->setFocus();
exec();
return mSyncResult;
}
void KOEventViewerDialog::updateConfig()
{
mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
}
void KOEventViewerDialog::setEvent(Event *event)
{
mEventViewer->setEvent(event);
- mIncidence = event;
- findButton( Close )->setFocus();
+ mIncidence = event;
+ mEventViewer->setFocus();
+ //findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Agenda"));
}
}
void KOEventViewerDialog::setIncidence(Incidence *in )
{
if ( in->type() == "Event" )
setEvent( (Event*) in );
else if ( in->type() =="Todo" )
setTodo( (Todo*) in );
else if ( in->type() =="Journal" )
setJournal( (Journal*) in );
}
void KOEventViewerDialog::addIncidence(Incidence *in)
{
if ( in->type() == "Event" )
addEvent( (Event*) in );
else if ( in->type() =="Todo" )
mEventViewer->setTodo( (Todo*) in, false );
else if ( in->type() =="Journal" )
mEventViewer->setJournal( (Journal*) in, false );
if ( mSyncMode ) {
findButton( User1 )->setFocus();
setCaption(i18n("Conflict! Please choose entry"));
}
}
void KOEventViewerDialog::addEvent(Event *event)
{
mEventViewer->addEvent(event);
mIncidence = event;
- findButton( Close )->setFocus();
+ mEventViewer->setFocus();
+ //findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Agenda"));
}
}
void KOEventViewerDialog::setTodo(Todo *event)
{
mEventViewer->setTodo(event);
- mIncidence = (Incidence*)event;
- findButton( Close )->setFocus();
+ mIncidence = (Incidence*)event;
+ mEventViewer->setFocus();
+ //findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Set complete"));
}
}
void KOEventViewerDialog::setJournal(Journal *j)
{
mEventViewer->setJournal(j);
- mIncidence = (Incidence*)j;
- findButton( Close )->setFocus();
+ mIncidence = (Incidence*)j;
+ mEventViewer->setFocus();
+ //findButton( Close )->setFocus();
if ( !mSyncMode ) {
findButton( User1 )->setText( i18n("Agenda"));
}
}
void KOEventViewerDialog::addText(QString text)
{
- mEventViewer->addText(text);
- findButton( Close )->setFocus();
+ mEventViewer->addText(text);
+ mEventViewer->setFocus();
+ //findButton( Close )->setFocus();
}
void KOEventViewerDialog::editIncidence()
{
if ( mSyncMode ) {
mSyncResult = 2;
accept();
return;
}
if ( mIncidence ){
#ifndef DESKTOP_VERSION
hide();
#endif
emit editIncidence( mIncidence );
}
}
void KOEventViewerDialog::showIncidence()
{
if ( mSyncMode ) {
mSyncResult = 1;
accept();
return;
}
if ( mIncidence ){
#ifndef DESKTOP_VERSION
hide();
#endif
QDate date;
if ( mIncidence->type() == "Todo" ) {
/*
if ( ((Todo*)mIncidence)->hasDueDate() )
date = ((Todo*)mIncidence)->dtDue().date();
else {
globalFlagBlockAgenda = 2;
emit showAgendaView( false );
return;
}
*/
((Todo*)mIncidence)->setCompleted( true );
((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
hide();
emit todoCompleted(((Todo*)mIncidence));
return;
} else
date = mIncidence->dtStart().date();
globalFlagBlockAgenda = 1;
emit showAgendaView( false );
globalFlagBlockAgenda = 2;
emit jumpToTime( date );
}
}
void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_A :
case Qt::Key_L :
showIncidence();
break;
case Qt::Key_E :
case Qt::Key_R :
editIncidence();
break;
case Qt::Key_C:
case Qt::Key_Escape:
close();
break;
case Qt::Key_I:
accept();
break;
default:
+ KDialogBase::keyPressEvent ( e );
break;
}
}
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index aa1b244..cef59a2 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -39,97 +39,97 @@
#include "koprefs.h"
#include "calendarview.h"
#include "koviewmanager.h"
#include "searchdialog.h"
SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
: QVBox( 0 )
{
mCalendar = calendar;
QFrame *topFrame = new QFrame( this ) ;//plainPage();
QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
// Search expression
QHBoxLayout *subLayout = new QHBoxLayout();
layout->addLayout(subLayout);
searchLabel = new QLabel(topFrame);
searchLabel->setText(i18n("Search for:"));
subLayout->addWidget(searchLabel);
searchEdit = new QLineEdit(topFrame);
subLayout->addWidget(searchEdit);
QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame );
//OkButton->setDefault( true );
connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
subLayout->addWidget(OkButton);
searchEdit->setText("*"); // Find all events by default
searchEdit->setFocus();
connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
// Subjects to search
// QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
// topFrame);
QHBox *incidenceGroup = new QHBox( topFrame );
layout->addWidget(incidenceGroup);
mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
mSearchEvent->setChecked(true);
mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
QHBox *subjectGroup = new QHBox( topFrame );
layout->addWidget(subjectGroup);
mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
mSummaryCheck->setChecked(true);
- mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup);
+ mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
QHBox *attendeeGroup = new QHBox( topFrame );
layout->addWidget(attendeeGroup );
new QLabel( i18n("Attendee:"),attendeeGroup );
mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
// Date range
// QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
// topFrame);
// layout->addWidget(rangeGroup);
QWidget *rangeWidget = new QWidget(topFrame);
QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
mStartDate = new KDateEdit(rangeWidget);
rangeLayout->addWidget(mStartDate);
rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
mEndDate = new KDateEdit(rangeWidget);
mEndDate->setDate(QDate::currentDate().addDays(365));
rangeLayout->addWidget(mEndDate);
QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
rangeLayout->addWidget( (QWidget*)wt );
layout->addWidget(rangeWidget);
// Results list view
listView = new KOListView(mCalendar,topFrame);
layout->addWidget(listView);
listView->readSettings(KOGlobals::config(),"SearchListView Layout");
setCaption( i18n("KO/Pi Find: "));
#ifdef DESKTOP_VERSION
OkButton = new QPushButton( i18n("Close"), this );
connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
#endif
}
SearchDialog::~SearchDialog()
{
}
void SearchDialog::accept()
{
doSearch();
}
void SearchDialog::updateList()
{
//listView->updateList();