00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium. 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 #ifndef ATTACHMENT_EDIT_H_ 00008 #define ATTACHMENT_EDIT_H_ 00009 00010 #include <Wt/WContainerWidget> 00011 00012 namespace Wt { 00013 class WFileUpload; 00014 class WText; 00015 class WCheckBox; 00016 } 00017 00018 class Attachment; 00019 class Composer; 00020 class Option; 00021 00022 using namespace Wt; 00023 00028 00037 class AttachmentEdit : public WContainerWidget 00038 { 00039 public: 00042 AttachmentEdit(Composer *composer, WContainerWidget *parent = 0); 00043 ~AttachmentEdit(); 00044 00051 bool uploadNow(); 00052 00055 bool uploadFailed() const { return uploadFailed_; } 00056 00059 bool include() const; 00060 00063 Attachment attachment(); 00064 00068 Signal<void>& uploadDone() { return uploadDone_; } 00069 00070 private: 00071 Composer *composer_; 00072 00073 Signal<void> uploadDone_; 00074 00076 WFileUpload *upload_; 00077 00079 WText *uploaded_; 00080 00082 WCheckBox *keep_; 00083 00085 Option *remove_; 00086 00088 WText *error_; 00089 00091 bool uploadFailed_; 00092 00094 std::wstring fileName_; 00095 00097 std::string spoolFileName_; 00098 00100 std::wstring contentDescription_; 00101 00103 bool taken_; 00104 00105 private slots: 00107 void uploaded(); 00108 00110 void fileTooLarge(int size); 00111 00113 void remove(); 00114 00115 }; 00116 00119 #endif // ATTACHMENT_EDIT_H_