<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/115478/">https://git.reviewboard.kde.org/r/115478/</a>
     </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ship It!</pre>
 <br />









<p>- Kevin Ottens</p>


<br />
<p>On March 9th, 2014, 6:11 p.m. UTC, Dominik Haumann wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Frameworks, Àlex Fiestas and Gregor Mi.</div>
<div>By Dominik Haumann.</div>


<p style="color: grey;"><i>Updated March 9, 2014, 6:11 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
frameworkintegration
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The following QPA integration does not work as expected:

    QStringList nameFilterList = QStringList() << "c (*.cpp)" << "h (*.h)";
    dialog.setNameFilters(nameFilterList);

    QString selectNameFilter("h (*.h)");
    dialog.selectNameFilter(selectNameFilter);
//  QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (1) always fails, no matter what

    dialog.show();
    QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (2) currently also fails, Qt patch required

The problem is described in detail in:
http://mail.kde.org/pipermail/kde-frameworks-devel/2014-February/010691.html


The Qt patches that make (2) work are as follows:

diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index da026d2..72b2310 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -627,7 +627,8 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
     options->setInitialDirectory(directory.exists() ?
                                  QUrl::fromLocalFile(directory.absolutePath()) :
                                  QUrl());
-    options->setInitiallySelectedNameFilter(q->selectedNameFilter());
+    if (options->initiallySelectedNameFilter().isEmpty())
+        options->setInitiallySelectedNameFilter(q->selectedNameFilter());
     if (options->initiallySelectedFiles().isEmpty())
         options->setInitiallySelectedFiles(userSelectedFiles());
 }
@@ -1447,6 +1448,7 @@ void QFileDialog::selectNameFilter(const QString &filter)
 {
     Q_D(QFileDialog);
     if (!d->usingWidgets()) {
+        d->options->setInitiallySelectedNameFilter(filter);
         d->selectNameFilter_sys(filter);
         return;
     }

However, the QCOMPARE in (1) is still an open issue. And no fix in sight...

Ok to commit this to frameworksintegration (and therewith make it unstable?)</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The attached unit test currently fails due to a bug in the Qt QPA.

With the Qt patch above, (2) in the unit test passes, so one is able to call QFileDialog::selectNameFilter().
However, (1) remains broken.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>autotests/CMakeLists.txt <span style="color: grey">(f76ab15)</span></li>

 <li>autotests/kfiledialog_unittest.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/platformtheme/kdeplatformfiledialoghelper.cpp <span style="color: grey">(c82b821)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/115478/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>