Commit b93b12c3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove KF5::Completion dependancy

parent 28c0fad2
......@@ -23,7 +23,7 @@
#include <QCheckBox>
#include "messagecore_debug.h"
#include <KComboBox>
#include <QComboBox>
#include <QLineEdit>
#include <qtest.h>
......@@ -72,10 +72,10 @@ void AttachmentPropertiesDialogTest::testAttachmentPartReadWrite()
QLineEdit *descriptionEdit = dialog->findChild<QLineEdit *>(QStringLiteral("description"));
Q_ASSERT(descriptionEdit);
QCOMPARE(descriptionEdit->text(), description);
KComboBox *mimeTypeCombo = dialog->findChild<KComboBox *>(QStringLiteral("mimeType"));
QComboBox *mimeTypeCombo = dialog->findChild<QComboBox *>(QStringLiteral("mimeType"));
Q_ASSERT(mimeTypeCombo);
QCOMPARE(mimeTypeCombo->currentText().toLatin1(), mimeType);
KComboBox *encodingCombo = dialog->findChild<KComboBox *>(QStringLiteral("encoding"));
QComboBox *encodingCombo = dialog->findChild<QComboBox *>(QStringLiteral("encoding"));
Q_ASSERT(encodingCombo);
QCOMPARE(encodingCombo->currentIndex(), int(encoding));
QCheckBox *autoDisplayCheck = dialog->findChild<QCheckBox *>(QStringLiteral("autoDisplay"));
......@@ -92,7 +92,14 @@ void AttachmentPropertiesDialogTest::testAttachmentPartReadWrite()
// Make some changes in the dialog.
nameEdit->setText(newName);
descriptionEdit->setText(newDescription);
mimeTypeCombo->setCurrentItem(QString::fromLatin1(newMimeType), true);
const QString comboBoxMimeType = QString::fromLatin1(newMimeType);
int index = mimeTypeCombo->findText(comboBoxMimeType);
if (index == -1) {
mimeTypeCombo->insertItem(0, comboBoxMimeType);
mimeTypeCombo->setCurrentIndex(0);
} else {
mimeTypeCombo->setCurrentIndex(index);
}
encodingCombo->setCurrentIndex(int(newEncoding));
autoDisplayCheck->setChecked(!autoDisplay);
encryptCheck->setChecked(!encrypt);
......
......@@ -64,7 +64,6 @@ target_link_libraries(KF5MessageCore
KF5::AkonadiMime
KF5::Archive
KF5::ConfigWidgets
KF5::Completion
KF5::IconThemes
Qt5::Network
KF5::I18n
......
......@@ -263,7 +263,14 @@ void AttachmentPropertiesDialog::Private::loadFromPart()
uiReadOnly->description->setText(mPart->description());
uiReadOnly->encoding->setText(KMime::nameForEncoding(mPart->encoding()));
} else {
ui->mimeType->setCurrentItem(QString::fromLatin1(mPart->mimeType()), true);
const QString mimeType = QString::fromLatin1(mPart->mimeType());
const int index = ui->mimeType->findText(mimeType);
if (index == -1) {
ui->mimeType->insertItem(0, mimeType);
ui->mimeType->setCurrentIndex(0);
} else {
ui->mimeType->setCurrentIndex(index);
}
ui->size->setText(KFormat().formatByteSize(mPart->size()));
ui->name->setText(mPart->name().isEmpty() ? mPart->fileName() : mPart->name());
ui->description->setText(mPart->description());
......
......@@ -37,7 +37,7 @@
</layout>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="mimeType">
<widget class="QComboBox" name="mimeType">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -167,7 +167,7 @@
</layout>
</item>
<item row="4" column="1" colspan="2">
<widget class="KComboBox" name="encoding"/>
<widget class="QComboBox" name="encoding"/>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="autoDisplay">
......@@ -207,13 +207,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment