File indexing completed on 2024-05-05 05:40:58
0001 /*************************************************************************** 0002 * Copyright (C) 2021 by Renaud Guezennec * 0003 * http://www.rolisteam.org/contact * 0004 * * 0005 * This software is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #include "newfiledialog.h" 0021 #include "ui_newfiledialog.h" 0022 0023 NewFileDialog::NewFileDialog(Core::ContentType type, QWidget* parent) : QDialog(parent), ui(new Ui::NewFileDialog) 0024 { 0025 ui->setupUi(this); 0026 0027 /*VECTORIALMAP, 0028 PICTURE, 0029 NOTES, 0030 CHARACTERSHEET, 0031 SHAREDNOTE, 0032 PDF, 0033 WEBVIEW, 0034 INSTANTMESSAGING, 0035 MINDMAP, 0036 UNKNOWN*/ 0037 ui->m_type->addItem(tr("Shared Notes"), QVariant::fromValue(Core::ContentType::SHAREDNOTE)); 0038 ui->m_type->addItem(tr("Notes"), QVariant::fromValue(Core::ContentType::NOTES)); 0039 ui->m_type->addItem(tr("MindMap"), QVariant::fromValue(Core::ContentType::MINDMAP)); 0040 } 0041 0042 NewFileDialog::~NewFileDialog() 0043 { 0044 delete ui; 0045 } 0046 0047 QString NewFileDialog::name() const 0048 { 0049 return ui->m_nameEdit->text(); 0050 } 0051 0052 QUrl NewFileDialog::url() const 0053 { 0054 return QUrl::fromUserInput(ui->m_path->path()); 0055 } 0056 0057 Core::ContentType NewFileDialog::type() const 0058 { 0059 return ui->m_type->currentData().value<Core::ContentType>(); 0060 } 0061 0062 void NewFileDialog::changeEvent(QEvent* e) 0063 { 0064 QDialog::changeEvent(e); 0065 switch(e->type()) 0066 { 0067 case QEvent::LanguageChange: 0068 ui->retranslateUi(this); 0069 break; 0070 default: 0071 break; 0072 } 0073 }