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; 00069 00070 private: 00071 Composer *composer_; 00072 00074 WFileUpload *upload_; 00075 00077 WText *uploaded_; 00078 00080 WCheckBox *keep_; 00081 00083 Option *remove_; 00084 00086 WText *error_; 00087 00089 bool uploadFailed_; 00090 00092 std::wstring fileName_; 00093 00095 std::string spoolFileName_; 00096 00098 std::wstring contentDescription_; 00099 00101 bool taken_; 00102 00103 private slots: 00105 void uploaded(); 00106 00108 void fileTooLarge(int size); 00109 00111 void remove(); 00112 00113 }; 00114 00117 #endif // ATTACHMENT_EDIT_H_