1 /*************************************************************************** 2 docassistant.h - Assistant widget 3 ------------------- 4 begin : April 2007 5 copyright : (C) 2007 by Klaas Freitag 6 email : freitag@kde.org 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef DOCASSISTANT_H 19 #define DOCASSISTANT_H 20 21 #include <QSplitter> 22 #include <QTreeWidgetItem> 23 #include <QScopedPointer> 24 #include <QStackedWidget> 25 26 #include <kcontacts/addressee.h> 27 28 #include "kraftdoc.h" 29 #include "catalogtemplate.h" 30 #include "docpostcard.h" 31 #include "catalogselection.h" 32 33 class TextSelection; 34 class QWidget; 35 class QPushButton; 36 class Katalog; 37 class TemplateProvider; 38 class HeaderTemplateProvider; 39 class CatalogTemplateProvider; 40 class FooterTemplateProvider; 41 class AddressTemplateProvider; 42 class DocText; 43 class QSplitter; 44 45 using namespace KContacts; 46 47 class DocAssistant : public QSplitter 48 { 49 Q_OBJECT 50 51 public: 52 DocAssistant( QWidget* ); 53 54 DocPostCard *postCard(); 55 CatalogSelection *catalogSelection(); 56 57 void saveSplitterSizes(); 58 59 public slots: 60 void slotShowCatalog(); 61 void slotShowHeaderTemplates(); 62 void slotShowFooterTemplates(); 63 void setFullPreview( bool, int ); 64 void slotSelectDocPart( int ); 65 void slotToggleShowTemplates( bool ); 66 void slotAddToDocument(); 67 void slotNewTemplate(); 68 void slotEditTemplate(); 69 void slotDeleteTemplate(); 70 71 void slotSetDocType( const QString& ); 72 73 protected slots: 74 void slotTemplateSelectionChanged(); 75 void slotHeaderTextToDocument( const DocText& ); 76 void slotFooterTextDeleted( const DocText& ); 77 void slotHeaderTextDeleted( const DocText& ); 78 void slotNewHeaderDocText( const DocText& ); 79 void slotUpdateHeaderDocText( const DocText& ); 80 void slotCatalogSelectionChanged( QTreeWidgetItem*,QTreeWidgetItem* ); 81 void slotNewFooterDocText( const DocText& ); 82 void slotUpdateFooterDocText( const DocText& ); 83 void slotFooterTextToDocument( const DocText& ); 84 85 signals: 86 void selectPage( int ); 87 void templatesToDocument( Katalog*, CatalogTemplateList, const QString&); 88 void toggleShowTemplates( bool ); 89 90 void addressTemplate( const Addressee& ); 91 void headerTextTemplate( const QString& ); 92 void footerTextTemplate( const QString& ); 93 94 private: 95 DocPostCard *mPostCard; 96 CatalogSelection *mCatalogSelection; 97 QStackedWidget *mWidgetStack; 98 TextSelection *mFooterSelection; 99 TextSelection *mHeaderSelector; 100 101 bool mFullPreview; 102 int mActivePage; 103 QPushButton *mPbAdd; 104 QPushButton *mPbNew; 105 QPushButton *mPbEdit; 106 QPushButton *mPbDel; 107 QWidget *mTemplatePane; 108 QString mDocType; 109 110 // QSplitter *mMainSplit; 111 112 TemplateProvider *mCurrTemplateProvider; 113 HeaderTemplateProvider *mHeaderTemplateProvider; 114 AddressTemplateProvider *mAddressTemplateProvider; 115 CatalogTemplateProvider *mCatalogTemplateProvider; 116 FooterTemplateProvider *mFooterTemplateProvider; 117 118 }; 119 120 121 #endif 122