summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/chatwindow/kopeteemailwindow.h
blob: a0f596f524cae38da4f7a6afc7a7506ec39d7a43 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
    kopeteemailwindow.h - Kopete "email window" for single-shot messages

    Copyright (c) 2002      by Daniel Stone          <dstone@kde.org>
    Copyright (c) 2003      by Jason Keirstead       <jason@keirstead.org>
    Copyright (c) 2003      by Martijn Klingens      <klingens@kde.org>

    Kopete    (c) 2002-2003 by the Kopete developers <kopete-devel@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.                                   *
    *                                                                       *
    *************************************************************************
*/

#ifndef KOPETEEMAILWINDOW_H
#define KOPETEEMAILWINDOW_H

#include "kopeteview.h"
#include "kopeteviewplugin.h"
#include <kmainwindow.h>
#include <kparts/mainwindow.h>

namespace KParts { struct URLArgs; }
class EmailWindowPlugin;

class KopeteEmailWindow : KParts::MainWindow, public KopeteView
{
	Q_OBJECT
  

public:
	enum WindowMode { Send, Read, Reply };

	KopeteEmailWindow( Kopete::ChatSession *, EmailWindowPlugin *parent, bool foreignMessage );
	~KopeteEmailWindow();

	virtual Kopete::Message currentMessage();
	virtual void setCurrentMessage( const Kopete::Message &newMessage );
	virtual void raise(bool activate=false);
	virtual void makeVisible();
	virtual bool closeView( bool force = false );
	virtual bool isVisible();
	virtual TQWidget *mainWidget() { return this; }

public slots:
	virtual void sendMessage();
	virtual void appendMessage( Kopete::Message &message );
	virtual void messageSentSuccessfully();

signals:
	virtual void shown();
	virtual void messageSent( Kopete::Message &message );
	virtual void closing( KopeteView *view );
	virtual void activated( KopeteView *view );

protected:
	virtual void closeEvent( TQCloseEvent *e );
	virtual void windowActivationChange( bool activated );

private slots:
	void slotReplySend();
	void slotUpdateReplySend();
	void slotReadNext();
	void slotReadPrev();
	void slotCloseView();

	void slotSmileyActivated( const TQString & );
	void slotCopy();

	void slotViewMenuBar();

	void slotConfToolbar();

	void slotMarkMessageRead();

private:
	class Private;
	Private *d;

	void toggleMode( WindowMode );
	void updateNextButton();
	void initActions();
	void writeMessage( Kopete::Message & );
};


/**
 * This is the class that makes the emailwindow a plugin
 */
class EmailWindowPlugin : public Kopete::ViewPlugin
{
    public:
	EmailWindowPlugin(TQObject *parent, const char *name, const TQStringList &args);
	KopeteView* createView( Kopete::ChatSession *manager );
};

#endif // __KOPETEEMAILWINDOW_H__

// vim: set noet ts=4 sts=4 sw=4: