diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /korganizer/plugins/timespanview | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/plugins/timespanview')
-rw-r--r-- | korganizer/plugins/timespanview/Makefile.am | 20 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/cr22-action-timespan.png | bin | 0 -> 976 bytes | |||
-rw-r--r-- | korganizer/plugins/timespanview/kotimespanview.cpp | 128 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/kotimespanview.h | 61 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/lineview.cpp | 118 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/lineview.h | 59 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timeline.cpp | 87 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timeline.h | 56 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanview.cpp | 80 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanview.desktop | 94 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanview.h | 42 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanviewui.rc | 15 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanwidget.cpp | 175 | ||||
-rw-r--r-- | korganizer/plugins/timespanview/timespanwidget.h | 78 |
14 files changed, 1013 insertions, 0 deletions
diff --git a/korganizer/plugins/timespanview/Makefile.am b/korganizer/plugins/timespanview/Makefile.am new file mode 100644 index 000000000..a4431c6a5 --- /dev/null +++ b/korganizer/plugins/timespanview/Makefile.am @@ -0,0 +1,20 @@ +# $Id$ + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces \ + -I$(top_srcdir) -I$(top_srcdir)/korganizer $(all_includes) + +kde_module_LTLIBRARIES = libkorg_timespanview.la + +libkorg_timespanview_la_SOURCES = lineview.cpp timeline.cpp timespanview.cpp timespanwidget.cpp kotimespanview.cpp +libkorg_timespanview_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_timespanview_la_LIBADD = $(top_builddir)/korganizer/libkorganizer.la $(LIB_KPARTS) + +noinst_HEADERS = timespanview.h timespanwidget.h kotimespanview.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = timespanview.desktop + +rcdir = $(kde_datadir)/korganizer/plugins +rc_DATA = timespanviewui.rc diff --git a/korganizer/plugins/timespanview/cr22-action-timespan.png b/korganizer/plugins/timespanview/cr22-action-timespan.png Binary files differnew file mode 100644 index 000000000..cee81a7c8 --- /dev/null +++ b/korganizer/plugins/timespanview/cr22-action-timespan.png diff --git a/korganizer/plugins/timespanview/kotimespanview.cpp b/korganizer/plugins/timespanview/kotimespanview.cpp new file mode 100644 index 000000000..507438a6a --- /dev/null +++ b/korganizer/plugins/timespanview/kotimespanview.cpp @@ -0,0 +1,128 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <kconfig.h> +#include <kstandarddirs.h> +#include <kconfig.h> +#include <libkcal/calendar.h> + +#include "timespanwidget.h" +#include "koglobals.h" + +#include "kotimespanview.h" +#include "kotimespanview.moc" + +KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, + const char *name) : + KOEventView( calendar, parent, name ) +{ + QBoxLayout *topLayout = new QVBoxLayout( this ); + + mTimeSpanWidget = new TimeSpanWidget( this ); + topLayout->addWidget( mTimeSpanWidget ); + + connect( mTimeSpanWidget, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) ); +} + +KOTimeSpanView::~KOTimeSpanView() +{ +} + +void KOTimeSpanView::readSettings() +{ + kdDebug(5850) << "KOTimeSpanView::readSettings()" << endl; + + KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals + config.setGroup("Views"); + + QValueList<int> sizes = config.readIntListEntry("Separator TimeSpanView"); + if (sizes.count() == 2) { + mTimeSpanWidget->setSplitterSizes(sizes); + } +} + +void KOTimeSpanView::writeSettings(KConfig *config) +{ +// kdDebug(5850) << "KOTimeSpanView::writeSettings()" << endl; + + config->setGroup("Views"); + + QValueList<int> list = mTimeSpanWidget->splitterSizes(); + config->writeEntry("Separator TimeSpanView",list); +} + +int KOTimeSpanView::maxDatesHint() +{ + return 0; +} + +int KOTimeSpanView::currentDateCount() +{ + return 0; +} + +Incidence::List KOTimeSpanView::selectedIncidences() +{ + Incidence::List selected; + + return selected; +} + +void KOTimeSpanView::updateView() +{ + insertItems( mTimeSpanWidget->startDateTime().date(), + mTimeSpanWidget->endDateTime().date() ); +} + +void KOTimeSpanView::showDates(const QDate &start, const QDate &end) +{ + QDate s = start.addDays( -2 ); + QDate e = end.addDays( 2 ); + + insertItems( s, e ); +} + +void KOTimeSpanView::insertItems(const QDate &start, const QDate &end) +{ + mTimeSpanWidget->clear(); + mTimeSpanWidget->setDateRange( start, end ); + + Event::List events = calendar()->events( start, end ); + Event::List::ConstIterator it; + for( it = events.begin(); it != events.end(); ++it ) { + mTimeSpanWidget->addItem( *it ); + } + + mTimeSpanWidget->updateView(); +} + +void KOTimeSpanView::showIncidences( const Incidence::List & ) +{ +} + +void KOTimeSpanView::changeIncidenceDisplay(Incidence *, int) +{ +} diff --git a/korganizer/plugins/timespanview/kotimespanview.h b/korganizer/plugins/timespanview/kotimespanview.h new file mode 100644 index 000000000..142ba75f4 --- /dev/null +++ b/korganizer/plugins/timespanview/kotimespanview.h @@ -0,0 +1,61 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 KOTIMESPANVIEW_H +#define KOTIMESPANVIEW_H + +#include "koeventview.h" + +class KConfig; +class TimeSpanWidget; + +class KOTimeSpanView : public KOEventView +{ + Q_OBJECT + public: + KOTimeSpanView( Calendar *calendar, QWidget *parent = 0, + const char *name = 0 ); + ~KOTimeSpanView(); + + virtual int maxDatesHint(); + virtual int currentDateCount(); + virtual Incidence::List selectedIncidences(); + DateList selectedDates() { return DateList(); } + + void readSettings(); + void writeSettings( KConfig * ); + + public slots: + virtual void updateView(); + virtual void showDates( const QDate &start, const QDate &end ); + virtual void showIncidences( const Incidence::List &incidenceList ); + + void changeIncidenceDisplay(Incidence *, int); + + private: + void insertItems( const QDate &start, const QDate & end ); + + TimeSpanWidget *mTimeSpanWidget; +}; + +#endif diff --git a/korganizer/plugins/timespanview/lineview.cpp b/korganizer/plugins/timespanview/lineview.cpp new file mode 100644 index 000000000..26779bdb3 --- /dev/null +++ b/korganizer/plugins/timespanview/lineview.cpp @@ -0,0 +1,118 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qpainter.h> + +#include <kdebug.h> + +#include "koprefs.h" + +#include "lineview.h" +#include "lineview.moc" + +LineView::LineView( QWidget *parent, const char *name ) : + QScrollView( parent, name ) +{ + mPixelWidth = 1000; + + mLines.setAutoDelete( true ); + + resizeContents( mPixelWidth, contentsHeight() ); + + viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); +} + +LineView::~LineView() +{ +} + +int LineView::pixelWidth() +{ + return mPixelWidth; +} + +void LineView::addLine( int start, int end ) +{ + int count = mLines.count(); + + if( start < 0 ) start = 0; + if( end > mPixelWidth) end = mPixelWidth; + + kdDebug(5850) << "LineView::addLine() col: " << count << " start: " << start + << " end: " << end << endl; + + mLines.append( new Line( count, start, end ) ); +} + +void LineView::clear() +{ + mLines.clear(); + update(); +} + +void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch) +{ +// kdDebug(5850) << "LineView::drawContents()" << endl; + +// int mGridSpacingX = 10; + int mGridSpacingY = 20; + +#if 0 + // Draw vertical lines of grid + // kdDebug(5850) << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; + int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; + while (x < cx + cw) { + p->drawLine(x,cy,x,cy+ch); + x+=mGridSpacingX; + } +#endif + + // Draw horizontal lines of grid + int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10; + while (y < cy + ch) { +// kdDebug(5850) << " y: " << y << endl; + p->drawLine(cx,y,cx+cw,y); + y+=mGridSpacingY; + } + + Line *line; + for( line = mLines.first(); line; line = mLines.next() ) { + int ctop = line->column * 20 + 10 - 5; + int cbottom = line->column * 20 + 10 + 5; + int s = line->start; + int e = line->end; +// kdDebug(5850) << " LineView::drawContents(): ctop: " << ctop << " cbottom: " +// << cbottom << " s: " << s << " e: " << e << endl; + if ( ctop <= (cy+ch) && cbottom >= cy && + s <= (cx+cw) && e >= cx ) { + if ( s < cx ) s = cx; + if ( e > (cx+cw) ) e = cx+cw; + if ( ctop < cy ) ctop = cy; + if ( cbottom > (cy+ch) ) cbottom = cy+ch; +// kdDebug(5850) << " drawContents(): ctop: " << ctop << " cbottom: " +// << cbottom << " s: " << s << " e: " << e << endl; + p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") ); + } + } +} diff --git a/korganizer/plugins/timespanview/lineview.h b/korganizer/plugins/timespanview/lineview.h new file mode 100644 index 000000000..0bb1788a7 --- /dev/null +++ b/korganizer/plugins/timespanview/lineview.h @@ -0,0 +1,59 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 LINEVIEW_H +#define LINEVIEW_H + +#include <qscrollview.h> +#include <qptrlist.h> + +class LineView : public QScrollView +{ + Q_OBJECT + public: + LineView( QWidget *parent = 0, const char *name = 0 ); + virtual ~LineView(); + + int pixelWidth(); + + void addLine( int start, int end ); + + void clear(); + + protected: + void drawContents(QPainter* p, int cx, int cy, int cw, int ch); + + private: + struct Line { + Line( int c, int s, int e ) : column( c ), start( s ), end( e ) {} + int column; + int start; + int end; + }; + + QPtrList<Line> mLines; + int mPixelWidth; +}; + +#endif + diff --git a/korganizer/plugins/timespanview/timeline.cpp b/korganizer/plugins/timespanview/timeline.cpp new file mode 100644 index 000000000..0d679e192 --- /dev/null +++ b/korganizer/plugins/timespanview/timeline.cpp @@ -0,0 +1,87 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qpainter.h> + +#include <kdebug.h> + +#include "timeline.h" +#include "timeline.moc" + +TimeLine::TimeLine( QWidget *parent, const char *name ) : + QScrollView( parent, name ) +{ + mPixelWidth = 1000; + + resizeContents( mPixelWidth, 20 ); + + viewport()->setBackgroundMode( PaletteBackground ); + + setHScrollBarMode(AlwaysOff); + setVScrollBarMode(AlwaysOff); +} + +TimeLine::~TimeLine() +{ +} + +void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch) +{ + int spacingX = mDaySpacing; + int offsetX = mDayOffset; + + // Draw vertical lines of grid +// kdDebug(5850) << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; + int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX ); + int x = cell * spacingX + ( spacingX - offsetX ); +// kdDebug(5850) << " x: " << x << endl; + while (x < cx + cw) { +// kdDebug(5850) << " x: " << x << endl; + p->drawLine(x,cy,x,cy+ch); + p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) ); + + x += spacingX; + cell++; + } +} + +void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end ) +{ + mStartDate = start; + mEndDate = end; + + mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth; + + mDaySpacing = 60 * 60 * 24 / mSecsPerPixel; + + mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel; + + kdDebug(5850) << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: " + << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl; +} + +void TimeLine::setContentsPos( int pos ) +{ + QScrollView::setContentsPos ( pos, 0 ); +} diff --git a/korganizer/plugins/timespanview/timeline.h b/korganizer/plugins/timespanview/timeline.h new file mode 100644 index 000000000..7c9bd8689 --- /dev/null +++ b/korganizer/plugins/timespanview/timeline.h @@ -0,0 +1,56 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 TIMELINE_H +#define TIMELINE_H + +#include <qscrollview.h> +#include <qdatetime.h> + +class TimeLine : public QScrollView +{ + Q_OBJECT + public: + TimeLine( QWidget *parent = 0, const char *name = 0 ); + virtual ~TimeLine(); + + void setDateRange( const QDateTime &start, const QDateTime &end ); + + public slots: + void setContentsPos( int pos ); + + protected: + void drawContents(QPainter* p, int cx, int cy, int cw, int ch); + + private: + QDateTime mStartDate; + QDateTime mEndDate; + + int mPixelWidth; + int mDaySpacing; + int mDayOffset; + int mSecsPerPixel; +}; + +#endif + diff --git a/korganizer/plugins/timespanview/timespanview.cpp b/korganizer/plugins/timespanview/timespanview.cpp new file mode 100644 index 000000000..be95a2c8d --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.cpp @@ -0,0 +1,80 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <qfile.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kdebug.h> +#include <kaction.h> +#include <kglobal.h> + +#include "kotimespanview.h" + +#include "timespanview.h" +using namespace KOrg; +#include "timespanview.moc" + +class TimespanViewFactory : public KOrg::PartFactory { + public: + KOrg::Part *create( KOrg::MainWindow *parent, const char *name ) + { + return new TimespanView( parent, name ); + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_timespanview, TimespanViewFactory ) + + +TimespanView::TimespanView(KOrg::MainWindow *parent, const char *name) : + KOrg::Part(parent,name), mView(0) +{ + setInstance( new KInstance( "korganizer" ) ); + + setXMLFile( "plugins/timespanviewui.rc" ); + + new KAction( i18n("&Timespan"), "timespan", 0, this, SLOT( showView() ), + actionCollection(), "view_timespan" ); +} + +TimespanView::~TimespanView() +{ +} + +QString TimespanView::info() +{ + return i18n("This plugin provides a Gantt-like Timespan view."); +} + +QString TimespanView::shortInfo() +{ + return i18n( "Timespan View Plugin" ); +} + +void TimespanView::showView() +{ + if (!mView) { + mView = new KOTimeSpanView( mainWindow()->view()->calendar(), + mainWindow()->view() ); + mainWindow()->view()->addView( mView ); + } + mainWindow()->view()->showView( mView ); +} diff --git a/korganizer/plugins/timespanview/timespanview.desktop b/korganizer/plugins/timespanview/timespanview.desktop new file mode 100644 index 000000000..13654b46a --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.desktop @@ -0,0 +1,94 @@ +[Desktop Entry] +X-KDE-Library=libkorg_timespanview +Name=Timespan View Plugin for KOrganizer +Name[af]=Tydlyn aansig inprop module vir KOrganizer +Name[bg]=Приставка за разпределението на времето в организатора +Name[ca]=Endollable de vista de període temporal per a KOrganizer +Name[cs]=Modul časového pohledu pro KOrganizer +Name[da]=Timespan-visning-plugin for KOrganizer +Name[de]=Zeitspannenansicht-Modul für KOrganizer +Name[el]=Πρόσθετο προβολής εργασιών του KOrganizer +Name[eo]=Tempgamrigardo-kromaĵo por Organizilo +Name[es]=Extensión de visor de Timespan para KOrganizer +Name[et]=KOrganizeri perioodivaate plugin +Name[eu]=KOrganizer-rako denbora-barruti ukuspegi plugin-a +Name[fa]=وصلۀ نمای گسترۀ زمان برای KOrganizer +Name[fi]=Ajankulkunäkymäliitännäinen Korganizeriin +Name[fr]=Module d'affichage de planification pour KOrganizer +Name[fy]=Tiidspanneplugin foar KOrganizer +Name[gl]=Extensión de Vista en Unidades de Tempo para KOrganizer +Name[hu]=Időszakáttekintő bővítőmodul a KOrganizerhez +Name[is]=Tímabilsskoðunar íforrit fyrir KOrganizer +Name[it]=Plugin vista intervalli temporali per KOrganizer +Name[ja]=KOrganizer タイムスパンビュー プラグイン +Name[ka]=დროის დიაგრამიანი ხედის მოდული KOrganizer-სთვის +Name[kk]=KOrganizer-дің уақыт аралығы көрініс модулі +Name[km]=កម្មវិធីជំនួយទិដ្ឋភាពរយៈពេលសម្រាប់ KOrganizer +Name[lt]=Laiko tarpsnio vaizdo KOrganizer priedas +Name[ms]=Plugin Paparan Kitar Waktu untuk KOrganizer +Name[nb]=Programtillegg for periodevisning i KOrganizer +Name[nds]=Tietbruuk-Moduul för KOrganizer +Name[ne]=केडीई आयोजकका लागि समयावधि दृश्य प्लगइन +Name[nl]=Tijdspanneplugin voor KOrganizer +Name[nn]=Programtillegg for tidsromsvising i KOrganizer +Name[pl]=Wtyczka widoku zakresu czasu dla KOrganizera +Name[pt]='Plugin' de Vista de Intervalo de Tempo para o KOrganizer +Name[pt_BR]=Plug-in de Visualização de Período de Tempo Para o KOrganizer +Name[ru]=Диаграмма Ганта для KOrganizer +Name[sk]=KOrganizer modul pre projektový pohľad +Name[sl]=Vstavek za časovni prikaz za KOrganizer +Name[sr]=Прикључак KOrganizer-а за приказ временског распона +Name[sr@Latn]=Priključak KOrganizer-a za prikaz vremenskog raspona +Name[sv]=Tidsintervallvyinsticksprogram för Korganizer +Name[ta]=கேஅமைப்பாளருக்கான திட்டக் காட்சி சொருகுப்பொருள் +Name[tr]=KOrganizer için Zaman Dilimi Görünümü Eklentisi +Name[uk]=Втулок перегляду періоду часу для KOrganizer +Name[zh_CN]=KOrganizer 的时间跨度查看插件 +Name[zh_TW]=KOrganizer 時間檢視外掛程式 +Comment=This plugin provides a timespan view for korganizer (like the to-do or month views). If you enable this plugin, you can switch to the timespan view and view your events like in a Gantt diagram. +Comment[af]=Hierdie inprop module verskaf 'n tydlyn aansig vir KOrganizer. Dit lyk baie soos die te-doen of maand aansig. As hierdie inprop module geaktiveer is, kan jy na die tydlyn aansig wissel en na jou te-doen lys in tydlyn formaat kyk. +Comment[bg]=Приставката служи за преглед на събитията и задачите в зададен период от време. +Comment[ca]=Aquest endollable proporciona una vista d'un període temporal per a KOrganizer (com ara les vistes de pendents o mensual). Si habiliteu aquest endollable, podeu canviar a la vista de període temporal i veure els esdeveniments com en un diagrama de Gantt. +Comment[cs]=Tento modul umožňuje časový pohled pro korganizer (podobně jako úkoly nebo měsíční pohled). Pokud ho povolíte, můžete se přepnout na časový pohled a prohlížet si události v Ganttově diagramu. +Comment[da]=Pluginnet sørger for en tidsintervalsvisning i Korganizer (som ligner gøremål eller månedsvisning). Hvis du aktiverer dette plugin kan du skifte til tidsintervalvisning og vise dine begivenheder som i et Gantt-diagram. +Comment[de]=Mit diesem Modul wird KOrganizer um eine Zeitspannenansicht (ähnlich der Aufgaben- und Monatsansicht) erweitert. Wenn Sie es einschalten, können Sie zur Zeitspannenansicht wechseln und sich Ihre Ereignisse wie in einem Gantt-Diagramm ansehen. +Comment[el]=Αυτό το πρόσθετο παρέχει μία προβολή 'ανοίγματος' χρόνου για το korganizer (όπως οι μηνιαίες προβολές των προς υλοποίηση εργασιών). Αν το ενεργοποιήσετε, μπορείτε να αλλάξετε σε προβολή 'ανοίγματος' χρόνου και να δείτε τα γεγονότα σας όπως ένα διάγραμμα του Gantt. +Comment[es]=Esta extensión proporciona una vista de timespan para korganizer (como la vista de tareas pendientes o la mensual). Si activa esta extensión, puede pasar a la vista de timespan y ver sus eventos como un diagrama de Gantt. +Comment[et]=See plugin lisab KOrganizerile perioodivaate (nagu ülesannete või kuuvaade). Selle lubamisel saab lülituda perioodivaatele ning näha oma sündmusi Gantti diagrammina. +Comment[eu]=Plugin honek KOrganizer-entzat denbora barruti ikuspegi bat eskeintzen du. Plugin hau gaitzen baduzu denbora-barruti ikuspegira alda zaitezke gertaerak Gantt diagrama batean bezala ikusi. +Comment[fa]=این وصله، برای KOrganizer یک نمای گسترۀ زمان )مثل نماهای کارهای انجامی یا ماهانه( فراهم میکند. اگر این وصله را فعال کنید، میتوانید به گسترۀ زمان سودهی کرده و مانند نمودار Gantt، رویدادهای خود را مشاهده کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa ajankulkunäkymän KOrganizeriin (kuten tehtävälista- tai kuukausinäkymän). Jos kytket tämän päälle, voit vaihtaa ajankulkunäkymään ja katsoa tapahtumia kuten Gantt-diagrammissa. +Comment[fr]=Ce module vous permet d'avoir une vue de KOrganizer qui affiche les évènements selon l'axe temporel. Si vous activez cette vue, vous verrez vos évènements comme un diagramme de Gantt. +Comment[fy]=Dizze plugin jout in werjefte foar KOrganizer (lykas de takenlist en de moannewerjefte). Wannear jo dizze plugin ynskeakelje kinne jo kieze foar in werjefte wêryn jo eveneminten yn in Gantt-diagram besjen kinne. +Comment[gl]=Esta extensión fornece unha vista en unidades de tempo (como as vistas mensuais e a vista de tarefas). Se habilita esta extensión, pode trocar a vista en unidades de tempo e ver os seus eventos como un diagrama Gantt. +Comment[hu]=Ezzel modullal egy időszakot lehet áttekinteni a KOrganizerben (például a feladatokat vagy a havi nézeteket). Ha aktiválja ezt a modult, átválthat időszakos nézetbe, hogy az események Gantt-diagramon legyenek megtekinthetők. +Comment[is]=Þetta íforrit veitir tímabilssýn fyrir KOrganizer (svipað og verkþátta eða mánaðarsýn). Ef þú virkjar þetta íforrit getur þú skipt yfir í tímabilssýn og skoðað atburðina þína eins og á Gantt skýringarmynd. +Comment[it]=Questo plugin fornisce una vista a intervalli temporali. Se abiliti questo plugin, potrai passare alla vista a intervalli temporali e vedere i tuoi eventi come in un diagramma di Gantt. +Comment[ja]=このプラグインは KOrganizer にタイムスパンビューを提供します (To-Do ビューや月ビューなど)。このプラグインを有効にすると、タイムスパンビューに切り替えて、ガントチャートのようにイベントを見ることができます。 +Comment[ka]=ეს მოდული უზრუნველჰყოფს korganizer-ს დროის დიაგრამიანი ხედით (მაგ.:დავალებები ან თვიური მიმოხილვა). თუ ამ მოდულს გაააქტიურებთ,თქვენ შეგიძლიათ გადართოთ დროის დიაგრამიან ხედზე და იხილოთ მოვლენები განტის დიაგრამის სახით. +Comment[kk]=Бұл KOrganizer-нің уақыт аралығы көрінісінің модулі. Модулін орнатсаңыз, осы көрініске ауысып оқиғаларыңызды Гант диаграмма түріне келтре аласыз. +Comment[km]=កម្មវិធីជំនួយនេះផ្ដល់នូវទិដ្ឋភាពរយៈពេលសម្រាប់ korganizer (ដូចជា ទិដ្ឋភាពការងារត្រូវធ្វើ ឬ ទិដ្ឋភាពខែជាដើម) ។ បើអ្នកធ្វើឲ្យកម្មវិធីជំនួយនេះប្រើបាន អ្នកនឹងអាចប្ដូរទិដ្ឋភាពរយៈពេល ហើយមើលព្រឹត្តិការណ៍របស់អ្នកដូចជានៅក្នុងដ្យាក្រាម Gantt អញ្ចឹងដែរ ។ +Comment[lt]=Šis priedas korganizer programoje sudaro galimybę apžvelgti laiko tarpą (pvz., darbų arba mėnesio peržiūra). Įgalinus šį priedą galėsite persijungti į laiko tarpo peržiūrą ir žiūrėti įvykius tarsi Gantt diagramoje. +Comment[ms]=Plugin ini menyediakan paparan kitar waktu untuk korganizer (seperti tugasan atau paparan bulan). Jika plugin ini diaktifkan,anda boleh beralih ke paparan kitar masa dan paparkan peristiwa seperti dalam diagram Gantt. +Comment[nb]=Dette programtillegget lager en periodevisning for korganizer (slik som gjøreliste og månedsvisning). Hvis du slår på dette programtillegget kan du bytte til periodevisning og se hendelser som i et Gantt-diagram. +Comment[nds]=Mit dit Moduul kannst Du in KOrganizer en Tietbruuk-Ansicht opropen (jüst as de Opgaven- oder Maandansichten). Wenn Du dit Moduul aktiveerst, kannst Du na de Tietbruukansicht wesseln un Dien Begeefnissen as Ganntt-Diagramm ankieken. +Comment[ne]=यो प्लगइनले केडीई आयोजकका लागि समयावधि उपलब्ध गराउछ (गर्नुपर्ने कार्य वा महिना दृश्य जस्तो) । तपाईँले यो प्लगइन सक्षम पारेमा, तपाईँले समयावधि दृश्यमा स्वीच गर्न र गान्ट रेखाचित्र जस्तोमा घटना हेर्न सक्नुहुन्छ । +Comment[nl]=Deze plugin biedt een weergave voor KOrganizer (zoals de takenlijst en de maandweergave). Wanneer u deze plugin inschakelt kunt u kiezen voor een weergave waarin u uw evenementen in een Gantt-diagram kunt bekijken. +Comment[pl]=Ta wtyczka tworzy widok zakresu czasu w KOrganizerze (tak jak widok zadań do zrobienia lub widok miesiąca). Po włączeniu tej wtyczki możliwe jest przełączenie się na widok zakresu czasu i przeglądanie zdarzeń jak na diagramie Gantta. +Comment[pt]=Este 'plugin' oferece uma vista de distribuição temporal para o KOrganizer (como as vistas de itens por-fazer ou mensais). Se activar este 'plugin', poderá mudar para a vista de distribuição temporal e ver os seus eventos como num diagrama de Gantt. +Comment[pt_BR]=Este plug-in fornece uma visão de período de tempo para o KOrganizer (como a visão de pendências e do mês). Se você ativar este plugin, você pode mudar para a visão de período de tempo e ver seus eventos como num diagrama de Gantt. +Comment[ru]=Этот модуль показывает диаграмму Ганта для органайзера KDE. Если вы подключите этот модуль, вы можете посмотреть ваши события в виде диаграммы Ганта. +Comment[sk]=Tento modul poskytuje projektový pohľad pre korganizer (ako sú úlohy alebo mesačné pohľady). Ak povolíte tento modul, môžete prepínať projektový pohľad a pohľad na udalosti ako je Gantt diagram. +Comment[sl]=Ta vstavek ponuja časovni prikaz za KOrganizer (kot prikaz opravil ali mesečni prikaz). Če omogočite ta vstavek, lahko preklopite na časovni prikaz in si ogledate dogodke kot v Ganttovem diagramu. +Comment[sr]=Овај прикључак пружа приказ временског распона за KOrganizer (као месечни или прикази обавеза). Ако укључите овај прикључак, можете се пребацити на приказ временског распона и разгледати своје догађаје као у Гантовом дијаграму. +Comment[sr@Latn]=Ovaj priključak pruža prikaz vremenskog raspona za KOrganizer (kao mesečni ili prikazi obaveza). Ako uključite ovaj priključak, možete se prebaciti na prikaz vremenskog raspona i razgledati svoje događaje kao u Gantovom dijagramu. +Comment[sv]=Insticksprogrammet tillhandahåller en tidsintervallvy i Korganizer (som liknar uppgifts- eller månadsvyn). Om du aktiverar insticksprogrammet kan du byta till idsintervallvyn och visa dina händelser som i ett Gantt-diagram. +Comment[ta]=இந்த சொருகுப்பொருள் korganizerக்கான ஒரு குறுகிய நேரத்தை வழங்குகிறது. lசெய்யவேண்டியவை அல்ல்து மாதக் காட்சிகள் போன்ற). இந்த சொருகுப்பொருள் செயலில் இருந்தால், நீங்கள் குறுகிய நேரக் காட்சி மற்ரும் Gantt விளக்க வரைபடத்தில் உள்ளது போன்ற நிகழ்வுகளை பார்க்கலாம். +Comment[tr]=Bu eklenti, KOrganizer için zaman dilimi görünümü sağlar (yapılacaklar listesi ya da aylık görünüm gibi). Eğer bu eklentiyi aktif hale getirirseniz, zaman dilimi görünümüne geçebilir ve olayları Gantt diyagramı şeklinde görüntüleyebilirsiniz. +Comment[uk]=Цей втулок показує вигляд діаграми Ганта для korganizer (подібно до вигляду завдань та місячного). Якщо увімкнути цей втулок, то можна переглядати ваші події у вигляді діаграми Ганта. +Comment[zh_CN]=此插件为 KOrganizer 提供了时间跨度视图(类似于待办或月视图)。如果您启用了此插件,您可以像甘特图程序那样切换到时间跨度视图并查看您的事件。 +Comment[zh_TW]=此外掛程式提供時間檢視模式。如果您開啟此外掛程式,您可以切換時間檢視,讓您使用類似甘特圖的圖形來檢視事件。 +Type=Service +ServiceTypes=KOrganizer/Part +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/timespanview/timespanview.h b/korganizer/plugins/timespanview/timespanview.h new file mode 100644 index 000000000..e88e140c5 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.h @@ -0,0 +1,42 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef KORG_PROJECTVIEW_H +#define KORG_PROJECTVIEW_H +// $Id$ + +#include <korganizer/part.h> +#include <korganizer/calendarviewbase.h> + +class TimespanView : public KOrg::Part { + Q_OBJECT + public: + TimespanView(KOrg::MainWindow *, const char *); + ~TimespanView(); + + QString info(); + QString shortInfo(); + + private slots: + void showView(); + + private: + KOrg::BaseView *mView; +}; + +#endif diff --git a/korganizer/plugins/timespanview/timespanviewui.rc b/korganizer/plugins/timespanview/timespanviewui.rc new file mode 100644 index 000000000..62053159b --- /dev/null +++ b/korganizer/plugins/timespanview/timespanviewui.rc @@ -0,0 +1,15 @@ +<!DOCTYPE kpartgui> +<kpartgui name="timespanview" version="2"> + + <MenuBar> + <Menu name="view"> + <Action name="view_timespan"/> + </Menu> + </MenuBar> + + <ToolBar name="korganizer_toolbar"> + <Action name="view_timespan"/> + </ToolBar> + +</kpartgui> + diff --git a/korganizer/plugins/timespanview/timespanwidget.cpp b/korganizer/plugins/timespanview/timespanwidget.cpp new file mode 100644 index 000000000..23d781f45 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanwidget.cpp @@ -0,0 +1,175 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qsplitter.h> +#include <qlistview.h> +#include <qlayout.h> +#include <qheader.h> +#include <qpushbutton.h> + +#include <klocale.h> +#include <kdebug.h> + +#include <libkcal/event.h> + +#include "lineview.h" +#include "timeline.h" + +#include "timespanwidget.h" +#include "timespanwidget.moc" + +TimeSpanWidget::TimeSpanWidget( QWidget *parent, const char *name ) : + QWidget( parent, name ) +{ + QBoxLayout *topLayout = new QVBoxLayout( this ); + + mSplitter = new QSplitter( this ); + topLayout->addWidget( mSplitter ); + + mList = new QListView( mSplitter ); + mList->addColumn( i18n("Summary") ); + + QWidget *rightPane = new QWidget( mSplitter ); + QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); + + mTimeLine = new TimeLine( rightPane ); + mTimeLine->setFixedHeight( mList->header()->height() ); + rightPaneLayout->addWidget( mTimeLine ); + + mLineView = new LineView( rightPane ); + rightPaneLayout->addWidget( mLineView ); + + QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); + + QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); + connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); + buttonLayout->addWidget( zoomInButton ); + + QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); + connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); + buttonLayout->addWidget( zoomOutButton ); + + QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); + connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); + buttonLayout->addWidget( centerButton ); + + connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), + mTimeLine,SLOT(setContentsPos(int))); +} + +TimeSpanWidget::~TimeSpanWidget() +{ +} + +QValueList<int> TimeSpanWidget::splitterSizes() +{ + return mSplitter->sizes(); +} + +void TimeSpanWidget::setSplitterSizes( QValueList<int> sizes ) +{ + mSplitter->setSizes( sizes ); +} + +void TimeSpanWidget::addItem( KCal::Event *event ) +{ + new QListViewItem( mList, event->summary() ); + + QDateTime startDt = event->dtStart(); + QDateTime endDt = event->dtEnd(); + +// kdDebug(5850) << "TimeSpanWidget::addItem(): start: " << startDt.toString() +// << " end: " << endDt.toString() << endl; + +// int startSecs = mStartDate.secsTo( startDt ); +// int durationSecs = startDt.secsTo( endDt ); + +// kdDebug(5850) << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; + + int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; + int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; + +// kdDebug(5850) << "TimeSpanWidget::addItem(): s: " << startX << " e: " << endX << endl; + + mLineView->addLine( startX, endX ); +} + +void TimeSpanWidget::clear() +{ + mList->clear(); + mLineView->clear(); +} + +void TimeSpanWidget::updateView() +{ +#if QT_VERSION >= 300 + mLineView->updateContents(); + mTimeLine->updateContents(); +#else +#endif +} + +void TimeSpanWidget::setDateRange( const QDateTime &start, const QDateTime &end ) +{ + mStartDate = start; + mEndDate = end; + + mTimeLine->setDateRange( start, end ); + + mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); +} + +QDateTime TimeSpanWidget::startDateTime() +{ + return mStartDate; +} + +QDateTime TimeSpanWidget::endDateTime() +{ + return mEndDate; +} + +void TimeSpanWidget::zoomIn() +{ + int span = mStartDate.daysTo( mEndDate ); + setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); + + emit dateRangeChanged(); +} + +void TimeSpanWidget::zoomOut() +{ + int span = mStartDate.daysTo( mEndDate ); + setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); + + emit dateRangeChanged(); +} + +void TimeSpanWidget::centerView() +{ + QScrollBar *scrollBar = mLineView->horizontalScrollBar(); + int min = scrollBar->minValue(); + int max = scrollBar->maxValue(); + scrollBar->setValue( min + (max-min) / 2 ); +} diff --git a/korganizer/plugins/timespanview/timespanwidget.h b/korganizer/plugins/timespanview/timespanwidget.h new file mode 100644 index 000000000..316437023 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanwidget.h @@ -0,0 +1,78 @@ +/* + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 TimeSpanWidget_H +#define TimeSpanWidget_H + +#include <qwidget.h> + +namespace KCal { +class Event; +} + +class QSplitter; +class QListView; +class LineView; +class TimeLine; + +class TimeSpanWidget : public QWidget +{ + Q_OBJECT + public: + TimeSpanWidget( QWidget *parent=0, const char *name=0 ); + virtual ~TimeSpanWidget(); + + void addItem( KCal::Event * ); + + QValueList<int> splitterSizes(); + void setSplitterSizes( QValueList<int> ); + + void clear(); + + void setDateRange( const QDateTime &start, const QDateTime &end ); + + QDateTime startDateTime(); + QDateTime endDateTime(); + + public slots: + void updateView(); + + void zoomIn(); + void zoomOut(); + void centerView(); + + signals: + void dateRangeChanged(); + + private: + QSplitter *mSplitter; + QListView *mList; + TimeLine *mTimeLine; + LineView *mLineView; + + QDateTime mStartDate; + QDateTime mEndDate; + int mSecsPerPixel; +}; + +#endif |