/***************************************************************************
 *   Copyright (C) 2007 by Ian Reinhart Geiser   *
 *   geiseri@yahoo.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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef JOT_H
#define JOT_H

#include <QMainWindow>
#include <QCloseEvent>
#include "ui_jotmainwindow.h"

class QAction;
class QMenu;
class QTextEdit;
class QActionGroup;

class JotMainWindow : public QMainWindow
{
      Q_OBJECT

public:
      JotMainWindow();
      ~JotMainWindow();

protected:
      void closeEvent(QCloseEvent *event);

private slots:
      void newFile();
      void open();
      bool save();
      bool saveAs();
      void about();
      void documentWasModified();

	void on_actionBold_activated();
	void on_actionItalics_activated();
	void on_actionUnderline_activated();
	void on_actionNoHeading_activated();
	void on_actionHeading1_activated();
	void on_actionHeading2_activated();
	void on_actionHeading3_activated();
	void on_actionHeading4_activated();
	void on_actionHeading5_activated();
	void on_actionHeading6_activated();
	void on_actionLink_activated();

	void on_actionImage_activated();
	void on_actionHorizontalRule_activated();

	void on_wikiEditor_cursorPositionChanged();
	void on_linkUrl_textEdited( const QString &text );

private:
      void createActions();
      void createMenus();
      void createToolBars();
      void createStatusBar();
      void readSettings();
      void writeSettings();
      bool maybeSave();
      void loadFile(const QString &fileName);
      bool saveFile(const QString &fileName);
      void setCurrentFile(const QString &fileName);
      QString strippedName(const QString &fullFileName);

	void configureLinkEditor( );

      QString curFile;
	Ui::JotMainWindow m_ui;
	QActionGroup *m_headings;
};

#endif

