├── README.md ├── xmimewidget.cmake ├── xmimewidget.pri ├── LICENSE ├── xmimewidget.ui ├── dialogmime.ui ├── dialogmime.h ├── xmimewidget.h ├── dialogmime.cpp └── xmimewidget.cpp /README.md: -------------------------------------------------------------------------------- 1 | # XMIMEWidget 2 | 3 | Widget for MIME 4 | -------------------------------------------------------------------------------- /xmimewidget.cmake: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | include(${CMAKE_CURRENT_LIST_DIR}/../XMIME/xmime.cmake) 4 | include(${CMAKE_CURRENT_LIST_DIR}/../XShortcuts/xshortcuts.cmake) 5 | 6 | set(XMIMEWIDGET_SOURCES 7 | ${XMIME_SOURCES} 8 | ${XSHORTCUTS_SOURCES} 9 | ${CMAKE_CURRENT_LIST_DIR}/dialogmime.cpp 10 | ${CMAKE_CURRENT_LIST_DIR}/dialogmime.ui 11 | ${CMAKE_CURRENT_LIST_DIR}/xmimewidget.cpp 12 | ${CMAKE_CURRENT_LIST_DIR}/xmimewidget.ui 13 | ) 14 | -------------------------------------------------------------------------------- /xmimewidget.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | 4 | HEADERS += \ 5 | $$PWD/dialogmime.h \ 6 | $$PWD/xmimewidget.h 7 | 8 | SOURCES += \ 9 | $$PWD/dialogmime.cpp \ 10 | $$PWD/xmimewidget.cpp 11 | 12 | FORMS += \ 13 | $$PWD/dialogmime.ui \ 14 | $$PWD/xmimewidget.ui 15 | 16 | !contains(XCONFIG, xmime) { 17 | XCONFIG += xmime 18 | include($$PWD/../XMIME/xmime.pri) 19 | } 20 | 21 | !contains(XCONFIG, xshortcuts) { 22 | XCONFIG += xshortcuts 23 | include($$PWD/../XShortcuts/xshortcuts.pri) 24 | } 25 | 26 | DISTFILES += \ 27 | $$PWD/LICENSE \ 28 | $$PWD/README.md \ 29 | $$PWD/xmimewidget.cmake 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2025 hors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /xmimewidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | XMIMEWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 462 10 | 294 11 | 12 | 13 | 14 | MIME 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | All 35 | 36 | 37 | 38 | 39 | 40 | 41 | Qt::Horizontal 42 | 43 | 44 | 45 | 40 46 | 20 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | true 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /dialogmime.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogMIME 4 | 5 | 6 | 7 | 0 8 | 0 9 | 510 10 | 182 11 | 12 | 13 | 14 | MIME 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Qt::Horizontal 33 | 34 | 35 | 36 | 40 37 | 20 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Close 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | XMIMEWidget 56 | QWidget 57 |
xmimewidget.h
58 | 1 59 |
60 |
61 | 62 | 63 |
64 | -------------------------------------------------------------------------------- /dialogmime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DIALOGMIME_H 22 | #define DIALOGMIME_H 23 | 24 | #include "xshortcutsdialog.h" 25 | 26 | namespace Ui { 27 | class DialogMIME; 28 | } 29 | 30 | class DialogMIME : public XShortcutsDialog { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit DialogMIME(QWidget *pParent, QIODevice *pDevice); 35 | ~DialogMIME(); 36 | void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 37 | 38 | virtual void adjustView(); 39 | 40 | private slots: 41 | void on_pushButtonClose_clicked(); 42 | 43 | protected: 44 | virtual void registerShortcuts(bool bState); 45 | 46 | private: 47 | Ui::DialogMIME *ui; 48 | }; 49 | 50 | #endif // DIALOGMIME_H 51 | -------------------------------------------------------------------------------- /xmimewidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef XMIMEWIDGET_H 22 | #define XMIMEWIDGET_H 23 | 24 | #include "xshortcutswidget.h" 25 | #include "xmime.h" 26 | 27 | namespace Ui { 28 | class XMIMEWidget; 29 | } 30 | 31 | class XMIMEWidget : public XShortcutsWidget { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit XMIMEWidget(QWidget *pParent = nullptr); 36 | ~XMIMEWidget(); 37 | 38 | virtual void adjustView(); 39 | void setData(QIODevice *pDevice); 40 | virtual void reloadData(bool bSaveSelection); 41 | 42 | private slots: 43 | void on_checkBoxAll_toggled(bool bChecked); 44 | void process(bool bAll); 45 | 46 | protected: 47 | virtual void registerShortcuts(bool bState); 48 | 49 | private: 50 | Ui::XMIMEWidget *ui; 51 | QIODevice *m_pDevice; 52 | }; 53 | 54 | #endif // XMIMEWIDGET_H 55 | -------------------------------------------------------------------------------- /dialogmime.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dialogmime.h" 22 | 23 | #include "ui_dialogmime.h" 24 | 25 | DialogMIME::DialogMIME(QWidget *pParent, QIODevice *pDevice) : XShortcutsDialog(pParent, false), ui(new Ui::DialogMIME) 26 | { 27 | ui->setupUi(this); 28 | 29 | ui->widgetMIME->setData(pDevice); 30 | } 31 | 32 | DialogMIME::~DialogMIME() 33 | { 34 | delete ui; 35 | } 36 | 37 | void DialogMIME::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 38 | { 39 | ui->widgetMIME->setGlobal(pShortcuts, pXOptions); 40 | 41 | XShortcutsDialog::setGlobal(pShortcuts, pXOptions); 42 | } 43 | 44 | void DialogMIME::adjustView() 45 | { 46 | } 47 | 48 | void DialogMIME::on_pushButtonClose_clicked() 49 | { 50 | this->close(); 51 | } 52 | 53 | void DialogMIME::registerShortcuts(bool bState) 54 | { 55 | Q_UNUSED(bState) 56 | // TODO 57 | } 58 | -------------------------------------------------------------------------------- /xmimewidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "xmimewidget.h" 22 | 23 | #include "ui_xmimewidget.h" 24 | 25 | XMIMEWidget::XMIMEWidget(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::XMIMEWidget) 26 | { 27 | ui->setupUi(this); 28 | } 29 | 30 | XMIMEWidget::~XMIMEWidget() 31 | { 32 | delete ui; 33 | } 34 | 35 | void XMIMEWidget::adjustView() 36 | { 37 | // TODO 38 | } 39 | 40 | void XMIMEWidget::setData(QIODevice *pDevice) 41 | { 42 | m_pDevice = pDevice; 43 | 44 | process(ui->checkBoxAll->isChecked()); 45 | } 46 | 47 | void XMIMEWidget::reloadData(bool bSaveSelection) 48 | { 49 | Q_UNUSED(bSaveSelection) 50 | process(ui->checkBoxAll->isChecked()); 51 | } 52 | 53 | void XMIMEWidget::on_checkBoxAll_toggled(bool bChecked) 54 | { 55 | process(bChecked); 56 | } 57 | 58 | void XMIMEWidget::process(bool bAll) 59 | { 60 | QList listTypes = XMIME::getTypes(m_pDevice, bAll); 61 | 62 | ui->plainTextEditMIME->clear(); 63 | 64 | qint32 nNumberOfTypes = listTypes.count(); 65 | 66 | for (qint32 i = 0; i < nNumberOfTypes; i++) { 67 | ui->plainTextEditMIME->appendPlainText(listTypes.at(i)); 68 | } 69 | } 70 | 71 | void XMIMEWidget::registerShortcuts(bool bState) 72 | { 73 | Q_UNUSED(bState) 74 | } 75 | --------------------------------------------------------------------------------