/*
 *  Copyright (C) 2007-2008 CMM Sigma Andrzej Chmielowiec <cmmsigma@cmmsigma.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 3
 *  as published by the Free Software Foundation.
 *
 *  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.
 */

#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QtGui>

#include "CA.h"
#include "AboutBox.h"

class MainWindow: public QMainWindow
{
	Q_OBJECT;
	
public:
	MainWindow(QMainWindow *parent = 0);
	
private slots:
	void caNew();
	void caOpen();
	void caUpdate();
	void caUpdateInfo();
	void caClose();
	void caConfig();
	void caDelete();
	void caImport();
	void caExport();
	void changeCertInfo(QTreeWidgetItem *, QTreeWidgetItem *);
	void changeReqInfo(QTreeWidgetItem *, QTreeWidgetItem *);
	void certGetReq();
	void certRecvReq();
	void certSignReq();
	void certSignReqAll();
	void certDeleteReq();
	void certViewAll();
	void certViewValid();
	void certSaveAs();
	void certSend();
	void certRevoke();
	void crlNew();
	void crlSaveAs();
	void crlFtpEdit();
	void crlDistribute();
	void changeLeftPanelTab(int index);
	void helpSlot();
	void aboutSlot();
	void langEnSlot();
	void langPlSlot();
	
private:
	void langExclamation();
	void createActions();
	void createMenus();
	void createToolBars();
	void createWelcomeWidget();
	void createCaInfoWidget();
	void createCentralWidget();
	void createAboutBox();
	
	QSplitter *mCentral;
	QStackedWidget *mRightPanelStack;
	QTabWidget *mLeftPanelTab;
	QTreeWidget *mCertTree;
	QTextEdit *mCertInfo;
	QTreeWidget *mReqTree;
	QTextEdit *mReqInfo;
	QWidget *mWelcome;
	QWidget *mCaInfo;
	QLabel *mCaName;
	QLabel *mCaGeneralInfo;
	QLabel *mCaCrlInfo;
	QLabel *mCaPolicy;
	
	QMenu *mGeneralMenu;
	QMenu *mCaMenu;
	QMenu *mCertMenu;
	QMenu *mCrlMenu;
	QMenu *mHelpMenu;
	
	QToolBar *mCertToolBar;
	QToolBar *mCrlToolBar;
	
	QAction *mExitAct;	
	QAction *mCaNewAct;
	QAction *mCaOpenAct;
	QAction *mCaUpdateAct;
	QAction *mCaCloseAct;
	QAction *mCaConfigAct;
	QAction *mCaImportAct;
	QAction *mCaExportAct;
	QAction *mCaDeleteAct;
	QAction *mCertGetReqAct;
	QAction *mCertRecvReqAct;
	QAction *mCertSignReqAct;
	QAction *mCertSignReqAllAct;
	QAction *mCertDeleteReqAct;
	QAction *mCertViewAllAct;
	QAction *mCertViewValidAct;
	QAction *mCertSaveAsAct;
	QAction *mCertSendAct;
	QAction *mCertRevokeAct;
	QAction *mCrlNewAct;
	QAction *mCrlSaveAsAct;
	QAction *mCrlFtpEditAct;
	QAction *mCrlFtpDistAct;
	QAction *mHelpAct;
	QAction *mAboutAct;
	QActionGroup *mLang;
	QAction *mLangEn;
	QAction *mLangPl;
	
	CA *mCaActive;
	QList<CA> mCaList;
	
	AboutBox *mAboutBox;
	
};

#endif
