summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp29
-rw-r--r--korganizer/kowhatsnextview.h9
3 files changed, 34 insertions, 6 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba77b45..8e6cc53 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -231,25 +231,25 @@ void KOViewManager::updateWNview()
}
void KOViewManager::showWhatsNextView()
{
if (!mWhatsNextView) {
mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
"KOViewManager::WhatsNextView");
mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
addView(mWhatsNextView);
}
globalFlagBlockAgenda = 1;
showView(mWhatsNextView, true );
- mWhatsNextView->updateView();
+ //mWhatsNextView->updateView();
}
void KOViewManager::showListView()
{
if (!mListView) {
mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
addView(mListView);
connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 2a8a7c1..9b53110 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -65,24 +65,29 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
// new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
// mDateLabel->setMargin(2);
// mDateLabel->setAlignment(AlignCenter);
setFont( KOPrefs::instance()->mWhatsNextFont );
mView = new WhatsNextTextBrowser(this);
connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
mEventViewer = 0;
QBoxLayout *topLayout = new QVBoxLayout(this);
// topLayout->addWidget(mDateLabel);
topLayout->addWidget(mView);
+ mTimer = new QTimer( this );
+ connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
+
+ connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
+ connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
}
KOWhatsNextView::~KOWhatsNextView()
{
}
int KOWhatsNextView::maxDatesHint()
{
return 0;
}
int KOWhatsNextView::currentDateCount()
@@ -102,27 +107,47 @@ void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Day, fd, td);
#endif
}
void KOWhatsNextView::updateConfig()
{
setFont( KOPrefs::instance()->mWhatsNextFont );
updateView();
}
+void KOWhatsNextView::showEvent ( QShowEvent * e )
+{
+ //qDebug("KOWhatsNextView::showEvent ");
+ restartTimer();
+ QWidget::showEvent ( e );
+}
+void KOWhatsNextView::hideEvent ( QHideEvent * e)
+{
+ //qDebug(" KOWhatsNextView::hideEvent");
+ mTimer->stop();
+ QWidget::hideEvent ( e );
+}
+void KOWhatsNextView::restartTimer()
+{
+ //qDebug("KOWhatsNextView::restartTimer() ");
+ mTimer->start( 180000 );
+ //mTimer->start( 5000 );
+}
void KOWhatsNextView::updateView()
{
-
+ if ( mTimer->isActive() )
+ restartTimer();
+ //qDebug("KOWhatsNextView::updateView() ");
// mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
KIconLoader kil("korganizer");
QString ipath;// = new QString();
// kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
//<big><big><strong>" + date + "</strong></big></big>\n";
mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
#endif
@@ -609,26 +634,24 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
/*
void KOWhatsNextView::createEventViewer()
{
if (!mEventViewer) {
mEventViewer = new KOEventViewerDialog(this);
}
}
*/
void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
{
- if ( mEventViewer )
- delete mEventViewer;
mEventViewer = v;
}
// TODO: Create this function in CalendarView and remove it from here
void KOWhatsNextView::showIncidence(const QString &uid)
{
if ( !mEventViewer ) {
qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
return;
}
//kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
//qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index fff769a..1118bdd 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -11,24 +11,25 @@
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.
*/
#ifndef KOWHATSNEXTVIEW_H
#define KOWHATSNEXTVIEW_H
#include <qtextbrowser.h>
+#include <qtimer.h>
#include <korganizer/baseview.h>
class QListView;
class QLabel;
class KOEventViewerDialog;
class WhatsNextTextBrowser : public QTextBrowser {
Q_OBJECT
public:
WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
@@ -63,29 +64,33 @@ class KOWhatsNextView : public KOrg::BaseView
public slots:
virtual void updateView();
virtual void showDates(const QDate &start, const QDate &end);
virtual void showEvents(QPtrList<Event> eventList);
void updateConfig();
void changeEventDisplay(Event *, int);
protected:
void appendEvent(Incidence *, bool reply=false, bool notRed = true);
bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
void appendDay( int i, QDate date );
- QDate mEventDate;
+ QDate mEventDate;
+ virtual void showEvent ( QShowEvent * );
+ virtual void hideEvent ( QHideEvent * );
private slots:
void showIncidence(const QString &);
+ void restartTimer();
+
private:
//void createEventViewer();
-
+ QTimer* mTimer;
QTextBrowser *mView;
QString mText;
// QLabel *mDateLabel;
KOEventViewerDialog *mEventViewer;
QValueList<Incidence *> mTodos;
};
#endif