summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/statistics/statisticsdialog.h
blob: 294ec2a8e9a09ff345391d097bae37ec8f10b3d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
    statisticsdialog.h - Kopete History Dialog

    Copyright (c) 2003-2004 by Marc Cramdal        <marc.cramdal@gmail.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.                                   *
    *                                                                       *
    *************************************************************************
*/

#ifndef _STATISTICSDIALOG_H
#define _STATISTICSDIALOG_H

#include <tqwidget.h>
#include <kdialogbase.h>
#include "kopetemetacontact.h"

class QCanvasView;
class QCanvas;
class QStringList;

class StatisticsWidget;
class StatisticsPlugin;
class StatisticsDB;
class StatisticsContact;

class KHTMLPart;
class KURL;
namespace KParts
{
	class URLArgs;
}

class StatisticsDialog : public KDialogBase
{
	Q_OBJECT
	public:
		StatisticsDialog(StatisticsContact *contact, StatisticsDB* db, TQWidget* parent=0,
			const char* name="StatisticsDialog");
	private:
		TQString generateHTMLChart(const int *hours, const int *hours2, const int *hours3, const TQString & caption, const TQString & color);
		TQString generateHTMLChartBar(int height, const TQString & color, const TQString & caption);
		TQString stringFromSeconds(const int seconds);
		
		StatisticsWidget *mainWidget;
		KHTMLPart *generalHTMLPart;
		
		/// Database from which we get the statistics
		StatisticsDB *m_db;
		/// Metacontact for which we get the statistics from m_db
		StatisticsContact *m_contact;
		
		void generatePageFromQStringList(TQStringList values, const TQString & subTitle);
		
		/// Generates the main page
		void generatePageGeneral();
		/**
		 * @brief Generates the page for a given day of the week.
		 * \param dayOfWeek Monday..Sunday, 0..7
		 */
		void generatePageForDay(const int dayOfWeek);
		void generatePageForMonth(const int monthOfYear);
		

private slots:
		/**
		 * We manage the openURLRequestDelayed signal from the generalHTMLPart->browserExtension() in order to
		 * generate requested pages on the flow.
		 */
		void slotOpenURLRequest(const KURL& url, const KParts::URLArgs&);
		void slotAskButtonClicked();

};


#endif // _STATISTICSDIALOG_H