1 /* 2 * Copyright (C) 2018 Rafael Ostertag 3 * 4 * This file is part of YAPET. 5 * 6 * YAPET is free software: you can redistribute it and/or modify it under the 7 * terms of the GNU General Public License as published by the Free Software 8 * Foundation, either version 3 of the License, or (at your option) any later 9 * version. 10 * 11 * YAPET is distributed in the hope that it will be useful, but WITHOUT ANY 12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 14 * details. 15 * 16 * You should have received a copy of the GNU General Public License along with 17 * YAPET. If not, see <http://www.gnu.org/licenses/>. 18 * 19 * Additional permission under GNU GPL version 3 section 7 20 * 21 * If you modify this program, or any covered work, by linking or combining it 22 * with the OpenSSL project's OpenSSL library (or a modified version of that 23 * library), containing parts covered by the terms of the OpenSSL or SSLeay 24 * licenses, Rafael Ostertag grants you additional permission to convey the 25 * resulting work. Corresponding Source for a non-source form of such a 26 * combination shall include the source code for the parts of OpenSSL used as 27 * well as that of the covered work. 28 */ 29 30 #ifndef _CREATEFILE_H 31 #define _CREATEFILE_H 1 32 33 #include "mainwindow.h" 34 #include "newpassworddialog.h" 35 #include "yacurs.h" 36 37 /** 38 * Handle creating a file. 39 * 40 * The class handles creating a file: 41 * 42 * 1. if the currently open file has pending changes, it asks whether 43 * the changes should be saved, or the users wishes to cancel. 44 * 45 * 2. Show save dialog. 46 * 47 * 3. If save dialog was successful, show new password prompt. 48 */ 49 class CreateFile { 50 private: 51 MainWindow& mainwindow; 52 NewPasswordDialog* promptpassword; 53 YACURS::FileSaveDialog* filesavedialog; 54 YACURS::MessageBox2* confirmsave; 55 YACURS::MessageBox2* generror; 56 std::string _currentLoadedFile; 57 std::string _filepath; 58 bool ignore_unsaved_file; 59 60 void window_close_handler(YACURS::Event& e); 61 62 public: 63 CreateFile(MainWindow& mw); 64 CreateFile(const CreateFile&) = delete; 65 CreateFile(const CreateFile&&) = delete; 66 CreateFile& operator=(const CreateFile&) = delete; 67 CreateFile& operator=(CreateFile&&) = delete; 68 69 ~CreateFile(); 70 71 void run(); 72 }; 73 74 #endif // _CREATEFILE_H 75