Ticket #46496: qt5-concurrent-patches.diff

File qt5-concurrent-patches.diff, 306.8 KB (added by RJVB (René Bertin), 10 years ago)

patch vs. the qt5-mac files currently in MacPorts

  • trunk/dports/_resources/port1.0/group/qt5-1.0.tcl

    diff --git a/trunk/dports/_resources/port1.0/group/qt5-1.0.tcl b/trunk/dports/_resources/port1.0/group/qt5-1.0.tcl
    a b  
    5959    }
    6060}
    6161
     62variant exclusive description {Builds and installs Qt5-mac the older way, such that other Qt versions can NOT be installed alongside it} {}
     63
    6264# standard Qt5 name
    6365global qt_name
    6466set qt_name             qt5
    6567
    6668# standard install directory
    67 global qt_dir
    68 set qt_dir              ${prefix}
    69 
     69    global qt_dir
     70    global qt_dir_rel
    7071# standard Qt documents directory
    71 global qt_docs_dir
    72 set qt_docs_dir         ${qt_dir}/share/doc/${qt_name}
    73 
     72    global qt_docs_dir
    7473# standard Qt plugins directory
    75 global qt_plugins_dir
    76 set qt_plugins_dir      ${qt_dir}/share/${qt_name}/plugins
    77 
     74    global qt_plugins_dir
    7875# standard Qt mkspecs directory
    79 global qt_mkspecs_dir
    80 set qt_mkspecs_dir      ${qt_dir}/share/${qt_name}/mkspecs
    81 
     76    global qt_mkspecs_dir
    8277# standard Qt imports directory
    83 global qt_imports_dir
    84 set qt_imports_dir      ${qt_dir}/share/${qt_name}/imports
    85 
     78    global qt_imports_dir
    8679# standard Qt qml directory
    87 global qt_qml_dir
    88 set qt_qml_dir          ${qt_dir}/share/${qt_name}/qml
    89 
     80    global qt_qml_dir
    9081# standard Qt includes directory
    91 global qt_includes_dir
    92 set qt_includes_dir     ${qt_dir}/include
    93 
     82    global qt_includes_dir
    9483# standard Qt libraries directory
    95 global qt_libs_dir
    96 set qt_libs_dir         ${qt_dir}/lib
    97 
     84    global qt_libs_dir
    9885# standard Qt libraries directory
    99 global qt_frameworks_dir
    100 set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
    101 
     86    global qt_frameworks_dir
     87    global qt_frameworks_dir_rel
    10288# standard Qt non-.app executables directory
    103 global qt_bins_dir
    104 set qt_bins_dir         ${qt_dir}/bin
    105 
    106 # standard Qt .app executables directory, if created
    107 global qt_apps_dir
    108 set qt_apps_dir         ${applications_dir}/Qt5
    109 
     89    global qt_bins_dir
    11090# standard Qt data directory
    111 global qt_data_dir
    112 set qt_data_dir         ${qt_dir}/share/${qt_name}
    113 
     91    global qt_data_dir
    11492# standard Qt translations directory
    115 global qt_translations_dir
    116 set qt_translations_dir ${qt_dir}/share/${qt_name}/translations
    117 
     93    global qt_translations_dir
    11894# standard Qt sysconf directory
    119 global qt_sysconf_dir
    120 set qt_sysconf_dir      ${qt_dir}/etc/${qt_name}
    121 
     95    global qt_sysconf_dir
    12296# standard Qt examples directory
    123 global qt_examples_dir
    124 set qt_examples_dir     ${qt_dir}/share/${qt_name}/examples
    125 
     97    global qt_examples_dir
    12698# standard Qt tests directory
    127 global qt_tests_dir
    128 set qt_tests_dir     ${qt_dir}/share/${qt_name}/tests
    129 
     99    global qt_tests_dir
    130100# standard Qt demos directory
    131 global qt_demos_dir
    132 set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
    133 
     101    global qt_demos_dir
    134102# standard CMake module directory for Qt-related files
    135 global qt_cmake_module_dir
    136 set qt_cmake_module_dir ${qt_libs_dir}/cmake
    137 
     103    global qt_cmake_module_dir
    138104# standard qmake command location
    139 global qt_qmake_cmd
    140 set qt_qmake_cmd        ${qt_dir}/bin/qmake
     105    global qt_qmake_cmd
     106# standard moc command location
     107    global qt_moc_cmd
     108# standard uic command location
     109    global qt_uic_cmd
     110# standard lrelease command location
     111    global qt_lrelease_cmd
    141112
     113global qt5_is_concurrent
     114if {![variant_isset exclusive]} {
     115    # check if we're building qt5 itself
     116    if {![info exists building_qt5] || ![info exists name] || ${name} ne "qt5-mac"} {
     117        # no, this must be a dependent port: check the qt5 install:
     118        if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} {
     119            # we have a "concurrent" install, which means we must look for the various components
     120            # in different locations (esp. qmake)
     121            set qt5_is_concurrent   1
     122            set auto_concurrent     1
     123            ui_msg "NB:\nQt5 has been installed in concurrent mode\n"
     124        }
     125    } else {
     126        # we're building qt5-mac or one of its subports
     127        if {![info exists qt5_is_concurrent]} {
     128            ui_msg "NB:\nQt5 has been or will be installed in concurrent mode\n"
     129        }
     130        # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants
     131        set qt5_is_concurrent   1
     132        set auto_concurrent     1
     133    }
     134}
     135
     136if {[info exists qt5_is_concurrent]} {
     137    set qt_dir              ${prefix}/libexec/${qt_name}
     138    set qt_dir_rel          libexec/${qt_name}
     139    set qt_docs_dir         ${prefix}/share/doc/${qt_name}
     140    set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
     141    set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
     142    set qt_imports_dir      ${prefix}/share/${qt_name}/imports
     143    set qt_qml_dir          ${prefix}/share/${qt_name}/qml
     144    set qt_includes_dir     ${prefix}/include/${qt_name}
     145    set qt_libs_dir         ${qt_dir}/lib
     146    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
     147    set qt_bins_dir         ${qt_dir}/bin
     148    set qt_data_dir         ${prefix}/share/${qt_name}
     149    set qt_translations_dir ${prefix}/share/${qt_name}/translations
     150    set qt_sysconf_dir      ${prefix}/etc/${qt_name}
     151    set qt_examples_dir     ${prefix}/share/${qt_name}/examples
     152    set qt_tests_dir        ${prefix}/share/${qt_name}/tests
     153    set qt_demos_dir        ${prefix}/share/${qt_name}/demos
     154    set qt_cmake_module_dir ${prefix}/lib/cmake
     155    set qt_qmake_cmd        ${qt_dir}/bin/qmake
     156    set qt_moc_cmd          ${qt_dir}/bin/moc
     157    set qt_uic_cmd          ${qt_dir}/bin/uic
     158    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
     159} else {
     160    set qt_dir              ${prefix}
     161    set qt_dir_rel          ""
     162    set qt_docs_dir         ${qt_dir}/share/doc/${qt_name}
     163    set qt_plugins_dir      ${qt_dir}/share/${qt_name}/plugins
     164    set qt_mkspecs_dir      ${qt_dir}/share/${qt_name}/mkspecs
     165    set qt_imports_dir      ${qt_dir}/share/${qt_name}/imports
     166    set qt_qml_dir          ${qt_dir}/share/${qt_name}/qml
     167    set qt_includes_dir     ${qt_dir}/include
     168    set qt_libs_dir         ${qt_dir}/lib
     169    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
     170    set qt_bins_dir         ${qt_dir}/bin
     171    set qt_data_dir         ${qt_dir}/share/${qt_name}
     172    set qt_translations_dir ${qt_dir}/share/${qt_name}/translations
     173    set qt_sysconf_dir      ${qt_dir}/etc/${qt_name}
     174    set qt_examples_dir     ${qt_dir}/share/${qt_name}/examples
     175    set qt_tests_dir        ${qt_dir}/share/${qt_name}/tests
     176    set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
     177    set qt_cmake_module_dir ${qt_libs_dir}/cmake
     178    set qt_qmake_cmd        ${qt_dir}/bin/qmake
     179    set qt_moc_cmd          ${qt_dir}/bin/moc
     180    set qt_uic_cmd          ${qt_dir}/bin/uic
     181    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
     182}
     183set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
     184
     185# standard Qt .app executables directory, if created
     186global qt_apps_dir
     187set qt_apps_dir         ${applications_dir}/Qt5
     188
    142189# standard qmake spec
    143190# configure script prefers clang (but "[a]dvertise[s] g++ as an alternative on Lion and below").
    144191# According to http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations,
     
    162209    set qt_qmake_spec ""
    163210}
    164211
    165 # standard moc command location
    166 global qt_moc_cmd
    167 set qt_moc_cmd          ${qt_dir}/bin/moc
    168 
    169 # standard uic command location
    170 global qt_uic_cmd
    171 set qt_uic_cmd          ${qt_dir}/bin/uic
    172 
    173 # standard lrelease command location
    174 global qt_lrelease_cmd
    175 set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
    176 
    177212# standard PKGCONFIG path
    178213global qt_pkg_config_dir
    179 set qt_pkg_config_dir   ${qt_libs_dir}/pkgconfig
     214set qt_pkg_config_dir   ${prefix}/lib/pkgconfig
    180215
    181216# data used by qmake
    182217global qt_host_data_dir
    183 set qt_host_data_dir   ${qt_dir}/share/${qt_name}
     218set qt_host_data_dir   ${prefix}/share/${qt_name}
    184219
    185220# standard cmake info for Qt5
    186221global qt_cmake_defines
     
    198233        # see if the framework install exists, and if so depend on it;
    199234        # if not, depend on the library version
    200235
    201         if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
    202             depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt5-mac
     236        if {[info exists qt5_is_concurrent]} {
     237            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
     238                depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore.framework/QtCore:qt5-mac
     239            } else {
     240                depends_lib-append path:libexec/${qt_name}/lib/libQtCore.5.dylib:qt5-mac
     241            }
    203242        } else {
    204             depends_lib-append path:lib/libQtCore.5.dylib:qt5-mac
     243            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
     244                depends_lib-append path:Library/Frameworks/QtCore.framework/QtCore:qt5-mac
     245            } else {
     246                depends_lib-append path:lib/libQtCore.5.dylib:qt5-mac
     247            }
    205248        }
    206249    }
    207250}
  • trunk/dports/aqua/qt5-mac/Portfile

    diff --git a/trunk/dports/aqua/qt5-mac/Portfile b/trunk/dports/aqua/qt5-mac/Portfile
    a b  
    11# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    22# $Id$
     3# $Id$
    34
    45PortSystem          1.0
    56
    67name                qt5-mac
    78version             5.3.2
    8 revision            1
    9 set branch          [join [lrange [split ${version} .] 0 1] .]
     9revision            3
    1010
    11 categories          aqua
    12 platforms           macosx
    13 maintainers         mcalhoun openmaintainer
    14 license             {LGPL-2.1 GPL-3}
    15 
    16 homepage            http://qt-project.org
    17 description         Qt Tool Kit
    18 long_description    Qt Tool Kit: A cross-platform framework \
    19     (headers, data, and libraries) for writing \
    20     cross-platform GUI-based applications.
    21 
    22 distname            qt-everywhere-opensource-src-${version}
    23 
    24 master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
    25 
    26 checksums           rmd160  5cd61acc2fbfba2597a386a09d83710ed2fdf483 \
    27                     sha256  c8d3fd2ead30705c6673c5e4af6c6f3973346b4fb2bd6079c7be0943a5b0282d
    28 
    29 if { ${os.major} < 10 } {
    30     pre-fetch {
    31         ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
    32         ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested."
    33         ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
    34         return -code error "unsupported OS"
    35     }
    36 } elseif { ${os.major} == 10 } {
    37     pre-fetch {
    38         ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
    39         if { [variant_isset universal] } {
    40             ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
    41             ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
    42         } else {
    43             if { ${build_arch} eq "i386" } {
    44                 ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"."
    45                 ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
    46             } else {
    47                 ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
    48                 ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
    49             }
    50         }
    51         ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
    52     }
    53 } elseif { ${os.major} > 13 } {
    54     pre-fetch {
    55         ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt."
    56         ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
    57     }
    58 } else {
    59     # 11 <= ${os.major} <= 13
    60     if { [variant_isset universal] } {
    61         pre-fetch {
    62             ui_warn "Multiple architectures is not a Reference Configuration for Qt."
    63             ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
    64         }
    65     } else {
    66         if { ${build_arch} eq "i386" } {
    67             pre-fetch {
    68                 ui_warn "32-bit mode is not a Reference Configuration for Qt."
    69                 ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
    70             }
    71         }
    72     }
     11if {[catch {source "${portpath}/Portfile.qt5"} err]} {
     12    puts stderr "Error reading Portfile.qt5: $err"
     13    return 1;
    7314}
    74 
    75 if { ${subport} eq "${name}-docs"  } {
    76     universal_variant no
    77 }
    78 
    79 if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } {
    80     # use the qt5 group; set 'building_qt5' so that the portgroup
    81     # does not include certain parts
    82     set building_qt5    1
    83     PortGroup           conflicts_build 1.0
    84     PortGroup           qt5 1.0
    85     PortGroup           xcodeversion 1.0
    86 
    87     conflicts           qt3 qt3-mac qt4-mac
    88 
    89     minimum_xcodeversions   {10 3.2}
    90 
    91     # See https://bugreports.qt-project.org/browse/QTBUG-34902
    92     conflicts_build-append  qt4-mac
    93 
    94     # Kuba states in https://trac.macports.org/ticket/44207#comment:7
    95     #  "There's no reason to have parallel building disabled. Really."
    96     #use_parallel_build no
    97 
    98     # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)"
    99     #     code from header is used only "ifdef Q_OF_MACH_O"
    100     #     the two must be consistent
    101     #     assume the header include code is correct
    102     patchfiles-append patch-tst_qpluginloader.diff
    103 
    104     # When testing, ensure that a universal object file is not inadvertently created.
    105     patchfiles-append patch-machtest.diff
    106 
    107     # On testing of 32-bit systems,
    108     #  Pre-patch: QCOMPARE(unsigned long const&, unsigned int const&
    109     # Post-patch: QCOMPARE(unsigned int  const&, unsigned int const&
    110     # Function template is only instantiated for same first and second arguments.
    111     patchfiles-append patch-tst_qarraydata.diff
    112 
    113     # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm
    114     patchfiles-append patch-tst_benchlibcallgrind.diff
    115 
    116     # During testing, NSStringFromRect requires NSRect.
    117     patchfiles-append patch-tst_qaccessibilitymac_helpers.diff
    118 
    119     # see #44934 (and #35067 for the qt4-mac version)
    120     patchfiles-append patch-shared.diff
    121 
    122     # see https://bugreports.qt-project.org/browse/QTBUG-41136
    123     patchfiles-append patch-avfmediaplayersession.diff
    124 
    125     # see https://bugreports.qt-project.org/browse/QTBUG-41367
    126     patchfiles-append patch-qmacstyle_mac.diff
    127 
    128     # --prefix is not recognized.
    129     configure.pre_args-delete       --prefix=${prefix}
    130 
    131     # --disable-dependency-tracking is not recognized.
    132     configure.universal_args-delete --disable-dependency-tracking
    133 
    134     if {${configure.sdkroot} ne ""} {
    135         configure.args-append \
    136             -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
    137     }
    138 
    139     configure.args-append                      \
    140         -prefix         ${qt_dir}              \
    141         -docdir         ${qt_docs_dir}         \
    142         -headerdir      ${qt_includes_dir}     \
    143         -plugindir      ${qt_plugins_dir}      \
    144         -importdir      ${qt_imports_dir}      \
    145         -qmldir         ${qt_qml_dir}          \
    146         -datadir        ${qt_data_dir}         \
    147         -libdir         ${qt_frameworks_dir}   \
    148         -bindir         ${qt_bins_dir}         \
    149         -translationdir ${qt_translations_dir} \
    150         -sysconfdir     ${qt_sysconf_dir}      \
    151         -examplesdir    ${qt_examples_dir}     \
    152         -testsdir       ${qt_tests_dir}        \
    153         -hostdatadir    ${qt_host_data_dir}
    154 
    155     # Configure options:
    156     configure.args-append \
    157         -release          \
    158         -opensource       \
    159         -confirm-license  \
    160         -shared           \
    161         -process
    162 
    163     # Third Party Libraries:
    164     configure.args-append \
    165         -no-mtdev         \
    166         -no-harfbuzz      \
    167         -openssl-linked   \
    168         -no-xinput2       \
    169         -no-xcb-xlib
    170 
    171     # configure options that don't show up in configure --help
    172     configure.args-append \
    173         -no-libudev       \
    174         -no-egl
    175 
    176     # Additional options:
    177     configure.args-append    \
    178         {-make libs}         \
    179         {-make tools}        \
    180         {-nomake examples}   \
    181         {-nomake tests}      \
    182         -verbose             \
    183         -no-optimized-qmake  \
    184         -nis                 \
    185         -cups                \
    186         -iconv               \
    187         -no-evdev            \
    188         -icu                 \
    189         -fontconfig          \
    190         -strip               \
    191         -no-pch              \
    192         -dbus-linked         \
    193         -no-xcb              \
    194         -glib                \
    195         -directfb            \
    196         -no-linuxfb          \
    197         -no-kms              \
    198         -no-system-proxies   \
    199         -framework
    200 
    201     foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
    202         configure.args-append -no-sql-${driver}
    203     }
    204 
    205     if { ![variant_isset universal] } {
    206         configure.args-append "-platform ${qt_qmake_spec}"
    207     } else {
    208         set merger_configure_args(i386)   "-platform ${qt_qmake_spec_32}"
    209         set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}"
    210     }
    211 
    212     # configure options that don't show up in configure --help
    213     configure.args-append \
    214         -no-openvg
    215 
    216     # Qt builds part of the system using environment provided my MacPorts.
    217     # It builds the rest using its own internal environment.
    218     # For consistency, clear MacPorts environment.
    219     configure.cxx_stdlib
    220     configure.sdkroot
    221     configure.cc_archflags
    222     configure.cxx_archflags
    223     configure.objc_archflags
    224     configure.objcxx_archflags
    225     configure.ld_archflags
    226     configure.cppflags
    227     configure.cflags
    228     configure.cxxflags
    229     configure.objcflags
    230     configure.objcxxflags
    231     configure.ldflags
    232     configure.pipe  no
    233     if { [variant_isset universal] } {
    234         set merger_arch_flag no
    235     }
    236     configure.march
    237     configure.mtune
    238     configure.universal_ldflags
    239     configure.universal_cflags
    240     configure.universal_cxxflags
    241     configure.universal_cppflags
    242 }
    243 
    244 if { ${subport} eq ${name} } {
    245     depends_lib                              \
    246         port:zlib                            \
    247         port:libpng                          \
    248         port:jpeg                            \
    249         port:freetype                        \
    250         path:bin/dbus-daemon:dbus            \
    251         port:openssl                         \
    252         port:tiff                            \
    253         port:libmng                          \
    254         path:lib/pkgconfig/glib-2.0.pc:glib2 \
    255         port:icu                             \
    256         port:pcre                            \
    257         port:libiconv
    258 
    259     # see https://bugreports.qt-project.org/browse/QTBUG-35514
    260     build.target
    261 
    262     if { [variant_isset universal] } {
    263         merger-post-destroot {
    264             foreach arch ${universal_archs_to_use} {
    265                 set dir ${destroot}-${arch}
    266 
    267                 reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc
    268 
    269                 foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
    270                     reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
    271                 }
    272 
    273                 foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] {
    274                     reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
    275                 }
    276 
    277                 foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
    278                     reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
    279                 }
    280 
    281                 reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
    282 
    283                 reinplace \
    284                     "s|^set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang.*\")$|set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang-32\" \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang\")|" \
    285                     ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
    286             }
    287         }
    288 
    289         post-destroot {
    290             # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64
    291             reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri
    292             reinplace "/^#else.*$/d"   ${destroot}${qt_mkspecs_dir}/qmodule.pri
    293             reinplace "/^#endif.*$/d"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
    294         }
    295 
    296         # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged
    297         # The solution is ???.
    298     }
    299 
    300     post-destroot {
    301 
    302         # see #44204
    303         foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
    304             set framework [file rootname [file tail ${f}]]
    305             set incname   [string map {Qt5 Qt} ${framework}]
    306             reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f}
    307             reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f}
    308         }
    309 
    310         # move items out of the Frameworks directory that are more appropriate to lib directory
    311         xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
    312         foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
    313             xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
    314             foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
    315                 # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
    316                 # ${qt_libs_dir}       is  ${qt_dir}/lib
    317                 # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
    318                 reinplace "s|/../../../../|/../../../|g" ${f}
    319                 file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
    320             }
    321         }
    322         xinstall -m 775 -d ${destroot}${qt_pkg_config_dir}
    323         foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
    324             file rename ${f} ${destroot}${qt_pkg_config_dir}
    325         }
    326         xinstall -m 775 -d ${destroot}${qt_libs_dir}/
    327         foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
    328             file rename ${f} ${destroot}${qt_libs_dir}/
    329         }
    330 
    331         # move items out of the bin directory that are more appropriate to the Applications directory
    332         xinstall -m 775 -d ${destroot}${qt_apps_dir}
    333         foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] {
    334             file rename ${f} ${destroot}${qt_apps_dir}/
    335         }
    336     }
    337 
    338     variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} {
    339         depends_lib-append port:harfbuzz
    340         configure.args-replace \
    341             -no-harfbuzz       \
    342             -system-harfbuzz
    343     }
    344 
    345     variant tests description {Enable tests} {
    346         configure.args-replace {-nomake tests} {-make tests}
    347     }
    348 
    349     variant examples description {Build examples} {
    350         configure.args-replace {-nomake examples} {-make examples}
    351     }
    352 
    353     variant debug description {Build both release and debug library} {
    354         configure.args-replace -release -debug-and-release
    355     }
    356 }
    357 
    358 subport ${name}-docs {
    359     depends_lib-append \
    360         path:${prefix}/bin/qdoc:${name} \
    361         path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin
    362 
    363     supported_archs   noarch
    364 
    365     build.target      docs
    366     destroot.target   install_docs
    367 
    368     post-extract {
    369         # For the most part, generated makefiles use ${prefix}/bin/qdoc.
    370         # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/.
    371         ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/
    372         ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin
    373 
    374         # Similarly, location of qhelpgenerator is expected in ${worksrcpath}
    375         xinstall -d -m 755 ${worksrcpath}/qttools/bin/
    376         ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/
    377 
    378         # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target
    379         #    keeps generating itself over and over again.
    380         # This file is only created when the library is being built, however.
    381         xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated
    382         touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc
    383     }
    384 }
    385 
    386 # See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers
    387 
    388 subport ${name}-sqlite3-plugin {
    389     PortGroup           qmake5 1.0
    390 
    391     depends_lib-append port:sqlite3
    392 
    393     # for single architecture, easier to use
    394     #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite,
    395     #    but doesn't work for universal build
    396     configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite
    397     build.dir     ${configure.dir}
    398     destroot.dir  ${configure.dir}
    399 
    400     configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\""
    401 }
    402 
    403 subport ${name}-psql84-plugin {
    404     PortGroup           qmake5 1.0
    405 
    406     depends_lib-append port:postgresql84
    407 
    408     # for single architecture, easier to use
    409     #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql,
    410     #    but doesn't work for universal build
    411     configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql
    412     build.dir     ${configure.dir}
    413     destroot.dir  ${configure.dir}
    414 
    415     configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\""
    416 }
    417 
    418 subport ${name}-mysql56-plugin {
    419     PortGroup           qmake5 1.0
    420 
    421     depends_lib-append port:mysql56
    422 
    423     # for single architecture, easier to use
    424     #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql,
    425     #    but doesn't work for universal build
    426     configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql
    427     build.dir     ${configure.dir}
    428     destroot.dir  ${configure.dir}
    429 
    430     configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\""
    431 }
    432 
    433 livecheck.type      regex
    434 livecheck.url       http://qt-project.org/downloads
    435 livecheck.regex     "Qt (5(?:\\.\\d+)*) for Mac"
  • new file trunk/dports/aqua/qt5-mac/Portfile.qt5

    diff --git a/trunk/dports/aqua/qt5-mac/Portfile.qt5 b/trunk/dports/aqua/qt5-mac/Portfile.qt5
    new file mode 10644
    - +  
     1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
     2# $Id: port=qt5 1 2014-12-08 18:51:13Z rjvbertin@gmail.com, mcalhoun@macports.org $
     3
     4# set building_qt5 immediately!
     5set building_qt5    1
     6
     7PortGroup           qt5 1.0
     8set branch          [join [lrange [split ${version} .] 0 1] .]
     9
     10categories          aqua
     11platforms           macosx
     12maintainers         mcalhoun openmaintainer
     13license             {LGPL-2.1 GPL-3}
     14
     15homepage            http://qt-project.org
     16description         Qt Tool Kit 5.3
     17long_description    Qt Tool Kit: A cross-platform framework \
     18                    (headers, data, and libraries) for writing \
     19                    cross-platform GUI-based applications. \
     20                    Installs to ${qt_dir}
     21
     22distname            qt-everywhere-opensource-src-${version}
     23
     24master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
     25
     26checksums           rmd160  5cd61acc2fbfba2597a386a09d83710ed2fdf483 \
     27                    sha256  c8d3fd2ead30705c6673c5e4af6c6f3973346b4fb2bd6079c7be0943a5b0282d
     28
     29if { ${os.major} < 10 } {
     30    pre-fetch {
     31        ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
     32        ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested."
     33        ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
     34        return -code error "unsupported OS"
     35    }
     36} elseif { ${os.major} == 10 } {
     37    pre-fetch {
     38        ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
     39        if { [variant_isset universal] } {
     40            ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
     41            ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
     42        } else {
     43            if { ${build_arch} eq "i386" } {
     44                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"."
     45                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
     46            } else {
     47                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
     48                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
     49            }
     50        }
     51        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
     52    }
     53} elseif { ${os.major} > 13 } {
     54    pre-fetch {
     55        ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt."
     56        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
     57    }
     58} else {
     59    # 11 <= ${os.major} <= 13
     60    if { [variant_isset universal] } {
     61        pre-fetch {
     62            ui_warn "Multiple architectures is not a Reference Configuration for Qt."
     63            ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
     64        }
     65    } else {
     66        if { ${build_arch} eq "i386" } {
     67            pre-fetch {
     68                ui_warn "32-bit mode is not a Reference Configuration for Qt."
     69                ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
     70            }
     71        }
     72    }
     73}
     74
     75if { ${subport} eq "${name}-docs"  } {
     76    universal_variant no
     77}
     78
     79if {[info exists env(QTDIR)]} {
     80    ui_msg "unsetting \$QTDIR"
     81    unset env(QTDIR)
     82}
     83
     84if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } {
     85    # use the qt5 group; set 'building_qt5' so that the portgroup
     86    # does not include certain parts
     87    PortGroup           conflicts_build 1.0
     88    conflicts           qt3 qt3-mac
     89    PortGroup           xcodeversion 1.0
     90
     91
     92    minimum_xcodeversions   {10 3.2}
     93
     94    if {[variant_isset exclusive]} {
     95        conflicts-append        qt4-mac
     96        # See https://bugreports.qt-project.org/browse/QTBUG-34902
     97        conflicts_build-append  qt4-mac
     98    }
     99    # else: the concurrent qt5-mac version ought to be able to co-exist with any qt4-mac version.
     100
     101    # Kuba states in https://trac.macports.org/ticket/44207#comment:7
     102    #  "There's no reason to have parallel building disabled. Really."
     103    #use_parallel_build no
     104
     105    # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)"
     106    #     code from header is used only "ifdef Q_OF_MACH_O"
     107    #     the two must be consistent
     108    #     assume the header include code is correct
     109    patchfiles-append patch-tst_qpluginloader.diff
     110
     111    # When testing, ensure that a universal object file is not inadvertently created.
     112    patchfiles-append patch-machtest.diff
     113
     114    # On testing of 32-bit systems,
     115    #  Pre-patch: QCOMPARE(unsigned long const&, unsigned int const&
     116    # Post-patch: QCOMPARE(unsigned int  const&, unsigned int const&
     117    # Function template is only instantiated for same first and second arguments.
     118    patchfiles-append patch-tst_qarraydata.diff
     119
     120    # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm
     121    patchfiles-append patch-tst_benchlibcallgrind.diff
     122
     123    # During testing, NSStringFromRect requires NSRect.
     124    patchfiles-append patch-tst_qaccessibilitymac_helpers.diff
     125
     126    # see #44934 (and #35067 for the qt4-mac version)
     127    patchfiles-append patch-shared.diff
     128
     129    # see https://bugreports.qt-project.org/browse/QTBUG-41136
     130    patchfiles-append patch-avfmediaplayersession.diff
     131
     132    # see https://bugreports.qt-project.org/browse/QTBUG-41367
     133    patchfiles-append patch-qmacstyle_mac.diff
     134
     135    # avoid leaving zombies when starting an inexisting executable through QProcess
     136    patchfiles-append qprocess-nozombies.patch
     137
     138    # add (prepend) ${prefix}/share to the standard search paths so they become XDG-compliant
     139    patchfiles-append fix-qstandardpaths.patch
     140
     141    variant KDE description {Include a number of patches tailoring Qt5 for use with KDE, and enable useful backtraces into Qt code for debugging} {
     142        patchfiles-append       correct-systraymenu-iconhandling.patch \
     143                                deactivate-menurole-heuristics.patch \
     144                                debug-negative-qtimerint.patch
     145        configure.args-append   -force-debug-info -no-strip -no-separate-debug-info
     146    }
     147
     148    # patches from Ubuntu 5.3.2+dfsg-4ubuntu8 (from Vivid Velvet)
     149    # TODO : check Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch and Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch
     150    # for relevance for qstandard_mac.?
     151    patchfiles-append           remove_icon_from_example.patch \
     152                                gnukfreebsd.diff \
     153                                fix_bug_in_internal_comparison_operator.patch \
     154                                fix_sparc_atomics.patch \
     155                                remove_google_adsense.patch \
     156                                load_testability_from_env_var.patch \
     157                                Add-workaround-for-GL-on-Android-emulator.patch \
     158                                dbus_correct_signal_name_disconnect.patch \
     159                                Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch \
     160                                Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch \
     161                                Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch \
     162                                disable-generic-plugin-when-others-available.patch \
     163                                update-QtBearer-NetworkManager-backend-API.patch \
     164                                Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch \
     165                                Use-a-property-cache-to-cut-down-on-blocking-calls.patch \
     166                                QtBearer-networkmanager-make-sure-to-set-flag-Active.patch \
     167                                Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch \
     168                                QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch \
     169                                Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch \
     170                                Break-after-handling-the-read-write.patch
     171
     172    # --prefix is not recognised.
     173    configure.pre_args-delete       --prefix=${prefix}
     174
     175    # --disable-dependency-tracking is not recognised.
     176    configure.universal_args-delete --disable-dependency-tracking
     177
     178    if {${configure.sdkroot} ne ""} {
     179        configure.args-append \
     180            -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
     181    }
     182
     183    # NB: -prefix->${prefix} !
     184    configure.args-append                      \
     185        -prefix         ${prefix}              \
     186        -archdatadir    ${qt_dir}              \
     187        -docdir         ${qt_docs_dir}         \
     188        -headerdir      ${qt_includes_dir}     \
     189        -plugindir      ${qt_plugins_dir}      \
     190        -importdir      ${qt_imports_dir}      \
     191        -qmldir         ${qt_qml_dir}          \
     192        -datadir        ${qt_data_dir}         \
     193        -libdir         ${qt_frameworks_dir}   \
     194        -bindir         ${qt_bins_dir}         \
     195        -libexecdir     ${qt_dir}/libexec      \
     196        -translationdir ${qt_translations_dir} \
     197        -sysconfdir     ${qt_sysconf_dir}      \
     198        -examplesdir    ${qt_examples_dir}     \
     199        -testsdir       ${qt_tests_dir}        \
     200        -hostbindir     ${qt_bins_dir}         \
     201        -hostlibdir     ${qt_frameworks_dir}   \
     202        -hostdatadir    ${qt_host_data_dir}
     203
     204    # Configure options:
     205    configure.args-append \
     206        -v                \
     207        -release          \
     208        -opensource       \
     209        -confirm-license  \
     210        -shared           \
     211        -process
     212
     213    # Third Party Libraries:
     214    configure.args-append \
     215        -no-mtdev         \
     216        -no-harfbuzz      \
     217        -openssl-linked   \
     218        -no-xinput2       \
     219        -no-xcb-xlib
     220
     221    # configure options that don't show up in configure --help
     222    configure.args-append \
     223        -no-libudev       \
     224        -no-egl
     225
     226    # Additional options:
     227    configure.args-append    \
     228        {-make libs}         \
     229        {-make tools}        \
     230        {-nomake examples}   \
     231        {-nomake tests}      \
     232        -verbose             \
     233        -nis                 \
     234        -cups                \
     235        -iconv               \
     236        -no-evdev            \
     237        -icu                 \
     238        -fontconfig          \
     239        -no-pch              \
     240        -dbus-linked         \
     241        -no-xcb              \
     242        -glib                \
     243        -directfb            \
     244        -no-linuxfb          \
     245        -no-kms              \
     246        -framework
     247
     248    if {[variant_isset exclusive]} {
     249        configure.args-append   -no-optimized-qmake
     250    } else {
     251        configure.args-append   -optimized-qmake
     252    }
     253
     254    foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
     255        configure.args-append -no-sql-${driver}
     256    }
     257
     258    if { ![variant_isset universal] } {
     259        configure.args-append "-platform ${qt_qmake_spec}"
     260    } else {
     261        set merger_configure_args(i386)   "-platform ${qt_qmake_spec_32}"
     262        set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}"
     263    }
     264
     265    # configure options that don't show up in configure --help
     266    # openvg makes sense only when using X11 ...
     267    configure.args-append -no-openvg
     268
     269    # Qt builds part of the system using environment provided by MacPorts.
     270    # It builds the rest using its own internal environment.
     271    # For consistency, clear MacPorts environment.
     272    configure.cxx_stdlib
     273    configure.sdkroot
     274    configure.cc_archflags
     275    configure.cxx_archflags
     276    configure.objc_archflags
     277    configure.objcxx_archflags
     278    configure.ld_archflags
     279    configure.cppflags
     280    if {[variant_isset exclusive]} {
     281        configure.cflags
     282        configure.cxxflags
     283        configure.objcflags
     284        configure.objcxxflags
     285        configure.ldflags
     286    } else {
     287        configure.objcflags-append  "-g"
     288        configure.objcxxflags-append  "-g"
     289    }
     290    configure.pipe  no
     291    if { [variant_isset universal] } {
     292        set merger_arch_flag no
     293    }
     294    configure.march
     295    configure.mtune
     296    configure.universal_ldflags
     297    configure.universal_cflags
     298    configure.universal_cxxflags
     299    configure.universal_cppflags
     300}
     301
     302if { ${subport} eq ${name} } {
     303    depends_lib                              \
     304        port:zlib                            \
     305        port:libpng                          \
     306        port:jpeg                            \
     307        port:freetype                        \
     308        path:bin/dbus-daemon:dbus            \
     309        port:openssl                         \
     310        port:tiff                            \
     311        port:libmng                          \
     312        path:lib/pkgconfig/glib-2.0.pc:glib2 \
     313        port:icu                             \
     314        port:pcre                            \
     315        port:libiconv
     316
     317    # see https://bugreports.qt-project.org/browse/QTBUG-35514
     318    build.target
     319
     320    post-patch {
     321        #reinplace "s|//opt//local//|${prefix}/|g" ${worksrcpath}/qtbase/src/corelib/io/qstandardpaths_mac.cpp
     322    }
     323
     324    if { [variant_isset universal] } {
     325        merger-post-destroot {
     326            foreach arch ${universal_archs_to_use} {
     327                set dir ${destroot}-${arch}
     328
     329                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc
     330
     331                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
     332                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
     333                }
     334
     335                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] {
     336                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
     337                }
     338
     339                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
     340                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
     341                }
     342
     343                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
     344
     345                reinplace \
     346                    "s|^set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang.*\")$|set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang-32\" \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang\")|" \
     347                    ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
     348            }
     349        }
     350
     351        post-destroot {
     352            # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64
     353            reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri
     354            reinplace "/^#else.*$/d"   ${destroot}${qt_mkspecs_dir}/qmodule.pri
     355            reinplace "/^#endif.*$/d"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
     356        }
     357
     358        # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged
     359        # The solution is ???.
     360    }
     361
     362    post-destroot {
     363
     364        # see #44204
     365        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
     366            set framework [file rootname [file tail ${f}]]
     367            set incname   [string map {Qt5 Qt} ${framework}]
     368            reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f}
     369            reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f}
     370        }
     371
     372        # move items out of the Frameworks directory that are more appropriate to lib directory
     373        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
     374        foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
     375            xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
     376            foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
     377                # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
     378                # ${qt_libs_dir}       is  ${qt_dir}/lib
     379                # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
     380                reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f}
     381                file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
     382            }
     383        }
     384
     385        if {![variant_isset exclusive]} {
     386            # get Qt's version numbers
     387
     388            set qt_vers [split ${version} "."]
     389            set qt_major [lindex ${qt_vers} 0]
     390            set qt_minor [lindex ${qt_vers} 1]
     391            set qt_patch [lindex ${qt_vers} 2]
     392
     393            # link includes and libraries for each actual installed framework
     394
     395            # make sure that the target directories exist
     396            exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_dir}
     397            foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
     398                                 -name "*.framework" | \
     399                                 sed -e "s@${destroot}@@g"] {
     400
     401                set tf_full [strsed ${fixfile} {s@\\.framework@@}]
     402                set tf [strsed ${tf_full} {g@.*\/@@}]
     403
     404                # special for QtWebKit entries
     405
     406                set t_minor ${qt_minor}
     407                set is_QtWebKit 0
     408                if {[string compare ${tf} QtWebKit] == 0} {
     409                    set t_minor 9
     410                    set is_QtWebKit 1
     411                }
     412
     413                # link headers into ${qt_includes_dir}, removing directories
     414                # if they are already there first
     415
     416                set inc_file ${destroot}${qt_includes_dir}/${tf}
     417                if {[file exists ${inc_file}]} {
     418                    file delete -force ${inc_file}
     419                }
     420                ln -s ${tf_full}.framework/Headers ${inc_file}
     421
     422                # link libraries into ${qt_libs_dir}, all 4 number variants
     423
     424                set dr_qt_libs_dir ${destroot}${qt_libs_dir}
     425
     426                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
     427                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
     428                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
     429                ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
     430
     431                # copy .prl file, then correct it for library usage
     432
     433                copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
     434
     435                # fix TARGET in .prl file
     436
     437                reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
     438
     439                # fix PRL_LIBS -F -> -L in .prl file
     440
     441                reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
     442
     443                # fix "-framework Qt*" -> "-lQt*" in .prl file
     444
     445                reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
     446                    ${dr_qt_libs_dir}/lib${tf}.prl
     447
     448                # remove the QMAKE_PRL_BUILD_DIR line from the .prl file
     449                reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl
     450
     451                # deal with debug files
     452
     453                # RJVB: I have *not* tested the block below!
     454                if {[variant_isset debug]} {
     455
     456                    # but not if QtWebKit and +universal, since that one does
     457                    # not exist (the 32-bit version of the debug library is
     458                    # larger than fits into the 32-bit filespace).
     459
     460                    if {[variant_isset debug] && ${is_QtWebKit}} {
     461                        continue
     462                    }
     463
     464                    # link libraries into ${qt_libs_dir}, all 4 number variants
     465
     466                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
     467                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
     468                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
     469                    ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
     470
     471                    # copy .prl file, then correct it for library usage
     472
     473                    copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
     474
     475                    # fix TARGET in .prl file
     476
     477                    reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     478
     479                    # fix PRL_LIBS -F -> -L in .prl file
     480
     481                    reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     482
     483                    # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
     484
     485                    reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
     486                }
     487            }
     488
     489            ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake-qt${qt_major}
     490            ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc-qt${qt_major}
     491            ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic-qt${qt_major}
     492            ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease-qt${qt_major}
     493        }
     494
     495        xinstall -m 775 -d ${destroot}${qt_pkg_config_dir}
     496        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
     497            file rename ${f} ${destroot}${qt_pkg_config_dir}
     498        }
     499        xinstall -m 775 -d ${destroot}${qt_libs_dir}/
     500        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
     501            file rename ${f} ${destroot}${qt_libs_dir}/
     502        }
     503
     504        # move items out of the bin directory that are more appropriate to the Applications directory
     505        xinstall -m 775 -d ${destroot}${qt_apps_dir}
     506        foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] {
     507            file rename ${f} ${destroot}${qt_apps_dir}/
     508        }
     509
     510        if {[variant_isset KDE]} {
     511            # expose KF5 styles to Qt5 ... once we know where those styles are stored and if it's still required.
     512            #ln -s ${prefix}/lib/kf5??/plugins/styles ${destroot}${qt_plugins_dir}/
     513        }
     514    }
     515
     516    variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} {
     517        depends_lib-append port:harfbuzz
     518        configure.args-replace \
     519            -no-harfbuzz       \
     520            -system-harfbuzz
     521    }
     522
     523    variant tests description {Enable tests} {
     524        configure.args-replace {-nomake tests} {-make tests}
     525    }
     526
     527    variant examples description {Build examples} {
     528        configure.args-replace {-nomake examples} {-make examples}
     529    }
     530
     531    variant debug description {Build both release and debug library} {
     532        configure.args-replace -release -debug-and-release
     533    }
     534}
     535
     536subport ${name}-docs {
     537    depends_lib-append \
     538        path:${prefix}/bin/qdoc:${name} \
     539        path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin
     540
     541    supported_archs   noarch
     542
     543    build.target      docs
     544    destroot.target   install_docs
     545
     546    post-extract {
     547        # For the most part, generated makefiles use ${prefix}/bin/qdoc.
     548        # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/.
     549        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/
     550        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin
     551
     552        # Similarly, location of qhelpgenerator is expected in ${worksrcpath}
     553        xinstall -d -m 755 ${worksrcpath}/qttools/bin/
     554        ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/
     555
     556        # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target
     557        #    keeps generating itself over and over again.
     558        # This file is only created when the library is being built, however.
     559        xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated
     560        touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc
     561    }
     562}
     563
     564# See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers
     565
     566subport ${name}-sqlite3-plugin {
     567    PortGroup           qmake5 1.0
     568
     569    depends_lib-append port:sqlite3
     570
     571    # for single architecture, easier to use
     572    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite,
     573    #    but doesn't work for universal build
     574    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite
     575    build.dir     ${configure.dir}
     576    destroot.dir  ${configure.dir}
     577
     578    configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\""
     579}
     580
     581subport ${name}-psql84-plugin {
     582    PortGroup           qmake5 1.0
     583
     584    depends_lib-append port:postgresql84
     585
     586    # for single architecture, easier to use
     587    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql,
     588    #    but doesn't work for universal build
     589    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql
     590    build.dir     ${configure.dir}
     591    destroot.dir  ${configure.dir}
     592
     593    configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\""
     594}
     595
     596subport ${name}-mysql56-plugin {
     597    PortGroup           qmake5 1.0
     598
     599    depends_lib-append port:mysql56
     600
     601    # for single architecture, easier to use
     602    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql,
     603    #    but doesn't work for universal build
     604    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql
     605    build.dir     ${configure.dir}
     606    destroot.dir  ${configure.dir}
     607
     608    configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\""
     609}
     610
     611livecheck.type      regex
     612livecheck.url       http://download.qt.io/archive/qt/5.4/
     613livecheck.regex     (\\d+(\\.\\d+)+)
  • new file trunk/dports/aqua/qt5-mac/files/Add-workaround-for-GL-on-Android-emulator.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Add-workaround-for-GL-on-Android-emulator.patch b/trunk/dports/aqua/qt5-mac/files/Add-workaround-for-GL-on-Android-emulator.patch
    new file mode 10644
    - +  
     1From cbf649ff92e7d3416cb9d03609648f96efdf76dd Mon Sep 17 00:00:00 2001
     2From: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
     3Date: Mon, 17 Mar 2014 19:43:41 -0300
     4Subject: [PATCH] Add workaround for GL on Android emulator
     5
     6On the Android Emulator, the shaders will be compiled by a desktop
     7GL driver, since the GL driver in the emulator is just a thin
     8wrapper. The GL driver does not necessarily support the precision
     9qualifiers, which can cause applications to break. We detect this
     10at runtime in the platform plugin and set a workaround flag to
     11
     12Upstream (9eeb1bd) just enabled the workaround when the android
     13backend is used, which is not true in our case (traditional desktop).
     14As a consequence, we also need a similar check in order to have
     15a functional Ubuntu Touch emulator.
     16
     17Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
     18---
     19 src/gui/kernel/qopenglcontext.cpp | 5 +++++
     20 1 file changed, 5 insertions(+)
     21
     22--- qtbase/src/gui/kernel/qopenglcontext.cpp
     23+++ qtbase/src/gui/kernel/qopenglcontext.cpp
     24@@ -815,6 +815,11 @@
     25 
     26         d->shareGroup->d_func()->deletePendingResources(this);
     27 
     28+        const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
     29+        if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) {
     30+            QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(this);
     31+            ctx_d->workaround_missingPrecisionQualifiers = true;
     32+        }
     33 #ifndef QT_NO_DEBUG
     34         QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true);
     35 #endif
  • new file trunk/dports/aqua/qt5-mac/files/Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch b/trunk/dports/aqua/qt5-mac/files/Always-lock-the-DBus-dispatcher-before-dbus_connecti.patch
    new file mode 10644
    - +  
     1From 6a2bdc4ee2dc49b5d89d09a1f255a7a0e2f18acf Mon Sep 17 00:00:00 2001
     2From: Thiago Macieira <thiago.macieira@intel.com>
     3Date: Tue, 28 Oct 2014 17:23:09 -0700
     4Subject: [PATCH 1/3] Always lock the DBus dispatcher before
     5 dbus_connection_send*
     6MIME-Version: 1.0
     7Content-Type: text/plain; charset=UTF-8
     8Content-Transfer-Encoding: 8bit
     9
     10We lock it before dbus_connection_send_with_reply (the async version) in
     11QDBusConnectionPrivate::sendWithReplyAsync. We weren't locking it before
     12send_with_reply_and_block and we apparently should. The locking around
     13the dbus_connection_send function might not be necessary, but let's do
     14it to be safe.
     15
     16The lock now needs to be recursive because we may be inside
     17QDBusConnectionPrivate::doDispatch.
     18
     19Task-number: QTBUG-42189
     20Change-Id: I7b6b350909359817ea8b3f9c693bced042c9779a
     21Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
     22Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
     23---
     24 src/dbus/qdbusintegrator.cpp  | 19 +++++++++++++++----
     25 src/dbus/qdbusthreaddebug_p.h |  3 +++
     26 2 files changed, 18 insertions(+), 4 deletions(-)
     27
     28--- qtbase/src/dbus/qdbusintegrator.cpp
     29+++ qtbase/src/dbus/qdbusintegrator.cpp
     30@@ -1017,7 +1017,7 @@
     31 
     32 QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
     33     : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0),
     34-      watchAndTimeoutLock(QMutex::Recursive),
     35+      watchAndTimeoutLock(QMutex::Recursive), dispatchLock(QMutex::Recursive),
     36       rootNode(QString(QLatin1Char('/'))),
     37       anonymousAuthenticationAllowed(false)
     38 {
     39@@ -1266,7 +1266,10 @@
     40     //qDBusDebug() << "Emitting signal" << message;
     41     //qDBusDebug() << "for paths:";
     42     q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
     43-    huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
     44+    {
     45+        QDBusDispatchLocker locker(HuntAndEmitAction, this);
     46+        huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
     47+    }
     48     q_dbus_message_unref(msg);
     49 }
     50 
     51@@ -1923,7 +1926,11 @@
     52 
     53     qDBusDebug() << this << "sending message (no reply):" << message;
     54     checkThread();
     55-    bool isOk = q_dbus_connection_send(connection, msg, 0);
     56+    bool isOk;
     57+    {
     58+        QDBusDispatchLocker locker(SendMessageAction, this);
     59+        isOk = q_dbus_connection_send(connection, msg, 0);
     60+    }
     61     int serial = 0;
     62     if (isOk)
     63         serial = q_dbus_message_get_serial(msg);
     64@@ -1955,7 +1962,11 @@
     65 
     66         qDBusDebug() << this << "sending message (blocking):" << message;
     67         QDBusErrorInternal error;
     68-        DBusMessage *reply = q_dbus_connection_send_with_reply_and_block(connection, msg, timeout, error);
     69+        DBusMessage *reply;
     70+        {
     71+            QDBusDispatchLocker locker(SendWithReplyAndBlockAction, this);
     72+            reply = q_dbus_connection_send_with_reply_and_block(connection, msg, timeout, error);
     73+        }
     74 
     75         q_dbus_message_unref(msg);
     76 
     77--- qtbase/src/dbus/qdbusthreaddebug_p.h
     78+++ qtbase/src/dbus/qdbusthreaddebug_p.h
     79@@ -94,6 +94,9 @@
     80     MessageResultReceivedAction = 26,
     81     ActivateSignalAction = 27,
     82     PendingCallBlockAction = 28,
     83+    SendMessageAction = 29,
     84+    SendWithReplyAndBlockAction = 30,
     85+    HuntAndEmitAction = 31,
     86 
     87     AddTimeoutAction = 50,
     88     RealAddTimeoutAction = 51,
  • new file trunk/dports/aqua/qt5-mac/files/Break-after-handling-the-read-write.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Break-after-handling-the-read-write.patch b/trunk/dports/aqua/qt5-mac/files/Break-after-handling-the-read-write.patch
    new file mode 10644
    - +  
     1From 2a733b9bf62df746fb538d37ba1b150ada70c0b0 Mon Sep 17 00:00:00 2001
     2From: Albert Astals Cid <albert.astals@canonical.com>
     3Date: Thu, 27 Nov 2014 13:27:06 +0100
     4Subject: [PATCH] Break after handling the read/write
     5
     6The loop is there because watchers may have two Watcher for the same
     7fd, one for read and one for write, but after we're processed the
     8correct one we don't need to keep looping.
     9
     10This fixes a crash since it's possible that while in processing
     11q_dbus_watch_handle we get a watch added/remove this invalidating
     12the iterator and crashing
     13
     14Change-Id: Icb61deae272d2f237a4c616fae598404d419df90
     15---
     16 src/dbus/qdbusintegrator.cpp | 2 ++
     17 1 file changed, 2 insertions(+)
     18
     19--- qtbase/src/dbus/qdbusintegrator.cpp
     20+++ qtbase/src/dbus/qdbusintegrator.cpp
     21@@ -1185,6 +1185,7 @@
     22         if (it->watch && it->read && it->read->isEnabled()) {
     23             if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
     24                 qDebug("OUT OF MEM");
     25+            break;
     26         }
     27         ++it;
     28     }
     29@@ -1199,6 +1200,7 @@
     30         if (it->watch && it->write && it->write->isEnabled()) {
     31             if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
     32                 qDebug("OUT OF MEM");
     33+            break;
     34         }
     35         ++it;
     36     }
  • new file trunk/dports/aqua/qt5-mac/files/Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch b/trunk/dports/aqua/qt5-mac/files/Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch
    new file mode 10644
    - +  
     1From 5f6d7003c4be42477c92b79b7eb73272c31b1585 Mon Sep 17 00:00:00 2001
     2From: Thiago Macieira <thiago.macieira@intel.com>
     3Date: Thu, 2 Oct 2014 11:49:55 -0700
     4Subject: [PATCH] Don't always chmod the XDG_RUNTIME_DIR
     5
     6Since the current user is the owner of the dir, we'll get 0x7700 as
     7permissions, not just 0x700. With the wrong check, we were always doing
     8an unnecessary chmod.
     9
     10Task-number: QTBUG-41735
     11Change-Id: Ib1fc258fef4bf526baa9c71201f9b78d36f5454f
     12---
     13 src/corelib/io/qstandardpaths_unix.cpp | 4 +++-
     14 1 file changed, 3 insertions(+), 1 deletion(-)
     15
     16--- qtbase/src/corelib/io/qstandardpaths_unix.cpp
     17+++ qtbase/src/corelib/io/qstandardpaths_unix.cpp
     18@@ -138,8 +138,10 @@
     19             return QString();
     20         }
     21         // "and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700."
     22+        // since the current user is the owner, set both xxxUser and xxxOwner
     23         QFile file(xdgRuntimeDir);
     24-        const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser;
     25+        const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser
     26+                                               | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
     27         if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) {
     28             qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir));
     29             return QString();
  • new file trunk/dports/aqua/qt5-mac/files/Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch b/trunk/dports/aqua/qt5-mac/files/Fix-crash-in-QNetworkAccessCacheBackend-closeDownstr.patch
    new file mode 10644
    - +  
     1From 020fc9e9dcd19ef515e48c96e83fd6f75d52684a Mon Sep 17 00:00:00 2001
     2From: Albert Astals Cid <albert.astals@canonical.com>
     3Date: Thu, 18 Sep 2014 17:59:51 +0200
     4Subject: [PATCH] Fix crash in
     5 QNetworkAccessCacheBackend::closeDownstreamChannel
     6
     7device is private, always null and class has no friends, so no need to have it at all
     8
     9Change-Id: I320d47f1a712a3202c08b494563533e29d185501
     10---
     11 src/network/access/qnetworkaccesscachebackend.cpp           |  6 ------
     12 src/network/access/qnetworkaccesscachebackend_p.h           |  1 -
     13 .../qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp     | 13 +++++++++++++
     14 3 files changed, 13 insertions(+), 7 deletions(-)
     15
     16--- qtbase/src/network/access/qnetworkaccesscachebackend.cpp
     17+++ qtbase/src/network/access/qnetworkaccesscachebackend.cpp
     18@@ -52,7 +52,6 @@
     19 
     20 QNetworkAccessCacheBackend::QNetworkAccessCacheBackend()
     21     : QNetworkAccessBackend()
     22-    , device(0)
     23 {
     24 }
     25 
     26@@ -125,11 +124,6 @@
     27 
     28 void QNetworkAccessCacheBackend::closeDownstreamChannel()
     29 {
     30-    if (operation() == QNetworkAccessManager::GetOperation) {
     31-        device->close();
     32-        delete device;
     33-        device = 0;
     34-    }
     35 }
     36 
     37 void QNetworkAccessCacheBackend::closeUpstreamChannel()
     38--- qtbase/src/network/access/qnetworkaccesscachebackend_p.h
     39+++ qtbase/src/network/access/qnetworkaccesscachebackend_p.h
     40@@ -75,7 +75,6 @@
     41 
     42 private:
     43     bool sendCacheContents();
     44-    QIODevice *device;
     45 
     46 };
     47 
     48--- qtbase/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
     49+++ qtbase/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp
     50@@ -42,6 +42,7 @@
     51 #include <QtTest/QtTest>
     52 
     53 #include <QtNetwork/QNetworkAccessManager>
     54+#include <QtNetwork/QNetworkReply>
     55 #ifndef QT_NO_BEARERMANAGEMENT
     56 #include <QtNetwork/QNetworkConfigurationManager>
     57 #endif
     58@@ -61,6 +62,7 @@
     59 
     60 private slots:
     61     void networkAccessible();
     62+    void alwaysCacheRequest();
     63 };
     64 
     65 tst_QNetworkAccessManager::tst_QNetworkAccessManager()
     66@@ -126,5 +128,16 @@
     67 #endif
     68 }
     69 
     70+void tst_QNetworkAccessManager::alwaysCacheRequest()
     71+{
     72+    QNetworkAccessManager manager;
     73+
     74+    QNetworkRequest req;
     75+    req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
     76+    QNetworkReply *reply = manager.get(req);
     77+    reply->close();
     78+    delete reply;
     79+}
     80+
     81 QTEST_MAIN(tst_QNetworkAccessManager)
     82 #include "tst_qnetworkaccessmanager.moc"
  • new file trunk/dports/aqua/qt5-mac/files/Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch b/trunk/dports/aqua/qt5-mac/files/Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch
    new file mode 10644
    - +  
     1From 73a1e8c60d894701f34806cc4b847aa2814bf389 Mon Sep 17 00:00:00 2001
     2From: Thiago Macieira <thiago.macieira@intel.com>
     3Date: Tue, 28 Oct 2014 19:34:01 -0700
     4Subject: [PATCH 3/3] Partially revert "Fix a deadlock introduced by the race
     5 condition fix"
     6MIME-Version: 1.0
     7Content-Type: text/plain; charset=UTF-8
     8Content-Transfer-Encoding: 8bit
     9
     10The commit was 9361be58f47ec256bf920c378479a02501219c1f (2008-11-17),
     11referring to the race condition fix that was applied in commit
     12d47c05b1889bb4f06203bbc65f4660b8d0128954 (2008-10-08). The fix for the
     13deadlock reintroduced the race condition and the commit message noted
     14it.
     15
     16The workaround is no longer necessary since we've fixed the original race
     17condition differently now (see the previous two commits).
     18
     19Task-number: QTBUG-42189
     20Change-Id: I5a83249597a83c4d4caa2ae57964ad3cc61c1d70
     21Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
     22Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
     23Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
     24---
     25 src/dbus/qdbusintegrator.cpp | 40 ++++++++++++++--------------------------
     26 1 file changed, 14 insertions(+), 26 deletions(-)
     27
     28--- qtbase/src/dbus/qdbusintegrator.cpp
     29+++ qtbase/src/dbus/qdbusintegrator.cpp
     30@@ -1179,41 +1179,29 @@
     31 
     32 void QDBusConnectionPrivate::socketRead(int fd)
     33 {
     34-    QVarLengthArray<DBusWatch *, 2> pendingWatches;
     35-
     36-    {
     37-        QDBusDispatchLocker locker(SocketReadAction, this);
     38-        WatcherHash::ConstIterator it = watchers.constFind(fd);
     39-        while (it != watchers.constEnd() && it.key() == fd) {
     40-            if (it->watch && it->read && it->read->isEnabled())
     41-                pendingWatches.append(it.value().watch);
     42-            ++it;
     43+    QDBusDispatchLocker locker(SocketReadAction, this);
     44+    WatcherHash::ConstIterator it = watchers.constFind(fd);
     45+    while (it != watchers.constEnd() && it.key() == fd) {
     46+        if (it->watch && it->read && it->read->isEnabled()) {
     47+            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
     48+                qDebug("OUT OF MEM");
     49         }
     50+        ++it;
     51     }
     52-
     53-    for (int i = 0; i < pendingWatches.size(); ++i)
     54-        if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE))
     55-            qDebug("OUT OF MEM");
     56     doDispatch();
     57 }
     58 
     59 void QDBusConnectionPrivate::socketWrite(int fd)
     60 {
     61-    QVarLengthArray<DBusWatch *, 2> pendingWatches;
     62-
     63-    {
     64-        QDBusDispatchLocker locker(SocketWriteAction, this);
     65-        WatcherHash::ConstIterator it = watchers.constFind(fd);
     66-        while (it != watchers.constEnd() && it.key() == fd) {
     67-            if (it->watch && it->write && it->write->isEnabled())
     68-                pendingWatches.append(it.value().watch);
     69-            ++it;
     70+    QDBusDispatchLocker locker(SocketWriteAction, this);
     71+    WatcherHash::ConstIterator it = watchers.constFind(fd);
     72+    while (it != watchers.constEnd() && it.key() == fd) {
     73+        if (it->watch && it->write && it->write->isEnabled()) {
     74+            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
     75+                qDebug("OUT OF MEM");
     76         }
     77+        ++it;
     78     }
     79-
     80-    for (int i = 0; i < pendingWatches.size(); ++i)
     81-        if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE))
     82-            qDebug("OUT OF MEM");
     83 }
     84 
     85 void QDBusConnectionPrivate::objectDestroyed(QObject *obj)
  • new file trunk/dports/aqua/qt5-mac/files/QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch b/trunk/dports/aqua/qt5-mac/files/QDBusConnection-Merge-the-dispatch-and-the-watch-and.patch
    new file mode 10644
    - +  
     1From eb99c28861f5e841f306cfe8689627fe0e9bf2e8 Mon Sep 17 00:00:00 2001
     2From: Thiago Macieira <thiago.macieira@intel.com>
     3Date: Tue, 28 Oct 2014 19:26:17 -0700
     4Subject: [PATCH 2/3] QDBusConnection: Merge the dispatch and the
     5 watch-and-timeout locks
     6MIME-Version: 1.0
     7Content-Type: text/plain; charset=UTF-8
     8Content-Transfer-Encoding: 8bit
     9
     10We don't need two anymore because they now protect the same thing: the
     11state of the DBusConnection. The difference existed when it was possible
     12for two threads to access the DBusConnection at the same time: one doing
     13dispatching and one doing something else. Unfortunately, even though
     14DBusConnection supports this, QtDBus doesn't.
     15
     16From d47c05b1889bb4f06203bbc65f4660b8d0128954 (2008-10-08):
     17   Details:  if we're removing a timer or a watcher from our list,
     18   there's a race condition: one thread (not the QDBusConnection thread)
     19   could be asking for the removal (which causes an event to be sent),
     20   then deletes the pointer. In the meantime, QDBusConnection will
     21   process the timers and socket notifiers and could end up calling
     22   lidbus-1 with deleted pointers.
     23
     24That commit fixed the race condition but introduced a deadlock.
     25
     26Task-number: QTBUG-42189
     27Change-Id: I034038f763cbad3a67398909defd31a23c27c965
     28Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
     29Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
     30Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
     31---
     32 src/dbus/qdbusconnection_p.h  | 16 +++++-----------
     33 src/dbus/qdbusintegrator.cpp  | 22 +++++++++++-----------
     34 src/dbus/qdbusthreaddebug_p.h |  7 -------
     35 3 files changed, 16 insertions(+), 29 deletions(-)
     36
     37--- qtbase/src/dbus/qdbusconnection_p.h
     38+++ qtbase/src/dbus/qdbusconnection_p.h
     39@@ -290,24 +290,18 @@
     40     QStringList serverConnectionNames;
     41 
     42     ConnectionMode mode;
     43+    QDBusConnectionInterface *busService;
     44 
     45-    // members accessed in unlocked mode (except for deletion)
     46-    // connection and server provide their own locking mechanisms
     47-    // busService doesn't have state to be changed
     48+    // the dispatch lock protects everything related to the DBusConnection or DBusServer
     49+    // including the timeouts and watches
     50+    QMutex dispatchLock;
     51     DBusConnection *connection;
     52     DBusServer *server;
     53-    QDBusConnectionInterface *busService;
     54-
     55-    // watchers and timeouts are accessed from any thread
     56-    // but the corresponding timer and QSocketNotifier must be handled
     57-    // only in the object's thread
     58-    QMutex watchAndTimeoutLock;
     59     WatcherHash watchers;
     60     TimeoutHash timeouts;
     61     PendingTimeoutList timeoutsPendingAdd;
     62 
     63-    // members accessed through a lock
     64-    QMutex dispatchLock;
     65+    // the master lock protects our own internal state
     66     QReadWriteLock lock;
     67     QDBusError lastError;
     68 
     69--- qtbase/src/dbus/qdbusintegrator.cpp
     70+++ qtbase/src/dbus/qdbusintegrator.cpp
     71@@ -155,7 +155,7 @@
     72     if (!q_dbus_timeout_get_enabled(timeout))
     73         return true;
     74 
     75-    QDBusWatchAndTimeoutLocker locker(AddTimeoutAction, d);
     76+    QDBusDispatchLocker locker(AddTimeoutAction, d);
     77     if (QCoreApplication::instance() && QThread::currentThread() == d->thread()) {
     78         // correct thread
     79         return qDBusRealAddTimeout(d, timeout, q_dbus_timeout_get_interval(timeout));
     80@@ -190,7 +190,7 @@
     81 
     82     QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data);
     83 
     84-    QDBusWatchAndTimeoutLocker locker(RemoveTimeoutAction, d);
     85+    QDBusDispatchLocker locker(RemoveTimeoutAction, d);
     86 
     87     // is it pending addition?
     88     QDBusConnectionPrivate::PendingTimeoutList::iterator pit = d->timeoutsPendingAdd.begin();
     89@@ -263,7 +263,7 @@
     90 {
     91     QDBusConnectionPrivate::Watcher watcher;
     92 
     93-    QDBusWatchAndTimeoutLocker locker(AddWatchAction, d);
     94+    QDBusDispatchLocker locker(AddWatchAction, d);
     95     if (flags & DBUS_WATCH_READABLE) {
     96         //qDebug("addReadWatch %d", fd);
     97         watcher.watch = watch;
     98@@ -297,7 +297,7 @@
     99     QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data);
     100     int fd = q_dbus_watch_get_unix_fd(watch);
     101 
     102-    QDBusWatchAndTimeoutLocker locker(RemoveWatchAction, d);
     103+    QDBusDispatchLocker locker(RemoveWatchAction, d);
     104     QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
     105     while (i != d->watchers.end() && i.key() == fd) {
     106         if (i.value().watch == watch) {
     107@@ -341,7 +341,7 @@
     108 
     109 static void qDBusRealToggleWatch(QDBusConnectionPrivate *d, DBusWatch *watch, int fd)
     110 {
     111-    QDBusWatchAndTimeoutLocker locker(ToggleWatchAction, d);
     112+    QDBusDispatchLocker locker(ToggleWatchAction, d);
     113 
     114     QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
     115     while (i != d->watchers.end() && i.key() == fd) {
     116@@ -1016,8 +1016,8 @@
     117 extern bool qDBusInitThreads();
     118 
     119 QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
     120-    : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0),
     121-      watchAndTimeoutLock(QMutex::Recursive), dispatchLock(QMutex::Recursive),
     122+    : QObject(p), ref(1), capabilities(0), mode(InvalidMode), busService(0),
     123+      dispatchLock(QMutex::Recursive), connection(0), server(0),
     124       rootNode(QString(QLatin1Char('/'))),
     125       anonymousAuthenticationAllowed(false)
     126 {
     127@@ -1127,7 +1127,7 @@
     128 void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
     129 {
     130     {
     131-        QDBusWatchAndTimeoutLocker locker(TimerEventAction, this);
     132+        QDBusDispatchLocker locker(TimerEventAction, this);
     133         DBusTimeout *timeout = timeouts.value(e->timerId(), 0);
     134         if (timeout)
     135             q_dbus_timeout_handle(timeout);
     136@@ -1146,7 +1146,7 @@
     137     switch (ev->subtype)
     138     {
     139     case QDBusConnectionCallbackEvent::AddTimeout: {
     140-        QDBusWatchAndTimeoutLocker locker(RealAddTimeoutAction, this);
     141+        QDBusDispatchLocker locker(RealAddTimeoutAction, this);
     142         while (!timeoutsPendingAdd.isEmpty()) {
     143             QPair<DBusTimeout *, int> entry = timeoutsPendingAdd.takeFirst();
     144             qDBusRealAddTimeout(this, entry.first, entry.second);
     145@@ -1182,7 +1182,7 @@
     146     QVarLengthArray<DBusWatch *, 2> pendingWatches;
     147 
     148     {
     149-        QDBusWatchAndTimeoutLocker locker(SocketReadAction, this);
     150+        QDBusDispatchLocker locker(SocketReadAction, this);
     151         WatcherHash::ConstIterator it = watchers.constFind(fd);
     152         while (it != watchers.constEnd() && it.key() == fd) {
     153             if (it->watch && it->read && it->read->isEnabled())
     154@@ -1202,7 +1202,7 @@
     155     QVarLengthArray<DBusWatch *, 2> pendingWatches;
     156 
     157     {
     158-        QDBusWatchAndTimeoutLocker locker(SocketWriteAction, this);
     159+        QDBusDispatchLocker locker(SocketWriteAction, this);
     160         WatcherHash::ConstIterator it = watchers.constFind(fd);
     161         while (it != watchers.constEnd() && it.key() == fd) {
     162             if (it->watch && it->write && it->write->isEnabled())
     163--- qtbase/src/dbus/qdbusthreaddebug_p.h
     164+++ qtbase/src/dbus/qdbusthreaddebug_p.h
     165@@ -207,13 +207,6 @@
     166     { }
     167 };
     168 
     169-struct QDBusWatchAndTimeoutLocker: QDBusMutexLocker
     170-{
     171-    inline QDBusWatchAndTimeoutLocker(ThreadAction a, QDBusConnectionPrivate *s)
     172-        : QDBusMutexLocker(a, s, &s->watchAndTimeoutLock)
     173-    { }
     174-};
     175-
     176 #if QDBUS_THREAD_DEBUG
     177 # define SEM_ACQUIRE(action, sem)                                       \
     178     do {                                                                \
  • new file trunk/dports/aqua/qt5-mac/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch b/trunk/dports/aqua/qt5-mac/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch
    new file mode 10644
    - +  
     1From dedb8c1c928edbbb4408a0c5889353b142b20d1c Mon Sep 17 00:00:00 2001
     2From: Lorn Potter <lorn.potter@gmail.com>
     3Date: Thu, 13 Nov 2014 13:06:49 +1000
     4Subject: [PATCH] QtBearer networkmanager make sure to set flag Active
     5
     6Also, no need to create objects to get properties, when the properties
     7can be had for free.
     8
     9Make plugin more robust to network-manager or ofono crashes
     10
     11Change-Id: Ibadb46bd51aa27f130f8d245e8c50aa7bff5f9c8
     12---
     13 .../bearer/linux_common/qofonoservice_linux.cpp    |  12 +
     14 .../bearer/linux_common/qofonoservice_linux_p.h    |   2 +
     15 src/plugins/bearer/networkmanager/main.cpp         |   5 +-
     16 .../networkmanager/qnetworkmanagerengine.cpp       | 310 ++++++++++++++-------
     17 .../bearer/networkmanager/qnetworkmanagerengine.h  |  13 +
     18 .../networkmanager/qnetworkmanagerservice.cpp      |  22 ++
     19 .../bearer/networkmanager/qnetworkmanagerservice.h |   2 +
     20 7 files changed, 263 insertions(+), 103 deletions(-)
     21
     22--- qtbase/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
     23+++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
     24@@ -269,6 +269,18 @@
     25     return contextList;
     26 }
     27 
     28+PathPropertiesList QOfonoDataConnectionManagerInterface::contextsWithProperties()
     29+{
     30+    if (contextListProperties.isEmpty()) {
     31+        QDBusPendingReply<PathPropertiesList > reply = call(QLatin1String("GetContexts"));
     32+        reply.waitForFinished();
     33+        if (!reply.isError()) {
     34+            contextListProperties = reply.value();
     35+        }
     36+    }
     37+    return contextListProperties;
     38+}
     39+
     40 bool QOfonoDataConnectionManagerInterface::roamingAllowed()
     41 {
     42     QVariant var = getProperty(QStringLiteral("RoamingAllowed"));
     43--- qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
     44+++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
     45@@ -153,6 +153,7 @@
     46     ~QOfonoDataConnectionManagerInterface();
     47 
     48     QStringList contexts();
     49+    PathPropertiesList contextsWithProperties();
     50     bool roamingAllowed();
     51     QVariant getProperty(const QString &);
     52     QString bearer();
     53@@ -162,6 +163,7 @@
     54     QVariantMap getProperties();
     55     QVariantMap propertiesMap;
     56     QStringList contextList;
     57+    PathPropertiesList contextListProperties;
     58 private slots:
     59     void propertyChanged(const QString &, const QDBusVariant &value);
     60 };
     61--- qtbase/src/plugins/bearer/networkmanager/main.cpp
     62+++ qtbase/src/plugins/bearer/networkmanager/main.cpp
     63@@ -66,10 +66,7 @@
     64 {
     65     if (key == QLatin1String("networkmanager")) {
     66         QNetworkManagerEngine *engine = new QNetworkManagerEngine;
     67-        if (engine->networkManagerAvailable())
     68-            return engine;
     69-        else
     70-            delete engine;
     71+        return engine;
     72     }
     73 
     74     return 0;
     75--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
     76+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
     77@@ -56,29 +56,34 @@
     78 
     79 QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
     80 :   QBearerEngineImpl(parent),
     81-    managerInterface(new QNetworkManagerInterface(this)),
     82-    systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE, this)),
     83-    ofonoManager(new QOfonoManagerInterface(this))
     84+    managerInterface(NULL),
     85+    systemSettings(NULL),
     86+    ofonoManager(NULL),
     87+    nmAvailable(false)
     88 {
     89-
     90-    if (!managerInterface->isValid())
     91-        return;
     92-
     93     qDBusRegisterMetaType<QNmSettingsMap>();
     94 
     95-    connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
     96-            this, SLOT(deviceAdded(QDBusObjectPath)));
     97-    connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
     98-            this, SLOT(deviceRemoved(QDBusObjectPath)));
     99-    connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
     100-            this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
     101-    connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     102-            this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
     103-    managerInterface->setConnections();
     104+    nmWatcher = new QDBusServiceWatcher(NM_DBUS_SERVICE,QDBusConnection::systemBus(),
     105+            QDBusServiceWatcher::WatchForRegistration |
     106+            QDBusServiceWatcher::WatchForUnregistration, this);
     107+    connect(nmWatcher, SIGNAL(serviceRegistered(QString)),
     108+            this, SLOT(nmRegistered(QString)));
     109+    connect(nmWatcher, SIGNAL(serviceUnregistered(QString)),
     110+            this, SLOT(nmUnRegistered(QString)));
     111+
     112+    ofonoWatcher = new QDBusServiceWatcher("org.ofono",QDBusConnection::systemBus(),
     113+            QDBusServiceWatcher::WatchForRegistration |
     114+            QDBusServiceWatcher::WatchForUnregistration, this);
     115+    connect(ofonoWatcher, SIGNAL(serviceRegistered(QString)),
     116+            this, SLOT(ofonoRegistered(QString)));
     117+    connect(ofonoWatcher, SIGNAL(serviceUnregistered(QString)),
     118+            this, SLOT(ofonoUnRegistered(QString)));
     119 
     120-    connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
     121-            this, SLOT(newConnection(QDBusObjectPath)));
     122-    systemSettings->setConnections();
     123+    if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.ofono"))
     124+        ofonoRegistered();
     125+
     126+    if (QDBusConnection::systemBus().interface()->isServiceRegistered(NM_DBUS_SERVICE))
     127+        nmRegistered();
     128 }
     129 
     130 QNetworkManagerEngine::~QNetworkManagerEngine()
     131@@ -105,15 +110,13 @@
     132 
     133 void QNetworkManagerEngine::initialize()
     134 {
     135-    QMutexLocker locker(&mutex);
     136+    if (nmAvailable)
     137+        setupConfigurations();
     138+}
     139 
     140-    if (ofonoManager->isValid()) {
     141-        Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
     142-            QOfonoDataConnectionManagerInterface *ofonoContextManager
     143-                    = new QOfonoDataConnectionManagerInterface(modem,this);
     144-            ofonoContextManagers.insert(modem, ofonoContextManager);
     145-        }
     146-    }
     147+void QNetworkManagerEngine::setupConfigurations()
     148+{
     149+    QMutexLocker locker(&mutex);
     150     // Get active connections.
     151     foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
     152 
     153@@ -151,7 +154,7 @@
     154 
     155 bool QNetworkManagerEngine::networkManagerAvailable() const
     156 {
     157-    return managerInterface->isValid();
     158+    return nmAvailable;
     159 }
     160 
     161 QString QNetworkManagerEngine::getInterfaceFromId(const QString &settingsPath)
     162@@ -180,6 +183,9 @@
     163     const QString settingsPath = connection->connectionInterface()->path();
     164     QString specificPath = configuredAccessPoints.key(settingsPath);
     165 
     166+    if (isConnectionActive(settingsPath))
     167+        return;
     168+
     169     QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
     170     while (i.hasNext()) {
     171         i.next();
     172@@ -229,7 +235,7 @@
     173 
     174 void QNetworkManagerEngine::requestUpdate()
     175 {
     176-    if (managerInterface->wirelessEnabled()) {
     177+    if (managerInterface && managerInterface->wirelessEnabled()) {
     178         QHashIterator<QString, QNetworkManagerInterfaceDeviceWireless *> i(wirelessDevices);
     179         while (i.hasNext()) {
     180             i.next();
     181@@ -282,8 +288,9 @@
     182                 if (ptr) {
     183                     ptr->mutex.lock();
     184                     if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
     185-                        ptr->state != QNetworkConfiguration::Active) {
     186-                        ptr->state = QNetworkConfiguration::Active;
     187+                            (ptr->state & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) {
     188+
     189+                        ptr->state |= QNetworkConfiguration::Active;
     190 
     191                         if (activeConnectionsList.value(id) && activeConnectionsList.value(id)->defaultRoute()
     192                                 && managerInterface->state() < QNetworkManagerInterface::NM_STATE_CONNECTED_GLOBAL) {
     193@@ -339,23 +346,25 @@
     194 
     195     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     196     if (ptr) {
     197-        ptr->mutex.lock();
     198-        if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
     199-            QStringList devices = activeConnection->devices();
     200-            if (!devices.isEmpty()) {
     201-                QNetworkManagerInterfaceDevice device(devices.at(0),this);
     202-                connectionInterfaces.insert(id,device.networkInterface());
     203-            }
     204-
     205-            ptr->state |= QNetworkConfiguration::Active;
     206-            ptr->mutex.unlock();
     207-
     208-            locker.unlock();
     209-            emit configurationChanged(ptr);
     210-            locker.relock();
     211-        } else {
     212-            connectionInterfaces.remove(id);
     213-            ptr->mutex.unlock();
     214+        if (properties.contains(QStringLiteral("State"))) {
     215+            ptr->mutex.lock();
     216+            if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
     217+                QStringList devices = activeConnection->devices();
     218+                if (!devices.isEmpty()) {
     219+                    QNetworkManagerInterfaceDevice device(devices.at(0),this);
     220+                    connectionInterfaces.insert(id,device.networkInterface());
     221+                }
     222+
     223+                ptr->state |= QNetworkConfiguration::Active;
     224+                ptr->mutex.unlock();
     225+
     226+                locker.unlock();
     227+                emit configurationChanged(ptr);
     228+                locker.relock();
     229+            } else {
     230+                connectionInterfaces.remove(id);
     231+                ptr->mutex.unlock();
     232+            }
     233         }
     234     }
     235 }
     236@@ -403,9 +412,6 @@
     237         connect(wirelessDevice,SIGNAL(scanDone()),this,SLOT(scanFinished()));
     238         wirelessDevice->setConnections();
     239 
     240-        foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
     241-            newAccessPoint(apPath.path());
     242-
     243         wirelessDevices.insert(path.path(), wirelessDevice);
     244     }
     245 
     246@@ -518,14 +524,9 @@
     247         parseConnection(settingsPath, connection->getSettings());
     248 
     249     // Check if connection is active.
     250-    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
     251-    while (i.hasNext()) {
     252-        i.next();
     253-        if (i.value()->connection().path() == settingsPath) {
     254-            cpPriv->state |= QNetworkConfiguration::Active;
     255-            break;
     256-        }
     257-    }
     258+    if (isConnectionActive(settingsPath))
     259+        cpPriv->state |= QNetworkConfiguration::Active;
     260+
     261     if (deviceType == DEVICE_TYPE_ETHERNET) {
     262         QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
     263         while (i.hasNext()) {
     264@@ -539,12 +540,36 @@
     265              }
     266          }
     267      }
     268+
     269     QNetworkConfigurationPrivatePointer ptr(cpPriv);
     270     accessPointConfigurations.insert(ptr->id, ptr);
     271     locker.unlock();
     272     emit configurationAdded(ptr);
     273 }
     274 
     275+bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
     276+{
     277+    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
     278+    while (i.hasNext()) {
     279+        i.next();
     280+        if (i.value()->connection().path() == settingsPath) {
     281+            if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
     282+                    || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
     283+                return true;
     284+            } else {
     285+                break;
     286+            }
     287+        }
     288+    }
     289+
     290+    QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
     291+    if (settingsConnection->getType() == DEVICE_TYPE_MODEM) {
     292+        return isActiveContext(settingsConnection->connectionInterface()->path());
     293+    }
     294+
     295+    return false;
     296+}
     297+
     298 void QNetworkManagerEngine::removeConnection(const QString &path)
     299 {
     300     QMutexLocker locker(&mutex);
     301@@ -652,7 +677,6 @@
     302 void QNetworkManagerEngine::newAccessPoint(const QString &path)
     303 {
     304     QMutexLocker locker(&mutex);
     305-
     306     QNetworkManagerInterfaceAccessPoint *accessPoint =
     307         new QNetworkManagerInterfaceAccessPoint(path,this);
     308 
     309@@ -683,6 +707,9 @@
     310                 ptr->mutex.lock();
     311                 QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
     312                 ptr->state = (flag | QNetworkConfiguration::Discovered);
     313+
     314+                if (isConnectionActive(settingsPath))
     315+                    ptr->state = (flag | QNetworkConfiguration::Active);
     316                 ptr->mutex.unlock();
     317 
     318                 locker.unlock();
     319@@ -762,7 +789,6 @@
     320     QMutexLocker locker(&mutex);
     321     QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
     322     cpPriv->name = map.value("connection").value("id").toString();
     323-
     324     cpPriv->isValid = true;
     325     cpPriv->id = settingsPath;
     326     cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
     327@@ -811,18 +837,46 @@
     328         }
     329     } else if (connectionType == QLatin1String("gsm")) {
     330 
     331-        const QString contextPath = map.value("connection").value("id").toString();
     332-        cpPriv->name = contextName(contextPath);
     333-        cpPriv->bearerType = currentBearerType(contextPath);
     334-
     335-        if (map.value("connection").contains("timestamp")) {
     336-            cpPriv->state |= QNetworkConfiguration::Discovered;
     337+        const QString connectionPath = map.value("connection").value("id").toString();
     338+        cpPriv->name = contextName(connectionPath);
     339+        cpPriv->bearerType = currentBearerType(connectionPath);
     340+
     341+        if (ofonoManager && ofonoManager->isValid()) {
     342+            const QString contextPart = connectionPath.section('/', -1);
     343+            QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     344+            while (i.hasNext()) {
     345+                i.next();
     346+                const QString path = i.key() +"/"+contextPart;
     347+                if (isActiveContext(path)) {
     348+                    cpPriv->state |= QNetworkConfiguration::Active;
     349+                    break;
     350+                }
     351+            }
     352         }
     353     }
     354 
     355     return cpPriv;
     356 }
     357 
     358+bool QNetworkManagerEngine::isActiveContext(const QString &contextPath)
     359+{
     360+    if (ofonoManager && ofonoManager->isValid()) {
     361+        const QString contextPart = contextPath.section('/', -1);
     362+        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     363+        while (i.hasNext()) {
     364+            i.next();
     365+            PathPropertiesList list = i.value()->contextsWithProperties();
     366+            for (int i = 0; i < list.size(); ++i) {
     367+                if (list.at(i).path.path().contains(contextPart)) {
     368+                    return list.at(i).properties.value(QStringLiteral("Active")).toBool();
     369+
     370+                }
     371+            }
     372+        }
     373+    }
     374+    return false;
     375+}
     376+
     377 QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const
     378 {
     379     for (int i = 0; i < connections.count(); ++i) {
     380@@ -967,53 +1021,111 @@
     381 
     382 QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
     383 {
     384-    if (ofonoManager->isValid()) {
     385-        QString contextPart = id.section('/', -1);
     386+    QString contextPart = id.section('/', -1);
     387+    QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     388+    while (i.hasNext()) {
     389+        i.next();
     390+        QString contextPath = i.key() +"/"+contextPart;
     391 
     392-        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     393-        while (i.hasNext()) {
     394-            i.next();
     395-            QString contextPath = i.key() +"/"+contextPart;
     396-            if (i.value()->contexts().contains(contextPath)) {
     397+        if (i.value()->contexts().contains(contextPath)) {
     398 
     399-                QString bearer = i.value()->bearer();
     400-                if (bearer == QStringLiteral("gsm")) {
     401-                    return QNetworkConfiguration::Bearer2G;
     402-                } else if (bearer == QStringLiteral("edge")) {
     403-                    return QNetworkConfiguration::Bearer2G;
     404-                } else if (bearer == QStringLiteral("umts")) {
     405-                    return QNetworkConfiguration::BearerWCDMA;
     406-                } else if (bearer == QStringLiteral("hspa")
     407-                           || bearer == QStringLiteral("hsdpa")
     408-                           || bearer == QStringLiteral("hsupa")) {
     409-                    return QNetworkConfiguration::BearerHSPA;
     410-                } else if (bearer == QStringLiteral("lte")) {
     411-                    return QNetworkConfiguration::BearerLTE;
     412-                }
     413+            QString bearer = i.value()->bearer();
     414+
     415+            if (bearer == QStringLiteral("gsm")) {
     416+                return QNetworkConfiguration::Bearer2G;
     417+            } else if (bearer == QStringLiteral("edge")) {
     418+                return QNetworkConfiguration::Bearer2G;
     419+            } else if (bearer == QStringLiteral("umts")) {
     420+                return QNetworkConfiguration::BearerWCDMA;
     421+            } else if (bearer == QStringLiteral("hspa")
     422+                       || bearer == QStringLiteral("hsdpa")
     423+                       || bearer == QStringLiteral("hsupa")) {
     424+                return QNetworkConfiguration::BearerHSPA;
     425+            } else if (bearer == QStringLiteral("lte")) {
     426+                return QNetworkConfiguration::BearerLTE;
     427             }
     428         }
     429     }
     430+
     431     return QNetworkConfiguration::BearerUnknown;
     432 }
     433 
     434 QString QNetworkManagerEngine::contextName(const QString &path)
     435 {
     436-    if (ofonoManager->isValid()) {
     437-        QString contextPart = path.section('/', -1);
     438-        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     439-        while (i.hasNext()) {
     440-            i.next();
     441-            Q_FOREACH (const QString &oContext, i.value()->contexts()) {
     442-                if (oContext.contains(contextPart)) {
     443-                    QOfonoConnectionContextInterface contextInterface(oContext,this);
     444-                    return contextInterface.name();
     445-                }
     446+    QString contextPart = path.section('/', -1);
     447+    QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     448+    while (i.hasNext()) {
     449+        i.next();
     450+        PathPropertiesList list = i.value()->contextsWithProperties();
     451+        for (int i = 0; i < list.size(); ++i) {
     452+            if (list.at(i).path.path().contains(contextPart)) {
     453+                return list.at(i).properties.value(QStringLiteral("Name")).toString();
     454             }
     455         }
     456     }
     457     return path;
     458 }
     459 
     460+void QNetworkManagerEngine::nmRegistered(const QString &)
     461+{
     462+    if (ofonoManager) {
     463+        delete ofonoManager;
     464+        ofonoManager = NULL;
     465+    }
     466+    managerInterface = new QNetworkManagerInterface(this);
     467+    systemSettings = new QNetworkManagerSettings(NM_DBUS_SERVICE, this);
     468+
     469+    connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
     470+            this, SLOT(deviceAdded(QDBusObjectPath)));
     471+    connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
     472+            this, SLOT(deviceRemoved(QDBusObjectPath)));
     473+    connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
     474+            this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
     475+    connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     476+            this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
     477+    managerInterface->setConnections();
     478+
     479+    connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
     480+            this, SLOT(newConnection(QDBusObjectPath)));
     481+    systemSettings->setConnections();
     482+    nmAvailable = true;
     483+
     484+    setupConfigurations();
     485+}
     486+
     487+void QNetworkManagerEngine::nmUnRegistered(const QString &)
     488+{
     489+    if (systemSettings) {
     490+        delete systemSettings;
     491+        systemSettings = NULL;
     492+    }
     493+    if (managerInterface) {
     494+        delete managerInterface;
     495+        managerInterface = NULL;
     496+    }
     497+}
     498+
     499+void QNetworkManagerEngine::ofonoRegistered(const QString &)
     500+{
     501+    if (ofonoManager) {
     502+        delete ofonoManager;
     503+        ofonoManager = NULL;
     504+    }
     505+    ofonoManager = new QOfonoManagerInterface(this);
     506+    if (ofonoManager && ofonoManager->isValid()) {
     507+        Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
     508+            QOfonoDataConnectionManagerInterface *ofonoContextManager
     509+                    = new QOfonoDataConnectionManagerInterface(modem,this);
     510+            ofonoContextManagers.insert(modem, ofonoContextManager);
     511+        }
     512+    }
     513+}
     514+
     515+void QNetworkManagerEngine::ofonoUnRegistered(const QString &)
     516+{
     517+    ofonoContextManagers.clear();
     518+}
     519+
     520 QT_END_NAMESPACE
     521 
     522 #endif // QT_NO_DBUS
     523--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
     524+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
     525@@ -109,6 +109,12 @@
     526 
     527     void wiredCarrierChanged(bool);
     528 
     529+    void nmRegistered(const QString &serviceName = QString());
     530+    void nmUnRegistered(const QString &serviceName = QString());
     531+
     532+    void ofonoRegistered(const QString &serviceName = QString());
     533+    void ofonoUnRegistered(const QString &serviceName = QString());
     534+
     535 private:
     536     QNetworkConfigurationPrivate *parseConnection(const QString &settingsPath,
     537                                                   const QNmSettingsMap &map);
     538@@ -132,6 +138,13 @@
     539     QNetworkConfiguration::BearerType currentBearerType(const QString &id);
     540     QString contextName(const QString &path);
     541 
     542+    bool isConnectionActive(const QString &settingsPath);
     543+    QDBusServiceWatcher *ofonoWatcher;
     544+    QDBusServiceWatcher *nmWatcher;
     545+
     546+    bool isActiveContext(const QString &contextPath);
     547+    bool nmAvailable;
     548+    void setupConfigurations();
     549 };
     550 
     551 QT_END_NAMESPACE
     552--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
     553+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
     554@@ -688,6 +688,15 @@
     555                                   QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     556                                   QLatin1String("PropertiesChanged"),
     557                                   this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     558+
     559+    QDBusPendingReply<QList<QDBusObjectPath> > reply
     560+            = d->connectionInterface->asyncCall(QLatin1String("GetAccessPoints"));
     561+
     562+    QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply);
     563+    connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
     564+                     this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*)));
     565+
     566+
     567     d->valid = true;
     568 }
     569 
     570@@ -749,6 +758,19 @@
     571     return allOk;
     572 }
     573 
     574+void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCallWatcher *watcher)
     575+{
     576+    QDBusPendingReply<QList<QDBusObjectPath> > reply(*watcher);
     577+    watcher->deleteLater();
     578+    if (!reply.isError()) {
     579+        accessPointsList = reply.value();
     580+    }
     581+
     582+    for (int i = 0; i < accessPointsList.size(); i++) {
     583+        Q_EMIT accessPointAdded(accessPointsList.at(i).path());
     584+    }
     585+}
     586+
     587 QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const
     588 {
     589     return d->connectionInterface;
     590--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
     591+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
     592@@ -369,6 +369,8 @@
     593     void slotAccessPointAdded(QDBusObjectPath);
     594     void slotAccessPointRemoved(QDBusObjectPath);
     595 
     596+    void accessPointsFinished(QDBusPendingCallWatcher *watcher);
     597+
     598 private:
     599     QNetworkManagerInterfaceDeviceWirelessPrivate *d;
     600     QVariantMap propertyMap;
  • new file trunk/dports/aqua/qt5-mac/files/Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch b/trunk/dports/aqua/qt5-mac/files/Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch
    new file mode 10644
    - +  
     1From ee10fbaa5ee61fe289d630732c443c7c475f4e94 Mon Sep 17 00:00:00 2001
     2From: Thiago Macieira <thiago.macieira@intel.com>
     3Date: Thu, 2 Oct 2014 11:56:22 -0700
     4Subject: [PATCH] Report the system error on why chmod(2) failed in
     5 XDG_RNTIME_DIR
     6
     7Why would chmod(2) fail if the current user is the owner of the file? The
     8only reason I can think of is EROFS.
     9
     10Task-number: QTBUG-41735
     11Change-Id: I8f8bac763bf5a6e575ed59dac55bd265e5b66271
     12---
     13 src/corelib/io/qstandardpaths_unix.cpp | 3 ++-
     14 1 file changed, 2 insertions(+), 1 deletion(-)
     15
     16--- qtbase/src/corelib/io/qstandardpaths_unix.cpp
     17+++ qtbase/src/corelib/io/qstandardpaths_unix.cpp
     18@@ -143,7 +143,8 @@
     19         const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser
     20                                                | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
     21         if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) {
     22-            qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir));
     23+            qWarning("QStandardPaths: could not set correct permissions on runtime directory %s: %s",
     24+                     qPrintable(xdgRuntimeDir), qPrintable(file.errorString()));
     25             return QString();
     26         }
     27         return xdgRuntimeDir;
  • new file trunk/dports/aqua/qt5-mac/files/Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch b/trunk/dports/aqua/qt5-mac/files/Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch
    new file mode 10644
    - +  
     1From 0d9f3517935cf1fe194926a99208f3426d2104af Mon Sep 17 00:00:00 2001
     2From: Lorn Potter <lorn.potter@gmail.com>
     3Date: Mon, 27 Oct 2014 19:26:47 +1000
     4Subject: [PATCH] Reset QNAM's NetworkConfiguration when state changes.
     5
     6Since QNAM is initialized with defaultConfiguration, we need to
     7reset the internal configuration used to the current
     8defaultConfiguration when the state changes and a new configuration
     9becomes the default.
     10
     11Task-number: QTBUG-40234
     12Change-Id: I50f23c62804f29370915eecac2c92301c5f3ead2
     13---
     14 src/network/access/qnetworkaccessmanager.cpp | 12 +++++++++++-
     15 1 file changed, 11 insertions(+), 1 deletion(-)
     16
     17--- qtbase/src/network/access/qnetworkaccessmanager.cpp
     18+++ qtbase/src/network/access/qnetworkaccessmanager.cpp
     19@@ -1143,7 +1143,12 @@
     20     if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) {
     21         QNetworkConfigurationManager manager;
     22         if (!d->networkConfiguration.identifier().isEmpty()) {
     23-            d->createSession(d->networkConfiguration);
     24+            if ((d->networkConfiguration.state() & QNetworkConfiguration::Defined)
     25+                    && d->networkConfiguration != manager.defaultConfiguration())
     26+                d->createSession(manager.defaultConfiguration());
     27+            else
     28+                d->createSession(d->networkConfiguration);
     29+
     30         } else {
     31             if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
     32                 d->createSession(manager.defaultConfiguration());
     33@@ -1598,6 +1603,11 @@
     34     if (customNetworkConfiguration) {
     35         online = (networkConfiguration.state() & QNetworkConfiguration::Active);
     36     } else {
     37+        if (isOnline && online != isOnline) {
     38+            networkSessionStrongRef.clear();
     39+            networkSessionWeakRef.clear();
     40+        }
     41+
     42         online = isOnline;
     43     }
     44 }
  • new file trunk/dports/aqua/qt5-mac/files/Use-a-property-cache-to-cut-down-on-blocking-calls.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/Use-a-property-cache-to-cut-down-on-blocking-calls.patch b/trunk/dports/aqua/qt5-mac/files/Use-a-property-cache-to-cut-down-on-blocking-calls.patch
    new file mode 10644
    - +  
     1From 1df2cd6af5c40db588fc3ec40c7adfafc1b5eea3 Mon Sep 17 00:00:00 2001
     2From: Lorn Potter <lorn.potter@gmail.com>
     3Date: Wed, 29 Oct 2014 19:40:43 +1000
     4Subject: [PATCH] Use a property cache to cut down on blocking calls
     5
     6Refactor old code
     7Stop memory leaks
     8Properly support mobile data (ofono)
     9
     10Change-Id: I7f23882ee0ee345a049a4a93ddd452b6d2e53710
     11---
     12 src/plugins/bearer/connman/connman.pro             |   4 +-
     13 src/plugins/bearer/connman/qconnmanengine.h        |   2 +-
     14 src/plugins/bearer/connman/qofonoservice_linux.cpp | 303 ---------
     15 src/plugins/bearer/connman/qofonoservice_linux_p.h | 172 -----
     16 .../bearer/linux_common/qofonoservice_linux.cpp    | 370 +++++++++++
     17 .../bearer/linux_common/qofonoservice_linux_p.h    | 195 ++++++
     18 .../bearer/networkmanager/networkmanager.pro       |   6 +-
     19 .../networkmanager/qnetworkmanagerengine.cpp       | 364 +++++------
     20 .../bearer/networkmanager/qnetworkmanagerengine.h  |  22 +-
     21 .../networkmanager/qnetworkmanagerservice.cpp      | 693 +++++++++++++++------
     22 .../bearer/networkmanager/qnetworkmanagerservice.h | 105 +++-
     23 .../bearer/networkmanager/qnmdbushelper.cpp        | 140 -----
     24 src/plugins/bearer/networkmanager/qnmdbushelper.h  |  73 ---
     25 13 files changed, 1318 insertions(+), 1131 deletions(-)
     26 delete mode 100644 src/plugins/bearer/connman/qofonoservice_linux.cpp
     27 delete mode 100644 src/plugins/bearer/connman/qofonoservice_linux_p.h
     28 create mode 100644 src/plugins/bearer/linux_common/qofonoservice_linux.cpp
     29 create mode 100644 src/plugins/bearer/linux_common/qofonoservice_linux_p.h
     30 delete mode 100644 src/plugins/bearer/networkmanager/qnmdbushelper.cpp
     31 delete mode 100644 src/plugins/bearer/networkmanager/qnmdbushelper.h
     32
     33--- qtbase/src/plugins/bearer/connman/connman.pro
     34+++ qtbase/src/plugins/bearer/connman/connman.pro
     35@@ -8,14 +8,14 @@
     36 CONFIG += link_pkgconfig
     37 
     38 HEADERS += qconnmanservice_linux_p.h \
     39-           qofonoservice_linux_p.h \
     40+           ../linux_common/qofonoservice_linux_p.h \
     41            qconnmanengine.h \
     42            ../qnetworksession_impl.h \
     43            ../qbearerengine_impl.h
     44 
     45 SOURCES += main.cpp \
     46            qconnmanservice_linux.cpp \
     47-           qofonoservice_linux.cpp \
     48+           ../linux_common/qofonoservice_linux.cpp \
     49            qconnmanengine.cpp \
     50            ../qnetworksession_impl.cpp
     51 
     52--- qtbase/src/plugins/bearer/connman/qconnmanengine.h
     53+++ qtbase/src/plugins/bearer/connman/qconnmanengine.h
     54@@ -56,7 +56,7 @@
     55 #include "../qbearerengine_impl.h"
     56 
     57 #include "qconnmanservice_linux_p.h"
     58-#include "qofonoservice_linux_p.h"
     59+#include "../linux_common/qofonoservice_linux_p.h"
     60 
     61 #include <QMap>
     62 #include <QVariant>
     63--- /dev/null
     64+++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
     65@@ -0,0 +1,370 @@
     66+/****************************************************************************
     67+**
     68+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     69+** Contact: http://www.qt-project.org/legal
     70+**
     71+** This file is part of the plugins of the Qt Toolkit.
     72+**
     73+** $QT_BEGIN_LICENSE:LGPL21$
     74+** Commercial License Usage
     75+** Licensees holding valid commercial Qt licenses may use this file in
     76+** accordance with the commercial license agreement provided with the
     77+** Software or, alternatively, in accordance with the terms contained in
     78+** a written agreement between you and Digia. For licensing terms and
     79+** conditions see http://qt.digia.com/licensing. For further information
     80+** use the contact form at http://qt.digia.com/contact-us.
     81+**
     82+** GNU Lesser General Public License Usage
     83+** Alternatively, this file may be used under the terms of the GNU Lesser
     84+** General Public License version 2.1 or version 3 as published by the Free
     85+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     86+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     87+** following information to ensure the GNU Lesser General Public License
     88+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     89+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     90+**
     91+** In addition, as a special exception, Digia gives you certain additional
     92+** rights. These rights are described in the Digia Qt LGPL Exception
     93+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     94+**
     95+** $QT_END_LICENSE$
     96+**
     97+****************************************************************************/
     98+
     99+#include <QObject>
     100+#include <QList>
     101+#include <QtDBus/QtDBus>
     102+#include <QtDBus/QDBusConnection>
     103+#include <QtDBus/QDBusError>
     104+#include <QtDBus/QDBusInterface>
     105+#include <QtDBus/QDBusMessage>
     106+#include <QtDBus/QDBusReply>
     107+#include <QtDBus/QDBusPendingCallWatcher>
     108+#include <QtDBus/QDBusObjectPath>
     109+#include <QtDBus/QDBusPendingCall>
     110+
     111+#include "qofonoservice_linux_p.h"
     112+
     113+#ifndef QT_NO_BEARERMANAGEMENT
     114+#ifndef QT_NO_DBUS
     115+
     116+QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item)
     117+{
     118+    argument.beginStructure();
     119+    argument << item.path << item.properties;
     120+    argument.endStructure();
     121+    return argument;
     122+}
     123+
     124+const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathProperties &item)
     125+{
     126+    argument.beginStructure();
     127+    argument >> item.path >> item.properties;
     128+    argument.endStructure();
     129+    return argument;
     130+}
     131+
     132+QT_BEGIN_NAMESPACE
     133+
     134+QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
     135+        : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     136+                                 QStringLiteral(OFONO_MANAGER_PATH),
     137+                                 OFONO_MANAGER_INTERFACE,
     138+                                 QDBusConnection::systemBus(), parent)
     139+{
     140+    qDBusRegisterMetaType<ObjectPathProperties>();
     141+    qDBusRegisterMetaType<PathPropertiesList>();
     142+
     143+    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     144+                           QStringLiteral(OFONO_MANAGER_PATH),
     145+                           QStringLiteral(OFONO_MANAGER_INTERFACE),
     146+                           QStringLiteral("ModemAdded"),
     147+                           this,SLOT(modemAdded(QDBusObjectPath, QVariantMap)));
     148+    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     149+                           QStringLiteral(OFONO_MANAGER_PATH),
     150+                           QStringLiteral(OFONO_MANAGER_INTERFACE),
     151+                           QStringLiteral("ModemRemoved"),
     152+                           this,SLOT(modemRemoved(QDBusObjectPath)));
     153+}
     154+
     155+QOfonoManagerInterface::~QOfonoManagerInterface()
     156+{
     157+}
     158+
     159+QStringList QOfonoManagerInterface::getModems()
     160+{
     161+    if (modemList.isEmpty()) {
     162+        QList<QVariant> argumentList;
     163+        QDBusPendingReply<PathPropertiesList> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetModems"), argumentList);
     164+        reply.waitForFinished();
     165+        if (!reply.isError()) {
     166+            foreach (ObjectPathProperties modem, reply.value()) {
     167+                modemList << modem.path.path();
     168+            }
     169+        }
     170+    }
     171+
     172+    return modemList;
     173+}
     174+
     175+QString QOfonoManagerInterface::currentModem()
     176+{
     177+    QStringList modems = getModems();
     178+    foreach (const QString &modem, modems) {
     179+        QOfonoModemInterface device(modem);
     180+        if (device.isPowered() && device.isOnline())
     181+        return modem;
     182+    }
     183+    return QString();
     184+}
     185+
     186+void QOfonoManagerInterface::modemAdded(const QDBusObjectPath &path, const QVariantMap &/*var*/)
     187+{
     188+    if (!modemList.contains(path.path())) {
     189+        modemList << path.path();
     190+        Q_EMIT modemChanged();
     191+    }
     192+}
     193+
     194+void QOfonoManagerInterface::modemRemoved(const QDBusObjectPath &path)
     195+{
     196+    if (modemList.contains(path.path())) {
     197+        modemList.removeOne(path.path());
     198+        Q_EMIT modemChanged();
     199+    }
     200+}
     201+
     202+
     203+QOfonoModemInterface::QOfonoModemInterface(const QString &dbusPathName, QObject *parent)
     204+    : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     205+                             dbusPathName,
     206+                             OFONO_MODEM_INTERFACE,
     207+                             QDBusConnection::systemBus(), parent)
     208+{
     209+    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     210+                                         path(),
     211+                                         OFONO_MODEM_INTERFACE,
     212+                                         QStringLiteral("PropertyChanged"),
     213+                                         this,SLOT(propertyChanged(QString,QDBusVariant)));
     214+}
     215+
     216+QOfonoModemInterface::~QOfonoModemInterface()
     217+{
     218+}
     219+
     220+void QOfonoModemInterface::propertyChanged(const QString &name,const QDBusVariant &value)
     221+{
     222+    propertiesMap[name] = value.variant();
     223+}
     224+
     225+bool QOfonoModemInterface::isPowered()
     226+{
     227+    QVariant var = getProperty(QStringLiteral("Powered"));
     228+    return qdbus_cast<bool>(var);
     229+}
     230+
     231+bool QOfonoModemInterface::isOnline()
     232+{
     233+    QVariant var = getProperty(QStringLiteral("Online"));
     234+    return qdbus_cast<bool>(var);
     235+}
     236+
     237+QVariantMap QOfonoModemInterface::getProperties()
     238+{
     239+    if (propertiesMap.isEmpty()) {
     240+        QList<QVariant> argumentList;
     241+        QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
     242+        if (!reply.isError()) {
     243+            propertiesMap = reply.value();
     244+        }
     245+    }
     246+    return propertiesMap;
     247+}
     248+
     249+QVariant QOfonoModemInterface::getProperty(const QString &property)
     250+{
     251+    QVariant var;
     252+    QVariantMap map = getProperties();
     253+    if (map.contains(property))
     254+        var = map.value(property);
     255+    return var;
     256+}
     257+
     258+
     259+QOfonoNetworkRegistrationInterface::QOfonoNetworkRegistrationInterface(const QString &dbusPathName, QObject *parent)
     260+    : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     261+                             dbusPathName,
     262+                             OFONO_NETWORK_REGISTRATION_INTERFACE,
     263+                             QDBusConnection::systemBus(), parent)
     264+{
     265+}
     266+
     267+QOfonoNetworkRegistrationInterface::~QOfonoNetworkRegistrationInterface()
     268+{
     269+}
     270+
     271+QString QOfonoNetworkRegistrationInterface::getTechnology()
     272+{
     273+    QVariant var = getProperty(QStringLiteral("Technology"));
     274+    return qdbus_cast<QString>(var);
     275+}
     276+
     277+QVariant QOfonoNetworkRegistrationInterface::getProperty(const QString &property)
     278+{
     279+    QVariant var;
     280+    QVariantMap map = getProperties();
     281+    if (map.contains(property))
     282+        var = map.value(property);
     283+    return var;
     284+}
     285+
     286+QVariantMap QOfonoNetworkRegistrationInterface::getProperties()
     287+{
     288+    if (propertiesMap.isEmpty()) {
     289+        QList<QVariant> argumentList;
     290+        QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
     291+        reply.waitForFinished();
     292+        if (!reply.isError()) {
     293+            propertiesMap = reply.value();
     294+        }
     295+    }
     296+    return propertiesMap;
     297+}
     298+
     299+QOfonoDataConnectionManagerInterface::QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent)
     300+    : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
     301+                             dbusPathName,
     302+                             OFONO_DATA_CONNECTION_MANAGER_INTERFACE,
     303+                             QDBusConnection::systemBus(), parent)
     304+{
     305+    QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
     306+                                         path(),
     307+                                         QLatin1String(OFONO_MODEM_INTERFACE),
     308+                                         QLatin1String("PropertyChanged"),
     309+                                         this,SLOT(propertyChanged(QString,QDBusVariant)));
     310+}
     311+
     312+QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface()
     313+{
     314+}
     315+
     316+QStringList QOfonoDataConnectionManagerInterface::contexts()
     317+{
     318+    if (contextList.isEmpty()) {
     319+        QDBusPendingReply<PathPropertiesList > reply = call(QLatin1String("GetContexts"));
     320+        reply.waitForFinished();
     321+        if (!reply.isError()) {
     322+            foreach (ObjectPathProperties context, reply.value()) {
     323+                contextList << context.path.path();
     324+            }
     325+        }
     326+    }
     327+    return contextList;
     328+}
     329+
     330+bool QOfonoDataConnectionManagerInterface::roamingAllowed()
     331+{
     332+    QVariant var = getProperty(QStringLiteral("RoamingAllowed"));
     333+    return qdbus_cast<bool>(var);
     334+}
     335+
     336+QString QOfonoDataConnectionManagerInterface::bearer()
     337+{
     338+    QVariant var = getProperty(QStringLiteral("Bearer"));
     339+    return qdbus_cast<QString>(var);
     340+}
     341+
     342+QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property)
     343+{
     344+    QVariant var;
     345+    QVariantMap map = getProperties();
     346+    if (map.contains(property))
     347+        var = map.value(property);
     348+    return var;
     349+}
     350+
     351+QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
     352+{
     353+    if (propertiesMap.isEmpty()) {
     354+        QList<QVariant> argumentList;
     355+        QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
     356+        if (!reply.isError()) {
     357+            propertiesMap = reply.value();
     358+        }
     359+    }
     360+    return propertiesMap;
     361+}
     362+
     363+void QOfonoDataConnectionManagerInterface::propertyChanged(const QString &name, const QDBusVariant &value)
     364+{
     365+    propertiesMap[name] = value.variant();
     366+    if (name == QLatin1String("RoamingAllowed"))
     367+        Q_EMIT roamingAllowedChanged(value.variant().toBool());
     368+}
     369+
     370+
     371+QOfonoConnectionContextInterface::QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent)
     372+    : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
     373+                             dbusPathName,
     374+                             OFONO_CONNECTION_CONTEXT_INTERFACE,
     375+                             QDBusConnection::systemBus(), parent)
     376+{
     377+    QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
     378+                                         path(),
     379+                                         QLatin1String(OFONO_MODEM_INTERFACE),
     380+                                         QLatin1String("PropertyChanged"),
     381+                                         this,SLOT(propertyChanged(QString,QDBusVariant)));
     382+}
     383+
     384+QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface()
     385+{
     386+}
     387+
     388+QVariantMap QOfonoConnectionContextInterface::getProperties()
     389+{
     390+    if (propertiesMap.isEmpty()) {
     391+        QList<QVariant> argumentList;
     392+        QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
     393+        if (!reply.isError()) {
     394+            propertiesMap = reply.value();
     395+        }
     396+    }
     397+    return propertiesMap;
     398+}
     399+
     400+void QOfonoConnectionContextInterface::propertyChanged(const QString &name, const QDBusVariant &value)
     401+{
     402+    propertiesMap[name] = value.variant();
     403+}
     404+
     405+QVariant QOfonoConnectionContextInterface::getProperty(const QString &property)
     406+{
     407+    QVariant var;
     408+    QVariantMap map = getProperties();
     409+    if (map.contains(property))
     410+        var = map.value(property);
     411+    return var;
     412+}
     413+
     414+bool QOfonoConnectionContextInterface::active()
     415+{
     416+    QVariant var = getProperty(QStringLiteral("Active"));
     417+    return qdbus_cast<bool>(var);
     418+}
     419+
     420+QString QOfonoConnectionContextInterface::accessPointName()
     421+{
     422+    QVariant var = getProperty(QStringLiteral("AccessPointName"));
     423+    return qdbus_cast<QString>(var);
     424+}
     425+
     426+QString QOfonoConnectionContextInterface::name()
     427+{
     428+    QVariant var = getProperty(QStringLiteral("Name"));
     429+    return qdbus_cast<QString>(var);
     430+}
     431+
     432+QT_END_NAMESPACE
     433+
     434+#endif // QT_NO_DBUS
     435+#endif // QT_NO_BEARERMANAGEMENT
     436--- /dev/null
     437+++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
     438@@ -0,0 +1,195 @@
     439+/****************************************************************************
     440+**
     441+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     442+** Contact: http://www.qt-project.org/legal
     443+**
     444+** This file is part of the plugins of the Qt Toolkit.
     445+**
     446+** $QT_BEGIN_LICENSE:LGPL21$
     447+** Commercial License Usage
     448+** Licensees holding valid commercial Qt licenses may use this file in
     449+** accordance with the commercial license agreement provided with the
     450+** Software or, alternatively, in accordance with the terms contained in
     451+** a written agreement between you and Digia. For licensing terms and
     452+** conditions see http://qt.digia.com/licensing. For further information
     453+** use the contact form at http://qt.digia.com/contact-us.
     454+**
     455+** GNU Lesser General Public License Usage
     456+** Alternatively, this file may be used under the terms of the GNU Lesser
     457+** General Public License version 2.1 or version 3 as published by the Free
     458+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     459+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     460+** following information to ensure the GNU Lesser General Public License
     461+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     462+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     463+**
     464+** In addition, as a special exception, Digia gives you certain additional
     465+** rights. These rights are described in the Digia Qt LGPL Exception
     466+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     467+**
     468+** $QT_END_LICENSE$
     469+**
     470+****************************************************************************/
     471+
     472+#ifndef QOFONOSERVICE_H
     473+#define QOFONOSERVICE_H
     474+
     475+//
     476+//  W A R N I N G
     477+//  -------------
     478+//
     479+// This file is not part of the Qt API.  It exists purely as an
     480+// implementation detail.  This header file may change from version to
     481+// version without notice, or even be removed.
     482+//
     483+// We mean it.
     484+//
     485+
     486+#include <QtDBus/QtDBus>
     487+#include <QtDBus/QDBusConnection>
     488+#include <QtDBus/QDBusError>
     489+#include <QtDBus/QDBusInterface>
     490+#include <QtDBus/QDBusMessage>
     491+#include <QtDBus/QDBusReply>
     492+
     493+#include <QtDBus/QDBusPendingCallWatcher>
     494+#include <QtDBus/QDBusObjectPath>
     495+#include <QtDBus/QDBusContext>
     496+#include <QMap>
     497+
     498+#ifndef QT_NO_BEARERMANAGEMENT
     499+#ifndef QT_NO_DBUS
     500+
     501+#define OFONO_SERVICE                            "org.ofono"
     502+#define OFONO_MANAGER_INTERFACE                  "org.ofono.Manager"
     503+#define OFONO_MANAGER_PATH                       "/"
     504+
     505+#define OFONO_MODEM_INTERFACE                    "org.ofono.Modem"
     506+#define OFONO_NETWORK_REGISTRATION_INTERFACE     "org.ofono.NetworkRegistration"
     507+#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE  "org.ofono.ConnectionManager"
     508+#define OFONO_CONNECTION_CONTEXT_INTERFACE       "org.ofono.ConnectionContext"
     509+
     510+QT_BEGIN_NAMESPACE
     511+
     512+QT_END_NAMESPACE
     513+
     514+struct ObjectPathProperties
     515+{
     516+    QDBusObjectPath path;
     517+    QVariantMap properties;
     518+};
     519+typedef QList<ObjectPathProperties> PathPropertiesList;
     520+Q_DECLARE_METATYPE(ObjectPathProperties)
     521+Q_DECLARE_METATYPE (PathPropertiesList)
     522+
     523+QT_BEGIN_NAMESPACE
     524+
     525+class QOfonoManagerInterface : public  QDBusAbstractInterface
     526+{
     527+    Q_OBJECT
     528+
     529+public:
     530+
     531+    QOfonoManagerInterface( QObject *parent = 0);
     532+    ~QOfonoManagerInterface();
     533+
     534+    QStringList getModems();
     535+    QString currentModem();
     536+signals:
     537+    void modemChanged();
     538+private:
     539+    QStringList modemList;
     540+private slots:
     541+    void modemAdded(const QDBusObjectPath &path, const QVariantMap &var);
     542+    void modemRemoved(const QDBusObjectPath &path);
     543+};
     544+
     545+class QOfonoModemInterface : public QDBusAbstractInterface
     546+{
     547+    Q_OBJECT
     548+
     549+public:
     550+
     551+    explicit QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0);
     552+    ~QOfonoModemInterface();
     553+
     554+    bool isPowered();
     555+    bool isOnline();
     556+private:
     557+    QVariantMap getProperties();
     558+    QVariantMap propertiesMap;
     559+    QVariant getProperty(const QString &);
     560+    void propertyChanged(const QString &, const QDBusVariant &value);
     561+};
     562+
     563+
     564+class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
     565+{
     566+    Q_OBJECT
     567+
     568+public:
     569+
     570+    explicit QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0);
     571+    ~QOfonoNetworkRegistrationInterface();
     572+
     573+    QString getTechnology();
     574+
     575+private:
     576+    QVariantMap getProperties();
     577+    QVariant getProperty(const QString &);
     578+    QVariantMap propertiesMap;
     579+Q_SIGNALS:
     580+    void propertyChanged(const QString &, const QDBusVariant &value);
     581+};
     582+
     583+class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface
     584+{
     585+    Q_OBJECT
     586+
     587+public:
     588+
     589+    explicit QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0);
     590+    ~QOfonoDataConnectionManagerInterface();
     591+
     592+    QStringList contexts();
     593+    bool roamingAllowed();
     594+    QVariant getProperty(const QString &);
     595+    QString bearer();
     596+Q_SIGNALS:
     597+    void roamingAllowedChanged(bool);
     598+private:
     599+    QVariantMap getProperties();
     600+    QVariantMap propertiesMap;
     601+    QStringList contextList;
     602+private slots:
     603+    void propertyChanged(const QString &, const QDBusVariant &value);
     604+};
     605+
     606+class QOfonoConnectionContextInterface : public QDBusAbstractInterface
     607+{
     608+    Q_OBJECT
     609+
     610+public:
     611+
     612+    explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0);
     613+    ~QOfonoConnectionContextInterface();
     614+
     615+    QVariant getProperty(const QString &);
     616+    bool active();
     617+    QString accessPointName();
     618+    QString name();
     619+
     620+Q_SIGNALS:
     621+private:
     622+    QVariantMap getProperties();
     623+    QVariantMap propertiesMap;
     624+private slots:
     625+    void propertyChanged(const QString &, const QDBusVariant &value);
     626+};
     627+
     628+QT_END_NAMESPACE
     629+
     630+#endif // QT_NO_DBUS
     631+#endif // QT_NO_BEARERMANAGEMENT
     632+
     633+#endif //QOFONOSERVICE_H
     634--- qtbase/src/plugins/bearer/connman/qofonoservice_linux.cpp
     635+++ /dev/null
     636@@ -1,311 +0,0 @@
     637-/****************************************************************************
     638-**
     639-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     640-** Contact: http://www.qt-project.org/legal
     641-**
     642-** This file is part of the plugins of the Qt Toolkit.
     643-**
     644-** $QT_BEGIN_LICENSE:LGPL$
     645-** Commercial License Usage
     646-** Licensees holding valid commercial Qt licenses may use this file in
     647-** accordance with the commercial license agreement provided with the
     648-** Software or, alternatively, in accordance with the terms contained in
     649-** a written agreement between you and Digia.  For licensing terms and
     650-** conditions see http://qt.digia.com/licensing.  For further information
     651-** use the contact form at http://qt.digia.com/contact-us.
     652-**
     653-** GNU Lesser General Public License Usage
     654-** Alternatively, this file may be used under the terms of the GNU Lesser
     655-** General Public License version 2.1 as published by the Free Software
     656-** Foundation and appearing in the file LICENSE.LGPL included in the
     657-** packaging of this file.  Please review the following information to
     658-** ensure the GNU Lesser General Public License version 2.1 requirements
     659-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     660-**
     661-** In addition, as a special exception, Digia gives you certain additional
     662-** rights.  These rights are described in the Digia Qt LGPL Exception
     663-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     664-**
     665-** GNU General Public License Usage
     666-** Alternatively, this file may be used under the terms of the GNU
     667-** General Public License version 3.0 as published by the Free Software
     668-** Foundation and appearing in the file LICENSE.GPL included in the
     669-** packaging of this file.  Please review the following information to
     670-** ensure the GNU General Public License version 3.0 requirements will be
     671-** met: http://www.gnu.org/copyleft/gpl.html.
     672-**
     673-**
     674-** $QT_END_LICENSE$
     675-**
     676-****************************************************************************/
     677-
     678-#include <QObject>
     679-#include <QList>
     680-#include <QtDBus/QtDBus>
     681-#include <QtDBus/QDBusConnection>
     682-#include <QtDBus/QDBusError>
     683-#include <QtDBus/QDBusInterface>
     684-#include <QtDBus/QDBusMessage>
     685-#include <QtDBus/QDBusReply>
     686-#include <QtDBus/QDBusPendingCallWatcher>
     687-#include <QtDBus/QDBusObjectPath>
     688-#include <QtDBus/QDBusPendingCall>
     689-
     690-#include "qofonoservice_linux_p.h"
     691-
     692-#ifndef QT_NO_BEARERMANAGEMENT
     693-#ifndef QT_NO_DBUS
     694-
     695-QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item)
     696-{
     697-    argument.beginStructure();
     698-    argument << item.path << item.properties;
     699-    argument.endStructure();
     700-    return argument;
     701-}
     702-
     703-const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathProperties &item)
     704-{
     705-    argument.beginStructure();
     706-    argument >> item.path >> item.properties;
     707-    argument.endStructure();
     708-    return argument;
     709-}
     710-
     711-QT_BEGIN_NAMESPACE
     712-
     713-QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
     714-        : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     715-                                 QStringLiteral(OFONO_MANAGER_PATH),
     716-                                 OFONO_MANAGER_INTERFACE,
     717-                                 QDBusConnection::systemBus(), parent)
     718-{
     719-    qDBusRegisterMetaType<ObjectPathProperties>();
     720-    qDBusRegisterMetaType<PathPropertiesList>();
     721-
     722-    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     723-                           QStringLiteral(OFONO_MANAGER_PATH),
     724-                           QStringLiteral(OFONO_MANAGER_INTERFACE),
     725-                           QStringLiteral("ModemAdded"),
     726-                           this,SLOT(modemAdded(QDBusObjectPath, QVariantMap)));
     727-    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     728-                           QStringLiteral(OFONO_MANAGER_PATH),
     729-                           QStringLiteral(OFONO_MANAGER_INTERFACE),
     730-                           QStringLiteral("ModemRemoved"),
     731-                           this,SLOT(modemRemoved(QDBusObjectPath)));
     732-}
     733-
     734-QOfonoManagerInterface::~QOfonoManagerInterface()
     735-{
     736-}
     737-
     738-QStringList QOfonoManagerInterface::getModems()
     739-{
     740-    if (modemList.isEmpty()) {
     741-        QList<QVariant> argumentList;
     742-        QDBusPendingReply<PathPropertiesList> reply = asyncCallWithArgumentList(QLatin1String("GetModems"), argumentList);
     743-        reply.waitForFinished();
     744-        if (!reply.isError()) {
     745-            foreach (ObjectPathProperties modem, reply.value()) {
     746-                modemList << modem.path.path();
     747-            }
     748-        } else {
     749-            qDebug() << reply.error().message();
     750-        }
     751-    }
     752-
     753-    return modemList;
     754-}
     755-
     756-QString QOfonoManagerInterface::currentModem()
     757-{
     758-    QStringList modems = getModems();
     759-    foreach (const QString &modem, modems) {
     760-        QOfonoModemInterface device(modem);
     761-        if (device.isPowered() && device.isOnline())
     762-        return modem;
     763-    }
     764-    return QString();
     765-}
     766-
     767-void QOfonoManagerInterface::modemAdded(const QDBusObjectPath &path, const QVariantMap &/*var*/)
     768-{
     769-    if (!modemList.contains(path.path())) {
     770-        modemList << path.path();
     771-        Q_EMIT modemChanged();
     772-    }
     773-}
     774-
     775-void QOfonoManagerInterface::modemRemoved(const QDBusObjectPath &path)
     776-{
     777-    if (modemList.contains(path.path())) {
     778-        modemList.removeOne(path.path());
     779-        Q_EMIT modemChanged();
     780-    }
     781-}
     782-
     783-
     784-QOfonoModemInterface::QOfonoModemInterface(const QString &dbusPathName, QObject *parent)
     785-    : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     786-                             dbusPathName,
     787-                             OFONO_MODEM_INTERFACE,
     788-                             QDBusConnection::systemBus(), parent)
     789-{
     790-    QDBusConnection::systemBus().connect(QStringLiteral(OFONO_SERVICE),
     791-                                         path(),
     792-                                         OFONO_MODEM_INTERFACE,
     793-                                         QStringLiteral("PropertyChanged"),
     794-                                         this,SLOT(propertyChanged(QString,QDBusVariant)));
     795-}
     796-
     797-QOfonoModemInterface::~QOfonoModemInterface()
     798-{
     799-}
     800-
     801-void QOfonoModemInterface::propertyChanged(const QString &name,const QDBusVariant &value)
     802-{
     803-    propertiesMap[name] = value.variant();
     804-}
     805-
     806-bool QOfonoModemInterface::isPowered()
     807-{
     808-    QVariant var = getProperty(QStringLiteral("Powered"));
     809-    return qdbus_cast<bool>(var);
     810-}
     811-
     812-bool QOfonoModemInterface::isOnline()
     813-{
     814-    QVariant var = getProperty(QStringLiteral("Online"));
     815-    return qdbus_cast<bool>(var);
     816-}
     817-
     818-QVariantMap QOfonoModemInterface::getProperties()
     819-{
     820-    if (propertiesMap.isEmpty()) {
     821-        QList<QVariant> argumentList;
     822-        QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
     823-        if (!reply.isError()) {
     824-            propertiesMap = reply.value();
     825-        }
     826-    }
     827-    return propertiesMap;
     828-}
     829-
     830-QVariant QOfonoModemInterface::getProperty(const QString &property)
     831-{
     832-    QVariant var;
     833-    QVariantMap map = getProperties();
     834-    var = map.value(property);
     835-    return var;
     836-}
     837-
     838-
     839-QOfonoNetworkRegistrationInterface::QOfonoNetworkRegistrationInterface(const QString &dbusPathName, QObject *parent)
     840-    : QDBusAbstractInterface(QStringLiteral(OFONO_SERVICE),
     841-                             dbusPathName,
     842-                             OFONO_NETWORK_REGISTRATION_INTERFACE,
     843-                             QDBusConnection::systemBus(), parent)
     844-{
     845-}
     846-
     847-QOfonoNetworkRegistrationInterface::~QOfonoNetworkRegistrationInterface()
     848-{
     849-}
     850-
     851-QString QOfonoNetworkRegistrationInterface::getTechnology()
     852-{
     853-    QVariant var = getProperty(QStringLiteral("Technology"));
     854-    return qdbus_cast<QString>(var);
     855-}
     856-
     857-QVariant QOfonoNetworkRegistrationInterface::getProperty(const QString &property)
     858-{
     859-    QVariant var;
     860-    QVariantMap map = getProperties();
     861-    var = map.value(property);
     862-    return var;
     863-}
     864-
     865-QVariantMap QOfonoNetworkRegistrationInterface::getProperties()
     866-{
     867-    if (propertiesMap.isEmpty()) {
     868-        QList<QVariant> argumentList;
     869-        QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
     870-        reply.waitForFinished();
     871-        if (!reply.isError()) {
     872-            propertiesMap = reply.value();
     873-        } else {
     874-            qDebug() << reply.error().message();
     875-        }
     876-    }
     877-    return propertiesMap;
     878-}
     879-
     880-QOfonoDataConnectionManagerInterface::QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent)
     881-    : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
     882-                             dbusPathName,
     883-                             OFONO_DATA_CONNECTION_MANAGER_INTERFACE,
     884-                             QDBusConnection::systemBus(), parent)
     885-{
     886-    QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE),
     887-                                         path(),
     888-                                         QLatin1String(OFONO_MODEM_INTERFACE),
     889-                                         QLatin1String("PropertyChanged"),
     890-                                         this,SLOT(propertyChanged(QString,QDBusVariant)));
     891-}
     892-
     893-QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface()
     894-{
     895-}
     896-
     897-QStringList QOfonoDataConnectionManagerInterface::contexts()
     898-{
     899-    if (contextList.isEmpty()) {
     900-        QDBusPendingReply<PathPropertiesList > reply = call(QLatin1String("GetContexts"));
     901-        reply.waitForFinished();
     902-        if (!reply.isError()) {
     903-            foreach (ObjectPathProperties context, reply.value()) {
     904-                contextList << context.path.path();
     905-            }
     906-        }
     907-    }
     908-    return contextList;
     909-}
     910-
     911-bool QOfonoDataConnectionManagerInterface::roamingAllowed()
     912-{
     913-    QVariant var = getProperty(QStringLiteral("RoamingAllowed"));
     914-    return qdbus_cast<bool>(var);
     915-}
     916-
     917-QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property)
     918-{
     919-    QVariant var;
     920-    QVariantMap map = getProperties();
     921-    var = map.value(property);
     922-    return var;
     923-}
     924-
     925-QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
     926-{
     927-    if (propertiesMap.isEmpty()) {
     928-        QList<QVariant> argumentList;
     929-        QDBusPendingReply<QVariantMap> reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
     930-        if (!reply.isError()) {
     931-            propertiesMap = reply.value();
     932-        }
     933-    }
     934-    return propertiesMap;
     935-}
     936-
     937-void QOfonoDataConnectionManagerInterface::propertyChanged(const QString &name, const QDBusVariant &value)
     938-{
     939-    propertiesMap[name] = value.variant();
     940-    if (name == QStringLiteral("RoamingAllowed"))
     941-        Q_EMIT roamingAllowedChanged(value.variant().toBool());
     942-}
     943-
     944-QT_END_NAMESPACE
     945-
     946-#endif // QT_NO_DBUS
     947-#endif // QT_NO_BEARERMANAGEMENT
     948--- qtbase/src/plugins/bearer/connman/qofonoservice_linux_p.h
     949+++ /dev/null
     950@@ -1,180 +0,0 @@
     951-/****************************************************************************
     952-**
     953-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     954-** Contact: http://www.qt-project.org/legal
     955-**
     956-** This file is part of the plugins of the Qt Toolkit.
     957-**
     958-** $QT_BEGIN_LICENSE:LGPL$
     959-** Commercial License Usage
     960-** Licensees holding valid commercial Qt licenses may use this file in
     961-** accordance with the commercial license agreement provided with the
     962-** Software or, alternatively, in accordance with the terms contained in
     963-** a written agreement between you and Digia.  For licensing terms and
     964-** conditions see http://qt.digia.com/licensing.  For further information
     965-** use the contact form at http://qt.digia.com/contact-us.
     966-**
     967-** GNU Lesser General Public License Usage
     968-** Alternatively, this file may be used under the terms of the GNU Lesser
     969-** General Public License version 2.1 as published by the Free Software
     970-** Foundation and appearing in the file LICENSE.LGPL included in the
     971-** packaging of this file.  Please review the following information to
     972-** ensure the GNU Lesser General Public License version 2.1 requirements
     973-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     974-**
     975-** In addition, as a special exception, Digia gives you certain additional
     976-** rights.  These rights are described in the Digia Qt LGPL Exception
     977-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     978-**
     979-** GNU General Public License Usage
     980-** Alternatively, this file may be used under the terms of the GNU
     981-** General Public License version 3.0 as published by the Free Software
     982-** Foundation and appearing in the file LICENSE.GPL included in the
     983-** packaging of this file.  Please review the following information to
     984-** ensure the GNU General Public License version 3.0 requirements will be
     985-** met: http://www.gnu.org/copyleft/gpl.html.
     986-**
     987-**
     988-** $QT_END_LICENSE$
     989-**
     990-****************************************************************************/
     991-
     992-#ifndef QOFONOSERVICE_H
     993-#define QOFONOSERVICE_H
     994-
     995-//
     996-//  W A R N I N G
     997-//  -------------
     998-//
     999-// This file is not part of the Qt API.  It exists purely as an
     1000-// implementation detail.  This header file may change from version to
     1001-// version without notice, or even be removed.
     1002-//
     1003-// We mean it.
     1004-//
     1005-
     1006-#include <QtDBus/QtDBus>
     1007-#include <QtDBus/QDBusConnection>
     1008-#include <QtDBus/QDBusError>
     1009-#include <QtDBus/QDBusInterface>
     1010-#include <QtDBus/QDBusMessage>
     1011-#include <QtDBus/QDBusReply>
     1012-
     1013-#include <QtDBus/QDBusPendingCallWatcher>
     1014-#include <QtDBus/QDBusObjectPath>
     1015-#include <QtDBus/QDBusContext>
     1016-#include <QMap>
     1017-
     1018-#ifndef QT_NO_BEARERMANAGEMENT
     1019-#ifndef QT_NO_DBUS
     1020-
     1021-#define OFONO_SERVICE                            "org.ofono"
     1022-#define OFONO_MANAGER_INTERFACE                  "org.ofono.Manager"
     1023-#define OFONO_MANAGER_PATH                       "/"
     1024-
     1025-#define OFONO_MODEM_INTERFACE                    "org.ofono.Modem"
     1026-#define OFONO_NETWORK_REGISTRATION_INTERFACE     "org.ofono.NetworkRegistration"
     1027-#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE  "org.ofono.ConnectionManager"
     1028-
     1029-QT_BEGIN_NAMESPACE
     1030-
     1031-QT_END_NAMESPACE
     1032-
     1033-struct ObjectPathProperties
     1034-{
     1035-    QDBusObjectPath path;
     1036-    QVariantMap properties;
     1037-};
     1038-typedef QList<ObjectPathProperties> PathPropertiesList;
     1039-Q_DECLARE_METATYPE(ObjectPathProperties)
     1040-Q_DECLARE_METATYPE (PathPropertiesList)
     1041-
     1042-QT_BEGIN_NAMESPACE
     1043-
     1044-class QOfonoManagerInterface : public  QDBusAbstractInterface
     1045-{
     1046-    Q_OBJECT
     1047-
     1048-public:
     1049-
     1050-    QOfonoManagerInterface( QObject *parent = 0);
     1051-    ~QOfonoManagerInterface();
     1052-
     1053-    QStringList getModems();
     1054-    QString currentModem();
     1055-signals:
     1056-    void modemChanged();
     1057-private:
     1058-    QStringList modemList;
     1059-private slots:
     1060-    void modemAdded(const QDBusObjectPath &path, const QVariantMap &var);
     1061-    void modemRemoved(const QDBusObjectPath &path);
     1062-};
     1063-
     1064-class QOfonoModemInterface : public QDBusAbstractInterface
     1065-{
     1066-    Q_OBJECT
     1067-
     1068-public:
     1069-
     1070-    explicit QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0);
     1071-    ~QOfonoModemInterface();
     1072-
     1073-    bool isPowered();
     1074-    bool isOnline();
     1075-private:
     1076-    QVariantMap getProperties();
     1077-    QVariantMap propertiesMap;
     1078-    QVariant getProperty(const QString &);
     1079-    void propertyChanged(const QString &, const QDBusVariant &value);
     1080-};
     1081-
     1082-
     1083-class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
     1084-{
     1085-    Q_OBJECT
     1086-
     1087-public:
     1088-
     1089-    explicit QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0);
     1090-    ~QOfonoNetworkRegistrationInterface();
     1091-
     1092-    QString getTechnology();
     1093-
     1094-private:
     1095-    QVariantMap getProperties();
     1096-    QVariant getProperty(const QString &);
     1097-    QVariantMap propertiesMap;
     1098-Q_SIGNALS:
     1099-    void propertyChanged(const QString &, const QDBusVariant &value);
     1100-};
     1101-
     1102-class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface
     1103-{
     1104-    Q_OBJECT
     1105-
     1106-public:
     1107-
     1108-    explicit QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0);
     1109-    ~QOfonoDataConnectionManagerInterface();
     1110-
     1111-    QStringList contexts();
     1112-    bool roamingAllowed();
     1113-Q_SIGNALS:
     1114-    void roamingAllowedChanged(bool);
     1115-private:
     1116-    QVariantMap getProperties();
     1117-    QVariantMap propertiesMap;
     1118-    QVariant getProperty(const QString &);
     1119-    QStringList contextList;
     1120-private slots:
     1121-    void propertyChanged(const QString &, const QDBusVariant &value);
     1122-};
     1123-
     1124-
     1125-QT_END_NAMESPACE
     1126-
     1127-#endif // QT_NO_DBUS
     1128-#endif // QT_NO_BEARERMANAGEMENT
     1129-
     1130-#endif //QOFONOSERVICE_H
     1131--- qtbase/src/plugins/bearer/networkmanager/main.cpp
     1132+++ qtbase/src/plugins/bearer/networkmanager/main.cpp
     1133@@ -1,40 +1,32 @@
     1134 /****************************************************************************
     1135 **
     1136-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     1137+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     1138 ** Contact: http://www.qt-project.org/legal
     1139 **
     1140 ** This file is part of the plugins of the Qt Toolkit.
     1141 **
     1142-** $QT_BEGIN_LICENSE:LGPL$
     1143+** $QT_BEGIN_LICENSE:LGPL21$
     1144 ** Commercial License Usage
     1145 ** Licensees holding valid commercial Qt licenses may use this file in
     1146 ** accordance with the commercial license agreement provided with the
     1147 ** Software or, alternatively, in accordance with the terms contained in
     1148-** a written agreement between you and Digia.  For licensing terms and
     1149-** conditions see http://qt.digia.com/licensing.  For further information
     1150+** a written agreement between you and Digia. For licensing terms and
     1151+** conditions see http://qt.digia.com/licensing. For further information
     1152 ** use the contact form at http://qt.digia.com/contact-us.
     1153 **
     1154 ** GNU Lesser General Public License Usage
     1155 ** Alternatively, this file may be used under the terms of the GNU Lesser
     1156-** General Public License version 2.1 as published by the Free Software
     1157-** Foundation and appearing in the file LICENSE.LGPL included in the
     1158-** packaging of this file.  Please review the following information to
     1159-** ensure the GNU Lesser General Public License version 2.1 requirements
     1160-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     1161+** General Public License version 2.1 or version 3 as published by the Free
     1162+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     1163+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     1164+** following information to ensure the GNU Lesser General Public License
     1165+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     1166+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     1167 **
     1168 ** In addition, as a special exception, Digia gives you certain additional
     1169-** rights.  These rights are described in the Digia Qt LGPL Exception
     1170+** rights. These rights are described in the Digia Qt LGPL Exception
     1171 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     1172 **
     1173-** GNU General Public License Usage
     1174-** Alternatively, this file may be used under the terms of the GNU
     1175-** General Public License version 3.0 as published by the Free Software
     1176-** Foundation and appearing in the file LICENSE.GPL included in the
     1177-** packaging of this file.  Please review the following information to
     1178-** ensure the GNU General Public License version 3.0 requirements will be
     1179-** met: http://www.gnu.org/copyleft/gpl.html.
     1180-**
     1181-**
     1182 ** $QT_END_LICENSE$
     1183 **
     1184 ****************************************************************************/
     1185--- qtbase/src/plugins/bearer/networkmanager/networkmanager.pro
     1186+++ qtbase/src/plugins/bearer/networkmanager/networkmanager.pro
     1187@@ -6,16 +6,16 @@
     1188 
     1189 QT = core network-private dbus
     1190 
     1191-HEADERS += qnmdbushelper.h \
     1192-           qnetworkmanagerservice.h \
     1193+HEADERS += qnetworkmanagerservice.h \
     1194            qnetworkmanagerengine.h \
     1195+           ../linux_common/qofonoservice_linux_p.h \
     1196            ../qnetworksession_impl.h \
     1197            ../qbearerengine_impl.h
     1198 
     1199 SOURCES += main.cpp \
     1200-           qnmdbushelper.cpp \
     1201            qnetworkmanagerservice.cpp \
     1202            qnetworkmanagerengine.cpp \
     1203+           ../linux_common/qofonoservice_linux.cpp \
     1204            ../qnetworksession_impl.cpp
     1205 
     1206 OTHER_FILES += networkmanager.json
     1207--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
     1208+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
     1209@@ -1,40 +1,32 @@
     1210 /****************************************************************************
     1211 **
     1212-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     1213+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     1214 ** Contact: http://www.qt-project.org/legal
     1215 **
     1216 ** This file is part of the plugins of the Qt Toolkit.
     1217 **
     1218-** $QT_BEGIN_LICENSE:LGPL$
     1219+** $QT_BEGIN_LICENSE:LGPL21$
     1220 ** Commercial License Usage
     1221 ** Licensees holding valid commercial Qt licenses may use this file in
     1222 ** accordance with the commercial license agreement provided with the
     1223 ** Software or, alternatively, in accordance with the terms contained in
     1224-** a written agreement between you and Digia.  For licensing terms and
     1225-** conditions see http://qt.digia.com/licensing.  For further information
     1226+** a written agreement between you and Digia. For licensing terms and
     1227+** conditions see http://qt.digia.com/licensing. For further information
     1228 ** use the contact form at http://qt.digia.com/contact-us.
     1229 **
     1230 ** GNU Lesser General Public License Usage
     1231 ** Alternatively, this file may be used under the terms of the GNU Lesser
     1232-** General Public License version 2.1 as published by the Free Software
     1233-** Foundation and appearing in the file LICENSE.LGPL included in the
     1234-** packaging of this file.  Please review the following information to
     1235-** ensure the GNU Lesser General Public License version 2.1 requirements
     1236-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     1237+** General Public License version 2.1 or version 3 as published by the Free
     1238+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     1239+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     1240+** following information to ensure the GNU Lesser General Public License
     1241+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     1242+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     1243 **
     1244 ** In addition, as a special exception, Digia gives you certain additional
     1245-** rights.  These rights are described in the Digia Qt LGPL Exception
     1246+** rights. These rights are described in the Digia Qt LGPL Exception
     1247 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     1248 **
     1249-** GNU General Public License Usage
     1250-** Alternatively, this file may be used under the terms of the GNU
     1251-** General Public License version 3.0 as published by the Free Software
     1252-** Foundation and appearing in the file LICENSE.GPL included in the
     1253-** packaging of this file.  Please review the following information to
     1254-** ensure the GNU General Public License version 3.0 requirements will be
     1255-** met: http://www.gnu.org/copyleft/gpl.html.
     1256-**
     1257-**
     1258 ** $QT_END_LICENSE$
     1259 **
     1260 ****************************************************************************/
     1261@@ -55,6 +47,7 @@
     1262 #include <QDBusInterface>
     1263 #include <QDBusMessage>
     1264 #include <QDBusReply>
     1265+#include "../linux_common/qofonoservice_linux_p.h"
     1266 
     1267 #ifndef QT_NO_BEARERMANAGEMENT
     1268 #ifndef QT_NO_DBUS
     1269@@ -63,130 +56,113 @@
     1270 
     1271 QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
     1272 :   QBearerEngineImpl(parent),
     1273-    interface(new QNetworkManagerInterface(this)),
     1274-    systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)),
     1275-    userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this))
     1276+    managerInterface(new QNetworkManagerInterface(this)),
     1277+    systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE, this)),
     1278+    ofonoManager(new QOfonoManagerInterface(this))
     1279 {
     1280-    if (!interface->isValid())
     1281+
     1282+    if (!managerInterface->isValid())
     1283         return;
     1284 
     1285-    interface->setConnections();
     1286-    connect(interface, SIGNAL(deviceAdded(QDBusObjectPath)),
     1287+    qDBusRegisterMetaType<QNmSettingsMap>();
     1288+
     1289+    connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
     1290             this, SLOT(deviceAdded(QDBusObjectPath)));
     1291-    connect(interface, SIGNAL(deviceRemoved(QDBusObjectPath)),
     1292+    connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
     1293             this, SLOT(deviceRemoved(QDBusObjectPath)));
     1294-#if 0
     1295-    connect(interface, SIGNAL(stateChanged(QString,quint32)),
     1296-            this, SIGNAL(configurationsChanged()));
     1297-#endif
     1298-    connect(interface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
     1299+    connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
     1300             this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
     1301-    connect(interface, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
     1302-            this, SLOT(interfacePropertiesChanged(QString,QMap<QString,QVariant>)));
     1303-
     1304-    qDBusRegisterMetaType<QNmSettingsMap>();
     1305+    connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     1306+            this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
     1307+    managerInterface->setConnections();
     1308 
     1309-    systemSettings->setConnections();
     1310     connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
     1311             this, SLOT(newConnection(QDBusObjectPath)));
     1312-
     1313-    userSettings->setConnections();
     1314-    connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)),
     1315-            this, SLOT(newConnection(QDBusObjectPath)));
     1316+    systemSettings->setConnections();
     1317 }
     1318 
     1319 QNetworkManagerEngine::~QNetworkManagerEngine()
     1320 {
     1321     qDeleteAll(connections);
     1322+    connections.clear();
     1323     qDeleteAll(accessPoints);
     1324+    accessPoints.clear();
     1325     qDeleteAll(wirelessDevices);
     1326-    qDeleteAll(activeConnections);
     1327+    wirelessDevices.clear();
     1328+    qDeleteAll(activeConnectionsList);
     1329+    activeConnectionsList.clear();
     1330+    qDeleteAll(interfaceDevices);
     1331+    interfaceDevices.clear();
     1332+
     1333+    connectionInterfaces.clear();
     1334+
     1335+    qDeleteAll(ofonoContextManagers);
     1336+    ofonoContextManagers.clear();
     1337+
     1338+    qDeleteAll(wiredDevices);
     1339+    wiredDevices.clear();
     1340 }
     1341 
     1342 void QNetworkManagerEngine::initialize()
     1343 {
     1344     QMutexLocker locker(&mutex);
     1345 
     1346-    // Get current list of access points.
     1347-    foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
     1348+    if (ofonoManager->isValid()) {
     1349+        Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
     1350+            QOfonoDataConnectionManagerInterface *ofonoContextManager
     1351+                    = new QOfonoDataConnectionManagerInterface(modem,this);
     1352+            ofonoContextManagers.insert(modem, ofonoContextManager);
     1353+        }
     1354+    }
     1355+    // Get active connections.
     1356+    foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
     1357+
     1358+        QNetworkManagerConnectionActive *activeConnection =
     1359+                new QNetworkManagerConnectionActive(acPath.path(),this);
     1360+        activeConnectionsList.insert(acPath.path(), activeConnection);
     1361+        connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     1362+                this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
     1363+        activeConnection->setConnections();
     1364+
     1365+        QStringList devices = activeConnection->devices();
     1366+        if (!devices.isEmpty()) {
     1367+            QNetworkManagerInterfaceDevice device(devices.at(0),this);
     1368+            connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
     1369+        }
     1370+    }
     1371+
     1372+        // Get current list of access points.
     1373+    foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
     1374         locker.unlock();
     1375-        deviceAdded(devicePath);
     1376+        deviceAdded(devicePath); //add all accesspoints
     1377         locker.relock();
     1378     }
     1379 
     1380     // Get connections.
     1381     foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
     1382         locker.unlock();
     1383-        newConnection(settingsPath, systemSettings);
     1384-        locker.relock();
     1385-    }
     1386-    foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) {
     1387-        locker.unlock();
     1388-        newConnection(settingsPath, userSettings);
     1389+        if (!hasIdentifier(settingsPath.path()))
     1390+            newConnection(settingsPath, systemSettings); //add system connection configs
     1391         locker.relock();
     1392     }
     1393 
     1394-    // Get active connections.
     1395-    foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
     1396-        QNetworkManagerConnectionActive *activeConnection =
     1397-            new QNetworkManagerConnectionActive(acPath.path());
     1398-        activeConnections.insert(acPath.path(), activeConnection);
     1399-
     1400-        activeConnection->setConnections();
     1401-        connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
     1402-                this, SLOT(activeConnectionPropertiesChanged(QString,QMap<QString,QVariant>)));
     1403-    }
     1404+    Q_EMIT updateCompleted();
     1405 }
     1406 
     1407 bool QNetworkManagerEngine::networkManagerAvailable() const
     1408 {
     1409-    QMutexLocker locker(&mutex);
     1410-
     1411-    return interface->isValid();
     1412+    return managerInterface->isValid();
     1413 }
     1414 
     1415-QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
     1416+QString QNetworkManagerEngine::getInterfaceFromId(const QString &settingsPath)
     1417 {
     1418-    QMutexLocker locker(&mutex);
     1419-
     1420-    foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
     1421-        QNetworkManagerConnectionActive activeConnection(acPath.path());
     1422-
     1423-        const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' +
     1424-                                                         activeConnection.connection().path()));
     1425-
     1426-        if (id == identifier) {
     1427-            QList<QDBusObjectPath> devices = activeConnection.devices();
     1428-
     1429-            if (devices.isEmpty())
     1430-                continue;
     1431-
     1432-            QNetworkManagerInterfaceDevice device(devices.at(0).path());
     1433-            return device.networkInterface();
     1434-        }
     1435-    }
     1436-
     1437-    return QString();
     1438+    return connectionInterfaces.value(settingsPath);
     1439 }
     1440 
     1441 bool QNetworkManagerEngine::hasIdentifier(const QString &id)
     1442 {
     1443     QMutexLocker locker(&mutex);
     1444-
     1445-    if (connectionFromId(id))
     1446-        return true;
     1447-
     1448-    for (int i = 0; i < accessPoints.count(); ++i) {
     1449-        QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i);
     1450-
     1451-        const QString identifier =
     1452-            QString::number(qHash(accessPoint->connectionInterface()->path()));
     1453-
     1454-        if (id == identifier)
     1455-            return true;
     1456-    }
     1457-
     1458-    return false;
     1459+    return accessPointConfigurations.contains(id);
     1460 }
     1461 
     1462 void QNetworkManagerEngine::connectToId(const QString &id)
     1463@@ -198,47 +174,54 @@
     1464     if (!connection)
     1465         return;
     1466 
     1467-    QNmSettingsMap map = connection->getSettings();
     1468-    const QString connectionType = map.value("connection").value("type").toString();
     1469+    NMDeviceType connectionType = connection->getType();
     1470 
     1471     QString dbusDevicePath;
     1472-    foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
     1473-        QNetworkManagerInterfaceDevice device(devicePath.path());
     1474-        if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET &&
     1475-            connectionType == QLatin1String("802-3-ethernet")) {
     1476-            dbusDevicePath = devicePath.path();
     1477+    const QString settingsPath = connection->connectionInterface()->path();
     1478+    QString specificPath = configuredAccessPoints.key(settingsPath);
     1479+
     1480+    QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
     1481+    while (i.hasNext()) {
     1482+        i.next();
     1483+        if (i.value()->deviceType() == DEVICE_TYPE_ETHERNET &&
     1484+            connectionType == DEVICE_TYPE_ETHERNET) {
     1485+            dbusDevicePath = i.key();
     1486             break;
     1487-        } else if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS &&
     1488-                   connectionType == QLatin1String("802-11-wireless")) {
     1489-            dbusDevicePath = devicePath.path();
     1490+        } else if (i.value()->deviceType() == DEVICE_TYPE_WIFI &&
     1491+                   connectionType == DEVICE_TYPE_WIFI) {
     1492+            dbusDevicePath = i.key();
     1493             break;
     1494-        }
     1495-        else if (device.deviceType() == DEVICE_TYPE_GSM &&
     1496-                connectionType == QLatin1String("gsm")) {
     1497-            dbusDevicePath = devicePath.path();
     1498+        } else if (i.value()->deviceType() == DEVICE_TYPE_MODEM &&
     1499+                connectionType == DEVICE_TYPE_MODEM) {
     1500+            dbusDevicePath = i.key();
     1501             break;
     1502         }
     1503     }
     1504 
     1505-    const QString service = connection->connectionInterface()->service();
     1506-    const QString settingsPath = connection->connectionInterface()->path();
     1507+    if (specificPath.isEmpty())
     1508+        specificPath = "/";
     1509 
     1510-    interface->activateConnection(service, QDBusObjectPath(settingsPath),
     1511-                                  QDBusObjectPath(dbusDevicePath), QDBusObjectPath("/"));
     1512+    managerInterface->activateConnection(QDBusObjectPath(settingsPath),
     1513+                                  QDBusObjectPath(dbusDevicePath), QDBusObjectPath(specificPath));
     1514 }
     1515 
     1516 void QNetworkManagerEngine::disconnectFromId(const QString &id)
     1517 {
     1518     QMutexLocker locker(&mutex);
     1519 
     1520-    foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
     1521-        QNetworkManagerConnectionActive activeConnection(acPath.path());
     1522-
     1523-        const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' +
     1524-                                                         activeConnection.connection().path()));
     1525+    QNetworkManagerSettingsConnection *connection = connectionFromId(id);
     1526+    QNmSettingsMap map = connection->getSettings();
     1527+    bool connectionAutoconnect = map.value("connection").value("autoconnect",true).toBool(); //if not present is true !!
     1528+    if (connectionAutoconnect) { //autoconnect connections will simply be reconnected by nm
     1529+        emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
     1530+        return;
     1531+    }
     1532 
     1533-        if (id == identifier && accessPointConfigurations.contains(id)) {
     1534-            interface->deactivateConnection(acPath);
     1535+    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
     1536+    while (i.hasNext()) {
     1537+        i.next();
     1538+        if (id == i.value()->connection().path() && accessPointConfigurations.contains(id)) {
     1539+            managerInterface->deactivateConnection(QDBusObjectPath(i.key()));
     1540             break;
     1541         }
     1542     }
     1543@@ -246,16 +229,24 @@
     1544 
     1545 void QNetworkManagerEngine::requestUpdate()
     1546 {
     1547+    if (managerInterface->wirelessEnabled()) {
     1548+        QHashIterator<QString, QNetworkManagerInterfaceDeviceWireless *> i(wirelessDevices);
     1549+        while (i.hasNext()) {
     1550+            i.next();
     1551+            i.value()->requestScan();
     1552+        }
     1553+    }
     1554     QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
     1555 }
     1556 
     1557-void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
     1558-                                                       const QMap<QString, QVariant> &properties)
     1559+void QNetworkManagerEngine::scanFinished()
     1560 {
     1561-    QMutexLocker locker(&mutex);
     1562-
     1563-    Q_UNUSED(path)
     1564+    QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
     1565+}
     1566 
     1567+void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVariant> &properties)
     1568+{
     1569+    QMutexLocker locker(&mutex);
     1570     QMapIterator<QString, QVariant> i(properties);
     1571     while (i.hasNext()) {
     1572         i.next();
     1573@@ -267,35 +258,37 @@
     1574                 qdbus_cast<QList<QDBusObjectPath> >(i.value().value<QDBusArgument>());
     1575 
     1576             QStringList identifiers = accessPointConfigurations.keys();
     1577-            foreach (const QString &id, identifiers)
     1578-                QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     1579-
     1580-            QStringList priorActiveConnections = this->activeConnections.keys();
     1581+            QStringList priorActiveConnections = activeConnectionsList.keys();
     1582 
     1583             foreach (const QDBusObjectPath &acPath, activeConnections) {
     1584                 priorActiveConnections.removeOne(acPath.path());
     1585                 QNetworkManagerConnectionActive *activeConnection =
     1586-                    this->activeConnections.value(acPath.path());
     1587+                    activeConnectionsList.value(acPath.path());
     1588+
     1589                 if (!activeConnection) {
     1590-                    activeConnection = new QNetworkManagerConnectionActive(acPath.path());
     1591-                    this->activeConnections.insert(acPath.path(), activeConnection);
     1592+                    activeConnection = new QNetworkManagerConnectionActive(acPath.path(),this);
     1593+                    activeConnectionsList.insert(acPath.path(), activeConnection);
     1594 
     1595+                    connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     1596+                            this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
     1597                     activeConnection->setConnections();
     1598-                    connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
     1599-                            this, SLOT(activeConnectionPropertiesChanged(QString,QMap<QString,QVariant>)));
     1600                 }
     1601 
     1602-                const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' +
     1603-                                                         activeConnection->connection().path()));
     1604+                const QString id = activeConnection->connection().path();
     1605 
     1606                 identifiers.removeOne(id);
     1607 
     1608                 QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     1609                 if (ptr) {
     1610                     ptr->mutex.lock();
     1611-                    if (activeConnection->state() == 2 &&
     1612+                    if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
     1613                         ptr->state != QNetworkConfiguration::Active) {
     1614                         ptr->state = QNetworkConfiguration::Active;
     1615+
     1616+                        if (activeConnectionsList.value(id) && activeConnectionsList.value(id)->defaultRoute()
     1617+                                && managerInterface->state() < QNetworkManagerInterface::NM_STATE_CONNECTED_GLOBAL) {
     1618+                            ptr->purpose = QNetworkConfiguration::PrivatePurpose;
     1619+                        }
     1620                         ptr->mutex.unlock();
     1621 
     1622                         locker.unlock();
     1623@@ -308,16 +301,16 @@
     1624             }
     1625 
     1626             while (!priorActiveConnections.isEmpty())
     1627-                delete this->activeConnections.take(priorActiveConnections.takeFirst());
     1628+                delete activeConnectionsList.take(priorActiveConnections.takeFirst());
     1629 
     1630             while (!identifiers.isEmpty()) {
     1631-                // These configurations are not active
     1632                 QNetworkConfigurationPrivatePointer ptr =
     1633                     accessPointConfigurations.value(identifiers.takeFirst());
     1634 
     1635                 ptr->mutex.lock();
     1636                 if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
     1637-                    ptr->state = QNetworkConfiguration::Discovered;
     1638+                    QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
     1639+                    ptr->state = (flag | QNetworkConfiguration::Discovered);
     1640                     ptr->mutex.unlock();
     1641 
     1642                     locker.unlock();
     1643@@ -331,66 +324,96 @@
     1644     }
     1645 }
     1646 
     1647-void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path,
     1648-                                                              const QMap<QString, QVariant> &properties)
     1649+void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties)
     1650 {
     1651     QMutexLocker locker(&mutex);
     1652 
     1653     Q_UNUSED(properties)
     1654 
     1655-    QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path);
     1656+    QNetworkManagerConnectionActive *activeConnection = qobject_cast<QNetworkManagerConnectionActive *>(sender());
     1657 
     1658     if (!activeConnection)
     1659         return;
     1660 
     1661-    const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' +
     1662-                                             activeConnection->connection().path()));
     1663+    const QString id = activeConnection->connection().path();
     1664 
     1665     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     1666     if (ptr) {
     1667         ptr->mutex.lock();
     1668-        if (activeConnection->state() == 2 &&
     1669-            ptr->state != QNetworkConfiguration::Active) {
     1670-            ptr->state = QNetworkConfiguration::Active;
     1671+        if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
     1672+            QStringList devices = activeConnection->devices();
     1673+            if (!devices.isEmpty()) {
     1674+                QNetworkManagerInterfaceDevice device(devices.at(0),this);
     1675+                connectionInterfaces.insert(id,device.networkInterface());
     1676+            }
     1677+
     1678+            ptr->state |= QNetworkConfiguration::Active;
     1679             ptr->mutex.unlock();
     1680 
     1681             locker.unlock();
     1682             emit configurationChanged(ptr);
     1683             locker.relock();
     1684         } else {
     1685+            connectionInterfaces.remove(id);
     1686             ptr->mutex.unlock();
     1687         }
     1688     }
     1689 }
     1690 
     1691-void QNetworkManagerEngine::devicePropertiesChanged(const QString &path,
     1692-                                                    const QMap<QString, QVariant> &properties)
     1693+void QNetworkManagerEngine::deviceConnectionsChanged(const QStringList &connectionsList)
     1694 {
     1695-    Q_UNUSED(path);
     1696-    Q_UNUSED(properties);
     1697+    QMutexLocker locker(&mutex);
     1698+    for (int i = 0; i < connections.count(); ++i) {
     1699+        if (connectionsList.contains(connections.at(i)->connectionInterface()->path()))
     1700+            continue;
     1701+
     1702+        const QString settingsPath = connections.at(i)->connectionInterface()->path();
     1703+
     1704+        QNetworkConfigurationPrivatePointer ptr =
     1705+            accessPointConfigurations.value(settingsPath);
     1706+        ptr->mutex.lock();
     1707+        QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
     1708+        ptr->state = (flag | QNetworkConfiguration::Discovered);
     1709+        ptr->mutex.unlock();
     1710+
     1711+        locker.unlock();
     1712+        emit configurationChanged(ptr);
     1713+        locker.relock();
     1714+        Q_EMIT updateCompleted();
     1715+    }
     1716 }
     1717 
     1718 void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
     1719 {
     1720-    QNetworkManagerInterfaceDevice device(path.path());
     1721-    if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
     1722+    QNetworkManagerInterfaceDevice *iDevice;
     1723+    iDevice = new QNetworkManagerInterfaceDevice(path.path(),this);
     1724+    connect(iDevice,SIGNAL(connectionsChanged(QStringList)),
     1725+            this,SLOT(deviceConnectionsChanged(QStringList)));
     1726+
     1727+    iDevice->setConnections();
     1728+    interfaceDevices.insert(path.path(),iDevice);
     1729+    if (iDevice->deviceType() == DEVICE_TYPE_WIFI) {
     1730         QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
     1731-            new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path());
     1732+            new QNetworkManagerInterfaceDeviceWireless(iDevice->connectionInterface()->path(),this);
     1733 
     1734+        connect(wirelessDevice, SIGNAL(accessPointAdded(QString)),
     1735+                this, SLOT(newAccessPoint(QString)));
     1736+        connect(wirelessDevice, SIGNAL(accessPointRemoved(QString)),
     1737+                this, SLOT(removeAccessPoint(QString)));
     1738+        connect(wirelessDevice,SIGNAL(scanDone()),this,SLOT(scanFinished()));
     1739         wirelessDevice->setConnections();
     1740-        connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)),
     1741-                this, SLOT(newAccessPoint(QString,QDBusObjectPath)));
     1742-        connect(wirelessDevice, SIGNAL(accessPointRemoved(QString,QDBusObjectPath)),
     1743-                this, SLOT(removeAccessPoint(QString,QDBusObjectPath)));
     1744-        connect(wirelessDevice, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
     1745-                this, SLOT(devicePropertiesChanged(QString,QMap<QString,QVariant>)));
     1746 
     1747         foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
     1748-            newAccessPoint(QString(), apPath);
     1749+            newAccessPoint(apPath.path());
     1750 
     1751-        mutex.lock();
     1752         wirelessDevices.insert(path.path(), wirelessDevice);
     1753-        mutex.unlock();
     1754+    }
     1755+
     1756+    if (iDevice->deviceType() == DEVICE_TYPE_ETHERNET) {
     1757+        QNetworkManagerInterfaceDeviceWired *wiredDevice =
     1758+                new QNetworkManagerInterfaceDeviceWired(iDevice->connectionInterface()->path(),this);
     1759+        connect(wiredDevice,SIGNAL(carrierChanged(bool)),this,SLOT(wiredCarrierChanged(bool)));
     1760+        wiredDevices.insert(iDevice->connectionInterface()->path(), wiredDevice);
     1761     }
     1762 }
     1763 
     1764@@ -398,50 +421,126 @@
     1765 {
     1766     QMutexLocker locker(&mutex);
     1767 
     1768-    delete wirelessDevices.take(path.path());
     1769+    if (interfaceDevices.contains(path.path())) {
     1770+        locker.unlock();
     1771+        delete interfaceDevices.take(path.path());
     1772+        locker.relock();
     1773+    }
     1774+    if (wirelessDevices.contains(path.path())) {
     1775+        locker.unlock();
     1776+        delete wirelessDevices.take(path.path());
     1777+        locker.relock();
     1778+    }
     1779+    if (wiredDevices.contains(path.path())) {
     1780+        locker.unlock();
     1781+        delete wiredDevices.take(path.path());
     1782+        locker.relock();
     1783+    }
     1784+}
     1785+
     1786+void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
     1787+{
     1788+    QNetworkManagerInterfaceDeviceWired *deviceWired = qobject_cast<QNetworkManagerInterfaceDeviceWired *>(sender());
     1789+    if (!deviceWired)
     1790+        return;
     1791+    QMutexLocker locker(&mutex);
     1792+    foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
     1793+        for (int i = 0; i < connections.count(); ++i) {
     1794+            QNetworkManagerSettingsConnection *connection = connections.at(i);
     1795+            if (connection->getType() == DEVICE_TYPE_ETHERNET
     1796+                    && settingsPath.path() == connection->connectionInterface()->path()) {
     1797+                QNetworkConfigurationPrivatePointer ptr =
     1798+                        accessPointConfigurations.value(settingsPath.path());
     1799+
     1800+                if (ptr) {
     1801+                    ptr->mutex.lock();
     1802+                    if (carrier)
     1803+                        ptr->state |= QNetworkConfiguration::Discovered;
     1804+                    else
     1805+                        ptr->state = QNetworkConfiguration::Defined;
     1806+                    ptr->mutex.unlock();
     1807+                    locker.unlock();
     1808+                    emit configurationChanged(ptr);
     1809+                    return;
     1810+                }
     1811+            }
     1812+        }
     1813+    }
     1814 }
     1815 
     1816 void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
     1817                                           QNetworkManagerSettings *settings)
     1818 {
     1819     QMutexLocker locker(&mutex);
     1820-
     1821     if (!settings)
     1822         settings = qobject_cast<QNetworkManagerSettings *>(sender());
     1823 
     1824-    if (!settings)
     1825+    if (!settings) {
     1826         return;
     1827+    }
     1828 
     1829     QNetworkManagerSettingsConnection *connection =
     1830         new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(),
     1831-                                              path.path());
     1832+                                              path.path(),this);
     1833+    const QString settingsPath = connection->connectionInterface()->path();
     1834+    if (accessPointConfigurations.contains(settingsPath)) {
     1835+        return;
     1836+    }
     1837+
     1838     connections.append(connection);
     1839 
     1840-    connect(connection, SIGNAL(removed(QString)), this, SLOT(removeConnection(QString)));
     1841-    connect(connection, SIGNAL(updated(QNmSettingsMap)),
     1842-            this, SLOT(updateConnection(QNmSettingsMap)));
     1843+    connect(connection,SIGNAL(removed(QString)),this,SLOT(removeConnection(QString)));
     1844+    connect(connection,SIGNAL(updated()),this,SLOT(updateConnection()));
     1845+    connection->setConnections();
     1846 
     1847-    const QString service = connection->connectionInterface()->service();
     1848-    const QString settingsPath = connection->connectionInterface()->path();
     1849+    NMDeviceType deviceType = connection->getType();
     1850+
     1851+    if (deviceType == DEVICE_TYPE_WIFI) {
     1852+        QString apPath;
     1853+        for (int i = 0; i < accessPoints.count(); ++i) {
     1854+            if (connection->getSsid() == accessPoints.at(i)->ssid()) {
     1855+                // remove the corresponding accesspoint from configurations
     1856+                apPath = accessPoints.at(i)->connectionInterface()->path();
     1857+                QNetworkConfigurationPrivatePointer ptr
     1858+                        = accessPointConfigurations.take(apPath);
     1859+                if (ptr) {
     1860+                    locker.unlock();
     1861+                    emit configurationRemoved(ptr);
     1862+                    locker.relock();
     1863+                }
     1864+            }
     1865+        }
     1866+        if (!configuredAccessPoints.contains(settingsPath))
     1867+            configuredAccessPoints.insert(apPath,settingsPath);
     1868+    }
     1869 
     1870     QNetworkConfigurationPrivate *cpPriv =
     1871-        parseConnection(service, settingsPath, connection->getSettings());
     1872+        parseConnection(settingsPath, connection->getSettings());
     1873 
     1874     // Check if connection is active.
     1875-    foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
     1876-        QNetworkManagerConnectionActive activeConnection(acPath.path());
     1877-
     1878-        if (activeConnection.serviceName() == service &&
     1879-            activeConnection.connection().path() == settingsPath &&
     1880-            activeConnection.state() == 2) {
     1881+    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
     1882+    while (i.hasNext()) {
     1883+        i.next();
     1884+        if (i.value()->connection().path() == settingsPath) {
     1885             cpPriv->state |= QNetworkConfiguration::Active;
     1886             break;
     1887         }
     1888     }
     1889-
     1890+    if (deviceType == DEVICE_TYPE_ETHERNET) {
     1891+        QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
     1892+        while (i.hasNext()) {
     1893+             i.next();
     1894+             if (i.value()->deviceType() == deviceType) {
     1895+                QNetworkManagerInterfaceDeviceWired *wiredDevice
     1896+                        = wiredDevices.value(i.value()->connectionInterface()->path());
     1897+                 if (wiredDevice->carrier()) {
     1898+                     cpPriv->state |= QNetworkConfiguration::Discovered;
     1899+                 }
     1900+             }
     1901+         }
     1902+     }
     1903     QNetworkConfigurationPrivatePointer ptr(cpPriv);
     1904     accessPointConfigurations.insert(ptr->id, ptr);
     1905-
     1906     locker.unlock();
     1907     emit configurationAdded(ptr);
     1908 }
     1909@@ -450,27 +549,36 @@
     1910 {
     1911     QMutexLocker locker(&mutex);
     1912 
     1913-    Q_UNUSED(path)
     1914-
     1915     QNetworkManagerSettingsConnection *connection =
     1916         qobject_cast<QNetworkManagerSettingsConnection *>(sender());
     1917+
     1918     if (!connection)
     1919         return;
     1920 
     1921+    connection->deleteLater();
     1922     connections.removeAll(connection);
     1923 
     1924-    const QString id = QString::number(qHash(connection->connectionInterface()->service() + ' ' +
     1925-                                             connection->connectionInterface()->path()));
     1926+    const QString id = path;
     1927 
     1928     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
     1929 
     1930-    connection->deleteLater();
     1931-
     1932-    locker.unlock();
     1933-    emit configurationRemoved(ptr);
     1934+    if (ptr) {
     1935+        locker.unlock();
     1936+        emit configurationRemoved(ptr);
     1937+        locker.relock();
     1938+    }
     1939+    // add base AP back into configurations
     1940+    QMapIterator<QString, QString> i(configuredAccessPoints);
     1941+    while (i.hasNext()) {
     1942+        i.next();
     1943+        if (i.value() == path) {
     1944+            configuredAccessPoints.remove(i.key());
     1945+            newAccessPoint(i.key());
     1946+        }
     1947+    }
     1948 }
     1949 
     1950-void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings)
     1951+void QNetworkManagerEngine::updateConnection()
     1952 {
     1953     QMutexLocker locker(&mutex);
     1954 
     1955@@ -478,18 +586,15 @@
     1956         qobject_cast<QNetworkManagerSettingsConnection *>(sender());
     1957     if (!connection)
     1958         return;
     1959-
     1960-    const QString service = connection->connectionInterface()->service();
     1961     const QString settingsPath = connection->connectionInterface()->path();
     1962 
     1963-    QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings);
     1964+    QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
     1965 
     1966     // Check if connection is active.
     1967-    foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
     1968+    foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
     1969         QNetworkManagerConnectionActive activeConnection(acPath.path());
     1970 
     1971-        if (activeConnection.serviceName() == service &&
     1972-            activeConnection.connection().path() == settingsPath &&
     1973+        if (activeConnection.connection().path() == settingsPath &&
     1974             activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
     1975             cpPriv->state |= QNetworkConfiguration::Active;
     1976             break;
     1977@@ -509,28 +614,29 @@
     1978 
     1979     locker.unlock();
     1980     emit configurationChanged(ptr);
     1981+    locker.relock();
     1982     delete cpPriv;
     1983 }
     1984 
     1985 void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
     1986 {
     1987     QMutexLocker locker(&mutex);
     1988-
     1989     QDBusPendingReply<QDBusObjectPath> reply(*watcher);
     1990+    watcher->deleteLater();
     1991+
     1992     if (!reply.isError()) {
     1993         QDBusObjectPath result = reply.value();
     1994 
     1995         QNetworkManagerConnectionActive activeConnection(result.path());
     1996 
     1997-        const QString id = QString::number(qHash(activeConnection.serviceName() + ' ' +
     1998-                                                 activeConnection.connection().path()));
     1999+        const QString id = activeConnection.connection().path();
     2000 
     2001         QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     2002         if (ptr) {
     2003             ptr->mutex.lock();
     2004-            if (activeConnection.state() == 2 &&
     2005+            if (activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
     2006                 ptr->state != QNetworkConfiguration::Active) {
     2007-                ptr->state = QNetworkConfiguration::Active;
     2008+                ptr->state |= QNetworkConfiguration::Active;
     2009                 ptr->mutex.unlock();
     2010 
     2011                 locker.unlock();
     2012@@ -543,42 +649,40 @@
     2013     }
     2014 }
     2015 
     2016-void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath)
     2017+void QNetworkManagerEngine::newAccessPoint(const QString &path)
     2018 {
     2019     QMutexLocker locker(&mutex);
     2020 
     2021-    Q_UNUSED(path)
     2022-
     2023     QNetworkManagerInterfaceAccessPoint *accessPoint =
     2024-        new QNetworkManagerInterfaceAccessPoint(objectPath.path());
     2025-    accessPoints.append(accessPoint);
     2026+        new QNetworkManagerInterfaceAccessPoint(path,this);
     2027 
     2028-    accessPoint->setConnections();
     2029-    connect(accessPoint, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
     2030-            this, SLOT(updateAccessPoint(QMap<QString,QVariant>)));
     2031-
     2032-    // Check if configuration for this SSID already exists.
     2033+    bool okToAdd = true;
     2034     for (int i = 0; i < accessPoints.count(); ++i) {
     2035-        if (accessPoint != accessPoints.at(i) &&
     2036-            accessPoint->ssid() == accessPoints.at(i)->ssid()) {
     2037-            return;
     2038+        if (accessPoints.at(i)->connectionInterface()->path() == path) {
     2039+            okToAdd = false;
     2040         }
     2041     }
     2042-
     2043+    if (okToAdd) {
     2044+        accessPoints.append(accessPoint);
     2045+        accessPoint->setConnections();
     2046+    }
     2047     // Check if configuration exists for connection.
     2048     if (!accessPoint->ssid().isEmpty()) {
     2049+
     2050         for (int i = 0; i < connections.count(); ++i) {
     2051             QNetworkManagerSettingsConnection *connection = connections.at(i);
     2052+            const QString settingsPath = connection->connectionInterface()->path();
     2053 
     2054             if (accessPoint->ssid() == connection->getSsid()) {
     2055-                const QString service = connection->connectionInterface()->service();
     2056-                const QString settingsPath = connection->connectionInterface()->path();
     2057-                const QString connectionId = QString::number(qHash(service + ' ' + settingsPath));
     2058+                if (!configuredAccessPoints.contains(path)) {
     2059+                    configuredAccessPoints.insert(path,settingsPath);
     2060+                }
     2061 
     2062                 QNetworkConfigurationPrivatePointer ptr =
     2063-                    accessPointConfigurations.value(connectionId);
     2064+                    accessPointConfigurations.value(settingsPath);
     2065                 ptr->mutex.lock();
     2066-                ptr->state = QNetworkConfiguration::Discovered;
     2067+                QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
     2068+                ptr->state = (flag | QNetworkConfiguration::Discovered);
     2069                 ptr->mutex.unlock();
     2070 
     2071                 locker.unlock();
     2072@@ -593,13 +697,9 @@
     2073 
     2074     ptr->name = accessPoint->ssid();
     2075     ptr->isValid = true;
     2076-    ptr->id = QString::number(qHash(objectPath.path()));
     2077+    ptr->id = path;
     2078     ptr->type = QNetworkConfiguration::InternetAccessPoint;
     2079-    if(accessPoint->flags() == NM_802_11_AP_FLAGS_PRIVACY) {
     2080-        ptr->purpose = QNetworkConfiguration::PrivatePurpose;
     2081-    } else {
     2082-        ptr->purpose = QNetworkConfiguration::PublicPurpose;
     2083-    }
     2084+    ptr->purpose = QNetworkConfiguration::PublicPurpose;
     2085     ptr->state = QNetworkConfiguration::Undefined;
     2086     ptr->bearerType = QNetworkConfiguration::BearerWLAN;
     2087 
     2088@@ -609,30 +709,24 @@
     2089     emit configurationAdded(ptr);
     2090 }
     2091 
     2092-void QNetworkManagerEngine::removeAccessPoint(const QString &path,
     2093-                                              const QDBusObjectPath &objectPath)
     2094+void QNetworkManagerEngine::removeAccessPoint(const QString &path)
     2095 {
     2096     QMutexLocker locker(&mutex);
     2097-
     2098-    Q_UNUSED(path)
     2099-
     2100     for (int i = 0; i < accessPoints.count(); ++i) {
     2101         QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i);
     2102-
     2103-        if (accessPoint->connectionInterface()->path() == objectPath.path()) {
     2104+        if (accessPoint->connectionInterface()->path() == path) {
     2105             accessPoints.removeOne(accessPoint);
     2106 
     2107-            if (configuredAccessPoints.contains(accessPoint)) {
     2108+            if (configuredAccessPoints.contains(accessPoint->connectionInterface()->path())) {
     2109                 // find connection and change state to Defined
     2110-                configuredAccessPoints.removeOne(accessPoint);
     2111+                configuredAccessPoints.remove(accessPoint->connectionInterface()->path());
     2112+
     2113                 for (int i = 0; i < connections.count(); ++i) {
     2114                     QNetworkManagerSettingsConnection *connection = connections.at(i);
     2115 
     2116-                    if (accessPoint->ssid() == connection->getSsid()) {
     2117-                        const QString service = connection->connectionInterface()->service();
     2118+                    if (accessPoint->ssid() == connection->getSsid()) {//might not have bssid yet
     2119                         const QString settingsPath = connection->connectionInterface()->path();
     2120-                        const QString connectionId =
     2121-                            QString::number(qHash(service + ' ' + settingsPath));
     2122+                        const QString connectionId = settingsPath;
     2123 
     2124                         QNetworkConfigurationPrivatePointer ptr =
     2125                             accessPointConfigurations.value(connectionId);
     2126@@ -648,7 +742,7 @@
     2127                 }
     2128             } else {
     2129                 QNetworkConfigurationPrivatePointer ptr =
     2130-                    accessPointConfigurations.take(QString::number(qHash(objectPath.path())));
     2131+                    accessPointConfigurations.take(path);
     2132 
     2133                 if (ptr) {
     2134                     locker.unlock();
     2135@@ -656,111 +750,74 @@
     2136                     locker.relock();
     2137                 }
     2138             }
     2139-
     2140             delete accessPoint;
     2141-
     2142             break;
     2143         }
     2144     }
     2145 }
     2146 
     2147-void QNetworkManagerEngine::updateAccessPoint(const QMap<QString, QVariant> &map)
     2148-{
     2149-    QMutexLocker locker(&mutex);
     2150-
     2151-    Q_UNUSED(map)
     2152-
     2153-    QNetworkManagerInterfaceAccessPoint *accessPoint =
     2154-        qobject_cast<QNetworkManagerInterfaceAccessPoint *>(sender());
     2155-    if (!accessPoint)
     2156-        return;
     2157-
     2158-    for (int i = 0; i < connections.count(); ++i) {
     2159-        QNetworkManagerSettingsConnection *connection = connections.at(i);
     2160-
     2161-        if (accessPoint->ssid() == connection->getSsid()) {
     2162-            const QString service = connection->connectionInterface()->service();
     2163-            const QString settingsPath = connection->connectionInterface()->path();
     2164-            const QString connectionId = QString::number(qHash(service + ' ' + settingsPath));
     2165-
     2166-            QNetworkConfigurationPrivatePointer ptr =
     2167-                accessPointConfigurations.value(connectionId);
     2168-            ptr->mutex.lock();
     2169-            ptr->state = QNetworkConfiguration::Discovered;
     2170-            ptr->mutex.unlock();
     2171-
     2172-            locker.unlock();
     2173-            emit configurationChanged(ptr);
     2174-            return;
     2175-        }
     2176-    }
     2177-}
     2178-
     2179-QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &service,
     2180-                                                                     const QString &settingsPath,
     2181+QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &settingsPath,
     2182                                                                      const QNmSettingsMap &map)
     2183 {
     2184+    QMutexLocker locker(&mutex);
     2185     QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
     2186     cpPriv->name = map.value("connection").value("id").toString();
     2187+
     2188     cpPriv->isValid = true;
     2189-    cpPriv->id = QString::number(qHash(service + ' ' + settingsPath));
     2190+    cpPriv->id = settingsPath;
     2191     cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
     2192 
     2193     cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
     2194 
     2195     cpPriv->state = QNetworkConfiguration::Defined;
     2196-
     2197     const QString connectionType = map.value("connection").value("type").toString();
     2198 
     2199     if (connectionType == QLatin1String("802-3-ethernet")) {
     2200         cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
     2201-        cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
     2202 
     2203-        foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
     2204-            QNetworkManagerInterfaceDevice device(devicePath.path());
     2205-            if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET) {
     2206-                QNetworkManagerInterfaceDeviceWired wiredDevice(device.connectionInterface()->path());
     2207-                if (wiredDevice.carrier()) {
     2208+        foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
     2209+            QNetworkManagerInterfaceDevice device(devicePath.path(),this);
     2210+            if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
     2211+                QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.connectionInterface()->path());
     2212+                if (wiredDevice->carrier()) {
     2213                     cpPriv->state |= QNetworkConfiguration::Discovered;
     2214                     break;
     2215                 }
     2216-
     2217             }
     2218         }
     2219     } else if (connectionType == QLatin1String("802-11-wireless")) {
     2220         cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
     2221 
     2222         const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
     2223-        const QString connectionSecurity = map.value("802-11-wireless").value("security").toString();
     2224-        if(!connectionSecurity.isEmpty()) {
     2225-            cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
     2226-        } else {
     2227-            cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
     2228-        }
     2229         for (int i = 0; i < accessPoints.count(); ++i) {
     2230-            if (connectionSsid == accessPoints.at(i)->ssid()) {
     2231+            if (connectionSsid == accessPoints.at(i)->ssid()
     2232+                    && map.value("802-11-wireless").value("seen-bssids").toStringList().contains(accessPoints.at(i)->hwAddress())) {
     2233                 cpPriv->state |= QNetworkConfiguration::Discovered;
     2234-                if (!configuredAccessPoints.contains(accessPoints.at(i))) {
     2235-                    configuredAccessPoints.append(accessPoints.at(i));
     2236+                if (!configuredAccessPoints.contains(accessPoints.at(i)->connectionInterface()->path())) {
     2237+                    configuredAccessPoints.insert(accessPoints.at(i)->connectionInterface()->path(),settingsPath);
     2238 
     2239-                    const QString accessPointId =
     2240-                        QString::number(qHash(accessPoints.at(i)->connectionInterface()->path()));
     2241+                    const QString accessPointId = accessPoints.at(i)->connectionInterface()->path();
     2242                     QNetworkConfigurationPrivatePointer ptr =
     2243                         accessPointConfigurations.take(accessPointId);
     2244 
     2245                     if (ptr) {
     2246-                        mutex.unlock();
     2247+                        locker.unlock();
     2248                         emit configurationRemoved(ptr);
     2249-                        mutex.lock();
     2250+                        locker.relock();
     2251                     }
     2252                 }
     2253                 break;
     2254             }
     2255         }
     2256-    } else if (connectionType == "gsm") {
     2257-        cpPriv->bearerType = QNetworkConfiguration::Bearer2G;
     2258-    } else if (connectionType == "cdma") {
     2259-        cpPriv->bearerType = QNetworkConfiguration::BearerCDMA2000;
     2260+    } else if (connectionType == QLatin1String("gsm")) {
     2261+
     2262+        const QString contextPath = map.value("connection").value("id").toString();
     2263+        cpPriv->name = contextName(contextPath);
     2264+        cpPriv->bearerType = currentBearerType(contextPath);
     2265+
     2266+        if (map.value("connection").contains("timestamp")) {
     2267+            cpPriv->state |= QNetworkConfiguration::Discovered;
     2268+        }
     2269     }
     2270 
     2271     return cpPriv;
     2272@@ -770,12 +827,7 @@
     2273 {
     2274     for (int i = 0; i < connections.count(); ++i) {
     2275         QNetworkManagerSettingsConnection *connection = connections.at(i);
     2276-        const QString service = connection->connectionInterface()->service();
     2277-        const QString settingsPath = connection->connectionInterface()->path();
     2278-
     2279-        const QString identifier = QString::number(qHash(service + ' ' + settingsPath));
     2280-
     2281-        if (id == identifier)
     2282+        if (id == connection->connectionInterface()->path())
     2283             return connection;
     2284     }
     2285 
     2286@@ -785,7 +837,6 @@
     2287 QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id)
     2288 {
     2289     QMutexLocker locker(&mutex);
     2290-
     2291     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     2292 
     2293     if (!ptr)
     2294@@ -794,11 +845,10 @@
     2295     if (!ptr->isValid)
     2296         return QNetworkSession::Invalid;
     2297 
     2298-    foreach (const QString &acPath, activeConnections.keys()) {
     2299-        QNetworkManagerConnectionActive *activeConnection = activeConnections.value(acPath);
     2300+    foreach (const QString &acPath, activeConnectionsList.keys()) {
     2301+        QNetworkManagerConnectionActive *activeConnection = activeConnectionsList.value(acPath);
     2302 
     2303-        const QString identifier = QString::number(qHash(activeConnection->serviceName() + ' ' +
     2304-                                                         activeConnection->connection().path()));
     2305+        const QString identifier = activeConnection->connection().path();
     2306 
     2307         if (id == identifier) {
     2308             switch (activeConnection->state()) {
     2309@@ -828,7 +878,7 @@
     2310 
     2311     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     2312     if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
     2313-        const QString networkInterface = getInterfaceFromId(id);
     2314+        const QString networkInterface = connectionInterfaces.value(id);
     2315         if (!networkInterface.isEmpty()) {
     2316             const QString devFile = QLatin1String("/sys/class/net/") +
     2317                                     networkInterface +
     2318@@ -856,7 +906,7 @@
     2319 
     2320     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
     2321     if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
     2322-        const QString networkInterface = getInterfaceFromId(id);
     2323+        const QString networkInterface = connectionInterfaces.value(id);
     2324         if (!networkInterface.isEmpty()) {
     2325             const QString devFile = QLatin1String("/sys/class/net/") +
     2326                                     networkInterface +
     2327@@ -892,7 +942,8 @@
     2328 QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const
     2329 {
     2330     return QNetworkConfigurationManager::ForcedRoaming |
     2331-           QNetworkConfigurationManager::CanStartAndStopInterfaces;
     2332+            QNetworkConfigurationManager::DataStatistics |
     2333+            QNetworkConfigurationManager::CanStartAndStopInterfaces;
     2334 }
     2335 
     2336 QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend()
     2337@@ -902,9 +953,67 @@
     2338 
     2339 QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration()
     2340 {
     2341+    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
     2342+    while (i.hasNext()) {
     2343+        i.next();
     2344+        QNetworkManagerConnectionActive *activeConnection = i.value();
     2345+        if ((activeConnection->defaultRoute() || activeConnection->default6Route())) {
     2346+            return accessPointConfigurations.value(activeConnection->connection().path());
     2347+        }
     2348+    }
     2349+
     2350     return QNetworkConfigurationPrivatePointer();
     2351 }
     2352 
     2353+QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
     2354+{
     2355+    if (ofonoManager->isValid()) {
     2356+        QString contextPart = id.section('/', -1);
     2357+
     2358+        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     2359+        while (i.hasNext()) {
     2360+            i.next();
     2361+            QString contextPath = i.key() +"/"+contextPart;
     2362+            if (i.value()->contexts().contains(contextPath)) {
     2363+
     2364+                QString bearer = i.value()->bearer();
     2365+                if (bearer == QStringLiteral("gsm")) {
     2366+                    return QNetworkConfiguration::Bearer2G;
     2367+                } else if (bearer == QStringLiteral("edge")) {
     2368+                    return QNetworkConfiguration::Bearer2G;
     2369+                } else if (bearer == QStringLiteral("umts")) {
     2370+                    return QNetworkConfiguration::BearerWCDMA;
     2371+                } else if (bearer == QStringLiteral("hspa")
     2372+                           || bearer == QStringLiteral("hsdpa")
     2373+                           || bearer == QStringLiteral("hsupa")) {
     2374+                    return QNetworkConfiguration::BearerHSPA;
     2375+                } else if (bearer == QStringLiteral("lte")) {
     2376+                    return QNetworkConfiguration::BearerLTE;
     2377+                }
     2378+            }
     2379+        }
     2380+    }
     2381+    return QNetworkConfiguration::BearerUnknown;
     2382+}
     2383+
     2384+QString QNetworkManagerEngine::contextName(const QString &path)
     2385+{
     2386+    if (ofonoManager->isValid()) {
     2387+        QString contextPart = path.section('/', -1);
     2388+        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
     2389+        while (i.hasNext()) {
     2390+            i.next();
     2391+            Q_FOREACH (const QString &oContext, i.value()->contexts()) {
     2392+                if (oContext.contains(contextPart)) {
     2393+                    QOfonoConnectionContextInterface contextInterface(oContext,this);
     2394+                    return contextInterface.name();
     2395+                }
     2396+            }
     2397+        }
     2398+    }
     2399+    return path;
     2400+}
     2401+
     2402 QT_END_NAMESPACE
     2403 
     2404 #endif // QT_NO_DBUS
     2405--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
     2406+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
     2407@@ -1,40 +1,32 @@
     2408 /****************************************************************************
     2409 **
     2410-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     2411+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     2412 ** Contact: http://www.qt-project.org/legal
     2413 **
     2414 ** This file is part of the plugins of the Qt Toolkit.
     2415 **
     2416-** $QT_BEGIN_LICENSE:LGPL$
     2417+** $QT_BEGIN_LICENSE:LGPL21$
     2418 ** Commercial License Usage
     2419 ** Licensees holding valid commercial Qt licenses may use this file in
     2420 ** accordance with the commercial license agreement provided with the
     2421 ** Software or, alternatively, in accordance with the terms contained in
     2422-** a written agreement between you and Digia.  For licensing terms and
     2423-** conditions see http://qt.digia.com/licensing.  For further information
     2424+** a written agreement between you and Digia. For licensing terms and
     2425+** conditions see http://qt.digia.com/licensing. For further information
     2426 ** use the contact form at http://qt.digia.com/contact-us.
     2427 **
     2428 ** GNU Lesser General Public License Usage
     2429 ** Alternatively, this file may be used under the terms of the GNU Lesser
     2430-** General Public License version 2.1 as published by the Free Software
     2431-** Foundation and appearing in the file LICENSE.LGPL included in the
     2432-** packaging of this file.  Please review the following information to
     2433-** ensure the GNU Lesser General Public License version 2.1 requirements
     2434-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     2435+** General Public License version 2.1 or version 3 as published by the Free
     2436+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     2437+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     2438+** following information to ensure the GNU Lesser General Public License
     2439+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     2440+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     2441 **
     2442 ** In addition, as a special exception, Digia gives you certain additional
     2443-** rights.  These rights are described in the Digia Qt LGPL Exception
     2444+** rights. These rights are described in the Digia Qt LGPL Exception
     2445 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     2446 **
     2447-** GNU General Public License Usage
     2448-** Alternatively, this file may be used under the terms of the GNU
     2449-** General Public License version 3.0 as published by the Free Software
     2450-** Foundation and appearing in the file LICENSE.GPL included in the
     2451-** packaging of this file.  Please review the following information to
     2452-** ensure the GNU General Public License version 3.0 requirements will be
     2453-** met: http://www.gnu.org/copyleft/gpl.html.
     2454-**
     2455-**
     2456 ** $QT_END_LICENSE$
     2457 **
     2458 ****************************************************************************/
     2459@@ -57,6 +49,8 @@
     2460 
     2461 #include "qnetworkmanagerservice.h"
     2462 
     2463+#include "../linux_common/qofonoservice_linux_p.h"
     2464+
     2465 #include <QMap>
     2466 #include <QVariant>
     2467 
     2468@@ -97,40 +91,47 @@
     2469     QNetworkConfigurationPrivatePointer defaultConfiguration();
     2470 
     2471 private Q_SLOTS:
     2472-    void interfacePropertiesChanged(const QString &path,
     2473-                                    const QMap<QString, QVariant> &properties);
     2474-    void activeConnectionPropertiesChanged(const QString &path,
     2475-                                           const QMap<QString, QVariant> &properties);
     2476-    void devicePropertiesChanged(const QString &path,
     2477-                                 const QMap<QString, QVariant> &properties);
     2478+    void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
     2479+    void activeConnectionPropertiesChanged(const QMap<QString, QVariant> &properties);
     2480 
     2481     void deviceAdded(const QDBusObjectPath &path);
     2482     void deviceRemoved(const QDBusObjectPath &path);
     2483 
     2484     void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings = 0);
     2485     void removeConnection(const QString &path);
     2486-    void updateConnection(const QNmSettingsMap &settings);
     2487+    void updateConnection();
     2488     void activationFinished(QDBusPendingCallWatcher *watcher);
     2489+    void deviceConnectionsChanged(const QStringList &activeConnectionsList);
     2490 
     2491-    void newAccessPoint(const QString &path, const QDBusObjectPath &objectPath);
     2492-    void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath);
     2493-    void updateAccessPoint(const QMap<QString, QVariant> &map);
     2494+    void newAccessPoint(const QString &path);
     2495+    void removeAccessPoint(const QString &path);
     2496+    void scanFinished();
     2497+
     2498+    void wiredCarrierChanged(bool);
     2499 
     2500 private:
     2501-    QNetworkConfigurationPrivate *parseConnection(const QString &service,
     2502-                                                  const QString &settingsPath,
     2503+    QNetworkConfigurationPrivate *parseConnection(const QString &settingsPath,
     2504                                                   const QNmSettingsMap &map);
     2505     QNetworkManagerSettingsConnection *connectionFromId(const QString &id) const;
     2506 
     2507-private:
     2508-    QNetworkManagerInterface *interface;
     2509+    QNetworkManagerInterface *managerInterface;
     2510     QNetworkManagerSettings *systemSettings;
     2511-    QNetworkManagerSettings *userSettings;
     2512+    QHash<QString, QNetworkManagerInterfaceDeviceWired *> wiredDevices;
     2513     QHash<QString, QNetworkManagerInterfaceDeviceWireless *> wirelessDevices;
     2514-    QHash<QString, QNetworkManagerConnectionActive *> activeConnections;
     2515+
     2516+    QHash<QString, QNetworkManagerConnectionActive *> activeConnectionsList;
     2517     QList<QNetworkManagerSettingsConnection *> connections;
     2518     QList<QNetworkManagerInterfaceAccessPoint *> accessPoints;
     2519-    QList<QNetworkManagerInterfaceAccessPoint *> configuredAccessPoints;
     2520+    QHash<QString, QNetworkManagerInterfaceDevice *> interfaceDevices;
     2521+
     2522+    QMap<QString,QString> configuredAccessPoints; //ap, settings path
     2523+    QHash<QString,QString> connectionInterfaces; // ac, interface
     2524+
     2525+    QOfonoManagerInterface *ofonoManager;
     2526+    QHash <QString, QOfonoDataConnectionManagerInterface *> ofonoContextManagers;
     2527+    QNetworkConfiguration::BearerType currentBearerType(const QString &id);
     2528+    QString contextName(const QString &path);
     2529+
     2530 };
     2531 
     2532 QT_END_NAMESPACE
     2533--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
     2534+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
     2535@@ -1,40 +1,32 @@
     2536 /****************************************************************************
     2537 **
     2538-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     2539+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     2540 ** Contact: http://www.qt-project.org/legal
     2541 **
     2542 ** This file is part of the plugins of the Qt Toolkit.
     2543 **
     2544-** $QT_BEGIN_LICENSE:LGPL$
     2545+** $QT_BEGIN_LICENSE:LGPL21$
     2546 ** Commercial License Usage
     2547 ** Licensees holding valid commercial Qt licenses may use this file in
     2548 ** accordance with the commercial license agreement provided with the
     2549 ** Software or, alternatively, in accordance with the terms contained in
     2550-** a written agreement between you and Digia.  For licensing terms and
     2551-** conditions see http://qt.digia.com/licensing.  For further information
     2552+** a written agreement between you and Digia. For licensing terms and
     2553+** conditions see http://qt.digia.com/licensing. For further information
     2554 ** use the contact form at http://qt.digia.com/contact-us.
     2555 **
     2556 ** GNU Lesser General Public License Usage
     2557 ** Alternatively, this file may be used under the terms of the GNU Lesser
     2558-** General Public License version 2.1 as published by the Free Software
     2559-** Foundation and appearing in the file LICENSE.LGPL included in the
     2560-** packaging of this file.  Please review the following information to
     2561-** ensure the GNU Lesser General Public License version 2.1 requirements
     2562-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     2563+** General Public License version 2.1 or version 3 as published by the Free
     2564+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     2565+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     2566+** following information to ensure the GNU Lesser General Public License
     2567+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     2568+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     2569 **
     2570 ** In addition, as a special exception, Digia gives you certain additional
     2571-** rights.  These rights are described in the Digia Qt LGPL Exception
     2572+** rights. These rights are described in the Digia Qt LGPL Exception
     2573 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     2574 **
     2575-** GNU General Public License Usage
     2576-** Alternatively, this file may be used under the terms of the GNU
     2577-** General Public License version 3.0 as published by the Free Software
     2578-** Foundation and appearing in the file LICENSE.GPL included in the
     2579-** packaging of this file.  Please review the following information to
     2580-** ensure the GNU General Public License version 3.0 requirements will be
     2581-** met: http://www.gnu.org/copyleft/gpl.html.
     2582-**
     2583-**
     2584 ** $QT_END_LICENSE$
     2585 **
     2586 ****************************************************************************/
     2587@@ -52,7 +44,6 @@
     2588 #include <QtDBus/QDBusPendingCall>
     2589 
     2590 #include "qnetworkmanagerservice.h"
     2591-#include "qnmdbushelper.h"
     2592 
     2593 #ifndef QT_NO_DBUS
     2594 
     2595@@ -72,18 +63,38 @@
     2596     d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
     2597                                                 QLatin1String(NM_DBUS_PATH),
     2598                                                 QLatin1String(NM_DBUS_INTERFACE),
     2599-                                                QDBusConnection::systemBus());
     2600+                                                QDBusConnection::systemBus(),parent);
     2601     if (!d->connectionInterface->isValid()) {
     2602         d->valid = false;
     2603         return;
     2604     }
     2605     d->valid = true;
     2606-    nmDBusHelper = new QNmDBusHelper(this);
     2607-    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
     2608-                    this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
     2609-    connect(nmDBusHelper,SIGNAL(pathForStateChanged(QString,quint32)),
     2610-            this, SIGNAL(stateChanged(QString,quint32)));
     2611 
     2612+    QDBusInterface managerPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     2613+                                                  QLatin1String(NM_DBUS_PATH),
     2614+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     2615+                                                  QDBusConnection::systemBus());
     2616+    QList<QVariant> argumentList;
     2617+    argumentList << QLatin1String(NM_DBUS_INTERFACE);
     2618+    QDBusPendingReply<QVariantMap> propsReply
     2619+            = managerPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     2620+                                                                       argumentList);
     2621+    if (!propsReply.isError()) {
     2622+        propertyMap = propsReply.value();
     2623+    }
     2624+
     2625+    QDBusPendingReply<QList <QDBusObjectPath> > nmReply
     2626+            = d->connectionInterface->call(QLatin1String("GetDevices"));
     2627+    nmReply.waitForFinished();
     2628+    if (!nmReply.isError()) {
     2629+        devicesPathList = nmReply.value();
     2630+    }
     2631+
     2632+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2633+                                  QLatin1String(NM_DBUS_PATH),
     2634+                                  QLatin1String(NM_DBUS_INTERFACE),
     2635+                                  QLatin1String("PropertiesChanged"),
     2636+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     2637 }
     2638 
     2639 QNetworkManagerInterface::~QNetworkManagerInterface()
     2640@@ -99,27 +110,24 @@
     2641 
     2642 bool QNetworkManagerInterface::setConnections()
     2643 {
     2644-    if(!isValid() )
     2645+    if (!isValid())
     2646         return false;
     2647 
     2648-    QDBusConnection dbusConnection = QDBusConnection::systemBus();
     2649-
     2650-    bool allOk = false;
     2651-    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     2652+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2653                                   QLatin1String(NM_DBUS_PATH),
     2654                                   QLatin1String(NM_DBUS_INTERFACE),
     2655                                   QLatin1String("PropertiesChanged"),
     2656-                                nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>)))) {
     2657-        allOk = true;
     2658-    }
     2659-    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     2660+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     2661+
     2662+    bool allOk = false;
     2663+    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2664                                   QLatin1String(NM_DBUS_PATH),
     2665                                   QLatin1String(NM_DBUS_INTERFACE),
     2666                                   QLatin1String("DeviceAdded"),
     2667                                 this,SIGNAL(deviceAdded(QDBusObjectPath)))) {
     2668         allOk = true;
     2669     }
     2670-    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     2671+    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2672                                   QLatin1String(NM_DBUS_PATH),
     2673                                   QLatin1String(NM_DBUS_INTERFACE),
     2674                                   QLatin1String("DeviceRemoved"),
     2675@@ -135,52 +143,106 @@
     2676     return d->connectionInterface;
     2677 }
     2678 
     2679-QList <QDBusObjectPath> QNetworkManagerInterface::getDevices() const
     2680+QList <QDBusObjectPath> QNetworkManagerInterface::getDevices()
     2681 {
     2682-    QDBusReply<QList<QDBusObjectPath> > reply =  d->connectionInterface->call(QLatin1String("GetDevices"));
     2683-    return reply.value();
     2684+    if (devicesPathList.isEmpty()) {
     2685+        qWarning() << "using blocking call!";
     2686+        QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetDevices"));
     2687+        devicesPathList = reply.value();
     2688+    }
     2689+    return devicesPathList;
     2690 }
     2691 
     2692-void QNetworkManagerInterface::activateConnection( const QString &serviceName,
     2693-                                                  QDBusObjectPath connectionPath,
     2694+void QNetworkManagerInterface::activateConnection(QDBusObjectPath connectionPath,
     2695                                                   QDBusObjectPath devicePath,
     2696                                                   QDBusObjectPath specificObject)
     2697 {
     2698     QDBusPendingCall pendingCall = d->connectionInterface->asyncCall(QLatin1String("ActivateConnection"),
     2699-                                                                    QVariant(serviceName),
     2700                                                                     QVariant::fromValue(connectionPath),
     2701                                                                     QVariant::fromValue(devicePath),
     2702                                                                     QVariant::fromValue(specificObject));
     2703 
     2704-   QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall, this);
     2705+   QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall);
     2706    connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
     2707                     this, SIGNAL(activationFinished(QDBusPendingCallWatcher*)));
     2708 }
     2709 
     2710 void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath)  const
     2711 {
     2712-    d->connectionInterface->call(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
     2713+    d->connectionInterface->asyncCall(QLatin1String("DeactivateConnection"), QVariant::fromValue(connectionPath));
     2714 }
     2715 
     2716 bool QNetworkManagerInterface::wirelessEnabled()  const
     2717 {
     2718-    return d->connectionInterface->property("WirelessEnabled").toBool();
     2719+    if (propertyMap.contains("WirelessEnabled"))
     2720+        return propertyMap.value("WirelessEnabled").toBool();
     2721+    return false;
     2722 }
     2723 
     2724 bool QNetworkManagerInterface::wirelessHardwareEnabled()  const
     2725 {
     2726-    return d->connectionInterface->property("WirelessHardwareEnabled").toBool();
     2727+    if (propertyMap.contains("WirelessHardwareEnabled"))
     2728+        return propertyMap.value("WirelessHardwareEnabled").toBool();
     2729+    return false;
     2730 }
     2731 
     2732 QList <QDBusObjectPath> QNetworkManagerInterface::activeConnections() const
     2733 {
     2734-    QVariant prop = d->connectionInterface->property("ActiveConnections");
     2735-    return prop.value<QList<QDBusObjectPath> >();
     2736+    if (propertyMap.contains("ActiveConnections")) {
     2737+
     2738+        const QDBusArgument &dbusArgs = propertyMap.value("ActiveConnections").value<QDBusArgument>();
     2739+        QDBusObjectPath path;
     2740+        QList <QDBusObjectPath> list;
     2741+
     2742+        dbusArgs.beginArray();
     2743+        while (!dbusArgs.atEnd()) {
     2744+            dbusArgs >> path;
     2745+            list.append(path);
     2746+        }
     2747+        dbusArgs.endArray();
     2748+
     2749+        return list;
     2750+    }
     2751+
     2752+    QList <QDBusObjectPath> list;
     2753+    list << QDBusObjectPath();
     2754+    return list;
     2755 }
     2756 
     2757-quint32 QNetworkManagerInterface::state()
     2758+QNetworkManagerInterface::NMState QNetworkManagerInterface::state()
     2759 {
     2760-    return d->connectionInterface->property("State").toUInt();
     2761+    if (propertyMap.contains("State"))
     2762+        return static_cast<QNetworkManagerInterface::NMState>(propertyMap.value("State").toUInt());
     2763+    return QNetworkManagerInterface::NM_STATE_UNKNOWN;
     2764+}
     2765+
     2766+QString QNetworkManagerInterface::version() const
     2767+{
     2768+    if (propertyMap.contains("Version"))
     2769+        return propertyMap.value("Version").toString();
     2770+    return QString();
     2771+}
     2772+
     2773+void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
     2774+{
     2775+    QMapIterator<QString, QVariant> i(map);
     2776+    while (i.hasNext()) {
     2777+        i.next();
     2778+        propertyMap.insert(i.key(),i.value());
     2779+
     2780+        if (i.key() == QStringLiteral("State")) {
     2781+            quint32 state = i.value().toUInt();
     2782+            if (state == NM_DEVICE_STATE_ACTIVATED
     2783+                || state == NM_DEVICE_STATE_DISCONNECTED
     2784+                || state == NM_DEVICE_STATE_UNAVAILABLE
     2785+                || state == NM_DEVICE_STATE_FAILED) {
     2786+                Q_EMIT propertiesChanged(map);
     2787+                Q_EMIT stateChanged(state);
     2788+            }
     2789+        } else if (i.key() == QStringLiteral("ActiveConnections")) {
     2790+            Q_EMIT propertiesChanged(map);
     2791+        }
     2792+    }
     2793 }
     2794 
     2795 class QNetworkManagerInterfaceAccessPointPrivate
     2796@@ -192,18 +254,38 @@
     2797 };
     2798 
     2799 QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
     2800-        : QObject(parent), nmDBusHelper(0)
     2801+        : QObject(parent)
     2802 {
     2803     d = new QNetworkManagerInterfaceAccessPointPrivate();
     2804     d->path = dbusPathName;
     2805     d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
     2806                                                 d->path,
     2807                                                 QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
     2808-                                                QDBusConnection::systemBus());
     2809+                                                QDBusConnection::systemBus(),parent);
     2810     if (!d->connectionInterface->isValid()) {
     2811         d->valid = false;
     2812         return;
     2813     }
     2814+    QDBusInterface accessPointPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     2815+                                                  d->path,
     2816+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     2817+                                                  QDBusConnection::systemBus());
     2818+
     2819+    QList<QVariant> argumentList;
     2820+    argumentList << QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT);
     2821+    QDBusPendingReply<QVariantMap> propsReply
     2822+            = accessPointPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     2823+                                                                       argumentList);
     2824+    if (!propsReply.isError()) {
     2825+        propertyMap = propsReply.value();
     2826+    }
     2827+
     2828+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2829+                                  d->path,
     2830+                                  QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
     2831+                                  QLatin1String("PropertiesChanged"),
     2832+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     2833+
     2834     d->valid = true;
     2835 
     2836 }
     2837@@ -221,24 +303,10 @@
     2838 
     2839 bool QNetworkManagerInterfaceAccessPoint::setConnections()
     2840 {
     2841-    if(!isValid() )
     2842+    if (!isValid())
     2843         return false;
     2844 
     2845-    bool allOk = false;
     2846-    delete nmDBusHelper;
     2847-    nmDBusHelper = new QNmDBusHelper(this);
     2848-    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
     2849-            this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
     2850-
     2851-    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2852-                              d->path,
     2853-                              QLatin1String(NM_DBUS_INTERFACE_ACCESS_POINT),
     2854-                              QLatin1String("PropertiesChanged"),
     2855-                              nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>))) ) {
     2856-        allOk = true;
     2857-
     2858-    }
     2859-    return allOk;
     2860+    return true;
     2861 }
     2862 
     2863 QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const
     2864@@ -248,47 +316,74 @@
     2865 
     2866 quint32 QNetworkManagerInterfaceAccessPoint::flags() const
     2867 {
     2868-    return d->connectionInterface->property("Flags").toUInt();
     2869+    if (propertyMap.contains("Flags"))
     2870+        return propertyMap.value("Flags").toUInt();
     2871+    return 0;
     2872 }
     2873 
     2874 quint32 QNetworkManagerInterfaceAccessPoint::wpaFlags() const
     2875 {
     2876-    return d->connectionInterface->property("WpaFlags").toUInt();
     2877+    if (propertyMap.contains("WpaFlags"))
     2878+        return propertyMap.value("WpaFlags").toUInt();
     2879+    return 0;
     2880 }
     2881 
     2882 quint32 QNetworkManagerInterfaceAccessPoint::rsnFlags() const
     2883 {
     2884-    return d->connectionInterface->property("RsnFlags").toUInt();
     2885+    if (propertyMap.contains("RsnFlags"))
     2886+        return propertyMap.value("RsnFlags").toUInt();
     2887+    return 0;
     2888 }
     2889 
     2890 QString QNetworkManagerInterfaceAccessPoint::ssid() const
     2891 {
     2892-    return d->connectionInterface->property("Ssid").toString();
     2893+    if (propertyMap.contains("Ssid"))
     2894+        return propertyMap.value("Ssid").toString();
     2895+    return QString();
     2896 }
     2897 
     2898 quint32 QNetworkManagerInterfaceAccessPoint::frequency() const
     2899 {
     2900-    return d->connectionInterface->property("Frequency").toUInt();
     2901+    if (propertyMap.contains("Frequency"))
     2902+        return propertyMap.value("Frequency").toUInt();
     2903+    return 0;
     2904 }
     2905 
     2906 QString QNetworkManagerInterfaceAccessPoint::hwAddress() const
     2907 {
     2908-    return d->connectionInterface->property("HwAddress").toString();
     2909+    if (propertyMap.contains("HwAddress"))
     2910+        return propertyMap.value("HwAddress").toString();
     2911+    return QString();
     2912 }
     2913 
     2914 quint32 QNetworkManagerInterfaceAccessPoint::mode() const
     2915 {
     2916-    return d->connectionInterface->property("Mode").toUInt();
     2917+    if (propertyMap.contains("Mode"))
     2918+        return propertyMap.value("Mode").toUInt();
     2919+    return 0;
     2920 }
     2921 
     2922 quint32 QNetworkManagerInterfaceAccessPoint::maxBitrate() const
     2923 {
     2924-    return d->connectionInterface->property("MaxBitrate").toUInt();
     2925+    if (propertyMap.contains("MaxBitrate"))
     2926+        return propertyMap.value("MaxBitrate").toUInt();
     2927+    return 0;
     2928 }
     2929 
     2930 quint32 QNetworkManagerInterfaceAccessPoint::strength() const
     2931 {
     2932-    return d->connectionInterface->property("Strength").toUInt();
     2933+    if (propertyMap.contains("Strength"))
     2934+        return propertyMap.value("Strength").toUInt();
     2935+    return 0;
     2936+}
     2937+
     2938+void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant> map)
     2939+{
     2940+    QMapIterator<QString, QVariant> i(map);
     2941+    while (i.hasNext()) {
     2942+        i.next();
     2943+        propertyMap.insert(i.key(),i.value());
     2944+    }
     2945 }
     2946 
     2947 class QNetworkManagerInterfaceDevicePrivate
     2948@@ -300,18 +395,39 @@
     2949 };
     2950 
     2951 QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
     2952-        : QObject(parent), nmDBusHelper(0)
     2953+        : QObject(parent)
     2954 {
     2955+
     2956     d = new QNetworkManagerInterfaceDevicePrivate();
     2957     d->path = deviceObjectPath;
     2958     d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
     2959                                                 d->path,
     2960                                                 QLatin1String(NM_DBUS_INTERFACE_DEVICE),
     2961-                                                QDBusConnection::systemBus());
     2962+                                                QDBusConnection::systemBus(),parent);
     2963     if (!d->connectionInterface->isValid()) {
     2964         d->valid = false;
     2965         return;
     2966     }
     2967+    QDBusInterface devicePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     2968+                                                  d->path,
     2969+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     2970+                                                  QDBusConnection::systemBus(),parent);
     2971+
     2972+    QList<QVariant> argumentList;
     2973+    argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE);
     2974+    QDBusPendingReply<QVariantMap> propsReply
     2975+            = devicePropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     2976+                                                                       argumentList);
     2977+
     2978+    if (!propsReply.isError()) {
     2979+        propertyMap = propsReply.value();
     2980+    }
     2981+
     2982+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     2983+                                  d->path,
     2984+                                  QLatin1String(NM_DBUS_INTERFACE_DEVICE),
     2985+                                  QLatin1String("PropertiesChanged"),
     2986+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     2987     d->valid = true;
     2988 }
     2989 
     2990@@ -328,22 +444,10 @@
     2991 
     2992 bool QNetworkManagerInterfaceDevice::setConnections()
     2993 {
     2994-    if(!isValid() )
     2995+    if (!isValid())
     2996         return false;
     2997 
     2998-    bool allOk = false;
     2999-    delete nmDBusHelper;
     3000-    nmDBusHelper = new QNmDBusHelper(this);
     3001-    connect(nmDBusHelper,SIGNAL(pathForStateChanged(QString,quint32)),
     3002-            this, SIGNAL(stateChanged(QString,quint32)));
     3003-    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3004-                              d->path,
     3005-                              QLatin1String(NM_DBUS_INTERFACE_DEVICE),
     3006-                              QLatin1String("StateChanged"),
     3007-                              nmDBusHelper,SLOT(deviceStateChanged(quint32)))) {
     3008-        allOk = true;
     3009-    }
     3010-    return allOk;
     3011+    return true;
     3012 }
     3013 
     3014 QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const
     3015@@ -353,33 +457,66 @@
     3016 
     3017 QString QNetworkManagerInterfaceDevice::udi() const
     3018 {
     3019-    return d->connectionInterface->property("Udi").toString();
     3020+    if (propertyMap.contains("Udi"))
     3021+        return propertyMap.value("Udi").toString();
     3022+    return QString();
     3023 }
     3024 
     3025 QString QNetworkManagerInterfaceDevice::networkInterface() const
     3026 {
     3027-    return d->connectionInterface->property("Interface").toString();
     3028+    if (propertyMap.contains("Interface"))
     3029+        return propertyMap.value("Interface").toString();
     3030+    return QString();
     3031 }
     3032 
     3033 quint32 QNetworkManagerInterfaceDevice::ip4Address() const
     3034 {
     3035-    return d->connectionInterface->property("Ip4Address").toUInt();
     3036+    if (propertyMap.contains("Ip4Address"))
     3037+        return propertyMap.value("Ip4Address").toUInt();
     3038+    return 0;
     3039 }
     3040 
     3041 quint32 QNetworkManagerInterfaceDevice::state() const
     3042 {
     3043-    return d->connectionInterface->property("State").toUInt();
     3044+    if (propertyMap.contains("State"))
     3045+        return propertyMap.value("State").toUInt();
     3046+    return 0;
     3047 }
     3048 
     3049 quint32 QNetworkManagerInterfaceDevice::deviceType() const
     3050 {
     3051-    return d->connectionInterface->property("DeviceType").toUInt();
     3052+    if (propertyMap.contains("DeviceType"))
     3053+        return propertyMap.value("DeviceType").toUInt();
     3054+    return 0;
     3055 }
     3056 
     3057 QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
     3058 {
     3059-    QVariant prop = d->connectionInterface->property("Ip4Config");
     3060-    return prop.value<QDBusObjectPath>();
     3061+    if (propertyMap.contains("Ip4Config"))
     3062+        return propertyMap.value("Ip4Config").value<QDBusObjectPath>();
     3063+    return QDBusObjectPath();
     3064+}
     3065+
     3066+void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
     3067+{
     3068+    QMapIterator<QString, QVariant> i(map);
     3069+    while (i.hasNext()) {
     3070+        i.next();
     3071+        if (i.key() == QStringLiteral("AvailableConnections")) { //Device
     3072+            const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
     3073+            QDBusObjectPath path;
     3074+            QStringList paths;
     3075+            dbusArgs.beginArray();
     3076+            while (!dbusArgs.atEnd()) {
     3077+                dbusArgs >> path;
     3078+                paths << path.path();
     3079+            }
     3080+            dbusArgs.endArray();
     3081+            Q_EMIT connectionsChanged(paths);
     3082+        }
     3083+        propertyMap.insert(i.key(),i.value());
     3084+    }
     3085+    Q_EMIT propertiesChanged(map);
     3086 }
     3087 
     3088 class QNetworkManagerInterfaceDeviceWiredPrivate
     3089@@ -391,7 +528,7 @@
     3090 };
     3091 
     3092 QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent)
     3093-    : QObject(parent), nmDBusHelper(0)
     3094+    : QObject(parent)
     3095 {
     3096     d = new QNetworkManagerInterfaceDeviceWiredPrivate();
     3097     d->path = ifaceDevicePath;
     3098@@ -403,6 +540,27 @@
     3099         d->valid = false;
     3100         return;
     3101     }
     3102+    QDBusInterface deviceWiredPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     3103+                                                  d->path,
     3104+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     3105+                                                  QDBusConnection::systemBus(),parent);
     3106+
     3107+    QList<QVariant> argumentList;
     3108+    argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED);
     3109+    QDBusPendingReply<QVariantMap> propsReply
     3110+            = deviceWiredPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     3111+                                                                       argumentList);
     3112+
     3113+    if (!propsReply.isError()) {
     3114+        propertyMap = propsReply.value();
     3115+    }
     3116+
     3117+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3118+                                  d->path,
     3119+                                  QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
     3120+                                  QLatin1String("PropertiesChanged"),
     3121+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     3122+
     3123     d->valid = true;
     3124 }
     3125 
     3126@@ -420,23 +578,9 @@
     3127 
     3128 bool QNetworkManagerInterfaceDeviceWired::setConnections()
     3129 {
     3130-    if(!isValid() )
     3131+    if (!isValid())
     3132         return false;
     3133-
     3134-    bool allOk = false;
     3135-
     3136-    delete nmDBusHelper;
     3137-    nmDBusHelper = new QNmDBusHelper(this);
     3138-    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
     3139-            this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
     3140-    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3141-                              d->path,
     3142-                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRED),
     3143-                              QLatin1String("PropertiesChanged"),
     3144-                              nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>))) )  {
     3145-        allOk = true;
     3146-    }
     3147-    return allOk;
     3148+    return true;
     3149 }
     3150 
     3151 QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const
     3152@@ -446,17 +590,53 @@
     3153 
     3154 QString QNetworkManagerInterfaceDeviceWired::hwAddress() const
     3155 {
     3156-    return d->connectionInterface->property("HwAddress").toString();
     3157+    if (propertyMap.contains("HwAddress"))
     3158+        return propertyMap.value("HwAddress").toString();
     3159+    return QString();
     3160 }
     3161 
     3162 quint32 QNetworkManagerInterfaceDeviceWired::speed() const
     3163 {
     3164-    return d->connectionInterface->property("Speed").toUInt();
     3165+    if (propertyMap.contains("Speed"))
     3166+        return propertyMap.value("Speed").toUInt();
     3167+    return 0;
     3168 }
     3169 
     3170 bool QNetworkManagerInterfaceDeviceWired::carrier() const
     3171 {
     3172-    return d->connectionInterface->property("Carrier").toBool();
     3173+    if (propertyMap.contains("Carrier"))
     3174+        return propertyMap.value("Carrier").toBool();
     3175+    return false;
     3176+}
     3177+
     3178+QStringList QNetworkManagerInterfaceDeviceWired::availableConnections()
     3179+{
     3180+    QStringList list;
     3181+    if (propertyMap.contains("AvailableConnections")) {
     3182+        const QDBusArgument &dbusArgs = propertyMap.value("Carrier").value<QDBusArgument>();
     3183+        QDBusObjectPath path;
     3184+        dbusArgs.beginArray();
     3185+        while (!dbusArgs.atEnd()) {
     3186+            dbusArgs >> path;
     3187+            list << path.path();
     3188+        }
     3189+        dbusArgs.endArray();
     3190+    }
     3191+
     3192+    return list;
     3193+}
     3194+
     3195+void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant> map)
     3196+{
     3197+    QMapIterator<QString, QVariant> i(map);
     3198+    while (i.hasNext()) {
     3199+        i.next();
     3200+        propertyMap.insert(i.key(),i.value());
     3201+        if (i.key() == QStringLiteral("Carrier")) {
     3202+            Q_EMIT carrierChanged(i.value().toBool());
     3203+        }
     3204+    }
     3205+    Q_EMIT propertiesChanged(map);
     3206 }
     3207 
     3208 class QNetworkManagerInterfaceDeviceWirelessPrivate
     3209@@ -468,7 +648,7 @@
     3210 };
     3211 
     3212 QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent)
     3213-    : QObject(parent), nmDBusHelper(0)
     3214+    : QObject(parent)
     3215 {
     3216     d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
     3217     d->path = ifaceDevicePath;
     3218@@ -480,6 +660,34 @@
     3219         d->valid = false;
     3220         return;
     3221     }
     3222+
     3223+
     3224+    QDBusPendingReply<QList <QDBusObjectPath> > nmReply
     3225+            = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
     3226+
     3227+    if (!nmReply.isError()) {
     3228+        accessPointsList = nmReply.value();
     3229+    }
     3230+
     3231+    QDBusInterface deviceWirelessPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     3232+                                                  d->path,
     3233+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     3234+                                                  QDBusConnection::systemBus(),parent);
     3235+
     3236+    QList<QVariant> argumentList;
     3237+    argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS);
     3238+    QDBusPendingReply<QVariantMap> propsReply
     3239+            = deviceWirelessPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     3240+                                                                       argumentList);
     3241+    if (!propsReply.isError()) {
     3242+        propertyMap = propsReply.value();
     3243+    }
     3244+
     3245+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3246+                                  d->path,
     3247+                                  QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     3248+                                  QLatin1String("PropertiesChanged"),
     3249+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     3250     d->valid = true;
     3251 }
     3252 
     3253@@ -494,50 +702,50 @@
     3254     return d->valid;
     3255 }
     3256 
     3257+void QNetworkManagerInterfaceDeviceWireless::slotAccessPointAdded(QDBusObjectPath path)
     3258+{
     3259+    if (path.path().length() > 2)
     3260+        Q_EMIT accessPointAdded(path.path());
     3261+}
     3262+
     3263+void QNetworkManagerInterfaceDeviceWireless::slotAccessPointRemoved(QDBusObjectPath path)
     3264+{
     3265+    if (path.path().length() > 2)
     3266+        Q_EMIT accessPointRemoved(path.path());
     3267+}
     3268+
     3269 bool QNetworkManagerInterfaceDeviceWireless::setConnections()
     3270 {
     3271-    if(!isValid() )
     3272+    if (!isValid())
     3273         return false;
     3274 
     3275     QDBusConnection dbusConnection = QDBusConnection::systemBus();
     3276-    bool allOk = false;
     3277-    delete nmDBusHelper;
     3278-    nmDBusHelper = new QNmDBusHelper(this);
     3279-    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
     3280-            this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
     3281+    bool allOk = true;
     3282 
     3283-    connect(nmDBusHelper, SIGNAL(pathForAccessPointAdded(QString,QDBusObjectPath)),
     3284-            this,SIGNAL(accessPointAdded(QString,QDBusObjectPath)));
     3285-
     3286-    connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(QString,QDBusObjectPath)),
     3287-            this,SIGNAL(accessPointRemoved(QString,QDBusObjectPath)));
     3288-
     3289-    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3290-                              d->path,
     3291+    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3292+                                d->path,
     3293                               QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     3294                               QLatin1String("AccessPointAdded"),
     3295-                              nmDBusHelper, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
     3296-        allOk = true;
     3297+                              this, SLOT(slotAccessPointAdded(QDBusObjectPath)))) {
     3298+        allOk = false;
     3299     }
     3300 
     3301 
     3302-    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3303+    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3304                               d->path,
     3305                               QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     3306                               QLatin1String("AccessPointRemoved"),
     3307-                              nmDBusHelper, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
     3308-        allOk = true;
     3309+                              this, SLOT(slotAccessPointRemoved(QDBusObjectPath)))) {
     3310+        allOk = false;
     3311     }
     3312 
     3313-
     3314-    if(!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3315-                              d->path,
     3316-                              QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     3317-                              QLatin1String("PropertiesChanged"),
     3318-                              nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>)))) {
     3319-        allOk = true;
     3320+    if (!dbusConnection.connect(QLatin1String(NM_DBUS_SERVICE),
     3321+                               d->path,
     3322+                               QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
     3323+                               QLatin1String("ScanDone"),
     3324+                               this, SLOT(scanIsDone()))) {
     3325+        allOk = false;
     3326     }
     3327-
     3328     return allOk;
     3329 }
     3330 
     3331@@ -548,33 +756,162 @@
     3332 
     3333 QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
     3334 {
     3335-    QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
     3336-    return reply.value();
     3337+    if (accessPointsList.isEmpty()) {
     3338+        qWarning() << "Using blocking call!";
     3339+        QDBusReply<QList<QDBusObjectPath> > reply
     3340+                = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
     3341+        accessPointsList = reply.value();
     3342+    }
     3343+    return accessPointsList;
     3344 }
     3345 
     3346 QString QNetworkManagerInterfaceDeviceWireless::hwAddress() const
     3347 {
     3348-    return d->connectionInterface->property("HwAddress").toString();
     3349+    if (propertyMap.contains("HwAddress"))
     3350+        return propertyMap.value("HwAddress").toString();
     3351+    return QString();
     3352 }
     3353 
     3354 quint32 QNetworkManagerInterfaceDeviceWireless::mode() const
     3355 {
     3356-    return d->connectionInterface->property("Mode").toUInt();
     3357+    if (propertyMap.contains("Mode"))
     3358+        return propertyMap.value("Mode").toUInt();
     3359+    return 0;
     3360 }
     3361 
     3362 quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const
     3363 {
     3364-    return d->connectionInterface->property("Bitrate").toUInt();
     3365+    if (propertyMap.contains("Bitrate"))
     3366+        return propertyMap.value("Bitrate").toUInt();
     3367+    return 0;
     3368 }
     3369 
     3370 QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const
     3371 {
     3372-    return d->connectionInterface->property("ActiveAccessPoint").value<QDBusObjectPath>();
     3373+    if (propertyMap.contains("ActiveAccessPoint"))
     3374+        return propertyMap.value("ActiveAccessPoint").value<QDBusObjectPath>();
     3375+    return QDBusObjectPath();
     3376 }
     3377 
     3378 quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const
     3379 {
     3380-    return d->connectionInterface->property("WirelelessCapabilities").toUInt();
     3381+    if (propertyMap.contains("WirelelessCapabilities"))
     3382+        return propertyMap.value("WirelelessCapabilities").toUInt();
     3383+    return 0;
     3384+}
     3385+
     3386+void QNetworkManagerInterfaceDeviceWireless::scanIsDone()
     3387+{
     3388+    Q_EMIT scanDone();
     3389+}
     3390+
     3391+void QNetworkManagerInterfaceDeviceWireless::requestScan()
     3392+{
     3393+    d->connectionInterface->asyncCall(QLatin1String("RequestScan"));
     3394+}
     3395+
     3396+void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
     3397+{
     3398+    QMapIterator<QString, QVariant> i(map);
     3399+    while (i.hasNext()) {
     3400+        i.next();
     3401+        propertyMap.insert(i.key(),i.value());
     3402+        if (i.key() == QStringLiteral("ActiveAccessPoint")) { //DeviceWireless
     3403+            Q_EMIT propertiesChanged(map);
     3404+        }
     3405+    }
     3406+}
     3407+
     3408+class QNetworkManagerInterfaceDeviceModemPrivate
     3409+{
     3410+public:
     3411+    QDBusInterface *connectionInterface;
     3412+    QString path;
     3413+    bool valid;
     3414+};
     3415+
     3416+QNetworkManagerInterfaceDeviceModem::QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath, QObject *parent)
     3417+    : QObject(parent)
     3418+{
     3419+    d = new QNetworkManagerInterfaceDeviceModemPrivate();
     3420+    d->path = ifaceDevicePath;
     3421+    d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
     3422+                                                d->path,
     3423+                                                QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
     3424+                                                QDBusConnection::systemBus(), parent);
     3425+    if (!d->connectionInterface->isValid()) {
     3426+        d->valid = false;
     3427+        return;
     3428+    }
     3429+    QDBusInterface deviceModemPropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     3430+                                                  d->path,
     3431+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     3432+                                                  QDBusConnection::systemBus(),parent);
     3433+
     3434+    QList<QVariant> argumentList;
     3435+    argumentList << QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM);
     3436+    QDBusPendingReply<QVariantMap> propsReply
     3437+            = deviceModemPropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     3438+                                                                       argumentList);
     3439+    if (!propsReply.isError()) {
     3440+        propertyMap = propsReply.value();
     3441+    }
     3442+
     3443+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3444+                                  d->path,
     3445+                                  QLatin1String(NM_DBUS_INTERFACE_DEVICE_MODEM),
     3446+                                  QLatin1String("PropertiesChanged"),
     3447+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     3448+    d->valid = true;
     3449+}
     3450+
     3451+QNetworkManagerInterfaceDeviceModem::~QNetworkManagerInterfaceDeviceModem()
     3452+{
     3453+    delete d->connectionInterface;
     3454+    delete d;
     3455+}
     3456+
     3457+bool QNetworkManagerInterfaceDeviceModem::isValid()
     3458+{
     3459+
     3460+    return d->valid;
     3461+}
     3462+
     3463+bool QNetworkManagerInterfaceDeviceModem::setConnections()
     3464+{
     3465+    if (!isValid() )
     3466+        return false;
     3467+
     3468+    return true;
     3469+}
     3470+
     3471+QDBusInterface *QNetworkManagerInterfaceDeviceModem::connectionInterface() const
     3472+{
     3473+    return d->connectionInterface;
     3474+}
     3475+
     3476+QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::modemCapabilities() const
     3477+{
     3478+    if (propertyMap.contains("ModemCapabilities"))
     3479+        return static_cast<QNetworkManagerInterfaceDeviceModem::ModemCapabilities>(propertyMap.value("ModemCapabilities").toUInt());
     3480+    return QNetworkManagerInterfaceDeviceModem::None;
     3481+}
     3482+
     3483+QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceDeviceModem::currentCapabilities() const
     3484+{
     3485+    if (propertyMap.contains("CurrentCapabilities"))
     3486+        return static_cast<QNetworkManagerInterfaceDeviceModem::ModemCapabilities>(propertyMap.value("CurrentCapabilities").toUInt());
     3487+    return QNetworkManagerInterfaceDeviceModem::None;
     3488+}
     3489+
     3490+void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant> map)
     3491+{
     3492+    QMapIterator<QString, QVariant> i(map);
     3493+    while (i.hasNext()) {
     3494+        i.next();
     3495+        propertyMap.insert(i.key(),i.value());
     3496+    }
     3497+    Q_EMIT propertiesChanged(map);
     3498 }
     3499 
     3500 class QNetworkManagerSettingsPrivate
     3501@@ -598,6 +935,14 @@
     3502         d->valid = false;
     3503         return;
     3504     }
     3505+
     3506+    QDBusPendingReply<QList <QDBusObjectPath> > nmReply
     3507+            = d->connectionInterface->call(QLatin1String("ListConnections"));
     3508+
     3509+    if (!nmReply.isError()) {
     3510+        connectionsList = nmReply.value();
     3511+    }
     3512+
     3513     d->valid = true;
     3514 }
     3515 
     3516@@ -614,12 +959,14 @@
     3517 
     3518 bool QNetworkManagerSettings::setConnections()
     3519 {
     3520-    bool allOk = false;
     3521+    bool allOk = true;
     3522 
     3523-    if (!QDBusConnection::systemBus().connect(d->path, QLatin1String(NM_DBUS_PATH_SETTINGS),
     3524-                           QLatin1String(NM_DBUS_IFACE_SETTINGS), QLatin1String("NewConnection"),
     3525-                           this, SIGNAL(newConnection(QDBusObjectPath)))) {
     3526-        allOk = true;
     3527+    if (!QDBusConnection::systemBus().connect(d->path,
     3528+                                             QLatin1String(NM_DBUS_PATH_SETTINGS),
     3529+                                             QLatin1String(NM_DBUS_IFACE_SETTINGS),
     3530+                                             QLatin1String("NewConnection"),
     3531+                                             this, SIGNAL(newConnection(QDBusObjectPath)))) {
     3532+        allOk = false;
     3533     }
     3534 
     3535     return allOk;
     3536@@ -627,8 +974,22 @@
     3537 
     3538 QList <QDBusObjectPath> QNetworkManagerSettings::listConnections()
     3539 {
     3540-    QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("ListConnections"));
     3541-    return  reply.value();
     3542+    if (connectionsList.isEmpty()) {
     3543+        qWarning() << "Using blocking call!";
     3544+        QDBusReply<QList<QDBusObjectPath> > reply
     3545+                = d->connectionInterface->call(QLatin1String("ListConnections"));
     3546+        connectionsList = reply.value();
     3547+    }
     3548+    return connectionsList;
     3549+}
     3550+
     3551+
     3552+QString QNetworkManagerSettings::getConnectionByUuid(const QString &uuid)
     3553+{
     3554+    QList<QVariant> argumentList;
     3555+    argumentList << QVariant::fromValue(uuid);
     3556+    QDBusReply<QDBusObjectPath > reply = d->connectionInterface->callWithArgumentList(QDBus::Block,QLatin1String("GetConnectionByUuid"), argumentList);
     3557+    return reply.value().path();
     3558 }
     3559 
     3560 QDBusInterface *QNetworkManagerSettings::connectionInterface() const
     3561@@ -648,7 +1009,7 @@
     3562 };
     3563 
     3564 QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent)
     3565-    : QObject(parent), nmDBusHelper(0)
     3566+    : QObject(parent)
     3567 {
     3568     qDBusRegisterMetaType<QNmSettingsMap>();
     3569     d = new QNetworkManagerSettingsConnectionPrivate();
     3570@@ -663,8 +1024,12 @@
     3571         return;
     3572     }
     3573     d->valid = true;
     3574-    QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
     3575-    d->settingsMap = rep.value();
     3576+
     3577+    QDBusPendingReply<QNmSettingsMap> nmReply
     3578+            = d->connectionInterface->call(QLatin1String("GetSettings"));
     3579+    if (!nmReply.isError()) {
     3580+        d->settingsMap = nmReply.value();
     3581+    }
     3582 }
     3583 
     3584 QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
     3585@@ -680,33 +1045,34 @@
     3586 
     3587 bool QNetworkManagerSettingsConnection::setConnections()
     3588 {
     3589-    if(!isValid() )
     3590+    if (!isValid())
     3591         return false;
     3592 
     3593     QDBusConnection dbusConnection = QDBusConnection::systemBus();
     3594-    bool allOk = false;
     3595-    if(!dbusConnection.connect(d->service, d->path,
     3596-                           QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Updated"),
     3597-                           this, SIGNAL(updated(QNmSettingsMap)))) {
     3598-        allOk = true;
     3599-    } else {
     3600-        QDBusError error = dbusConnection.lastError();
     3601+    bool allOk = true;
     3602+    if (!dbusConnection.connect(d->service,
     3603+                               d->path,
     3604+                               QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
     3605+                               QLatin1String("Updated"),
     3606+                               this, SIGNAL(updated()))) {
     3607+        allOk = false;
     3608     }
     3609 
     3610-    delete nmDBusHelper;
     3611-    nmDBusHelper = new QNmDBusHelper(this);
     3612-    connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(QString)),
     3613-            this,SIGNAL(removed(QString)));
     3614-
     3615-    if (!dbusConnection.connect(d->service, d->path,
     3616-                           QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), QLatin1String("Removed"),
     3617-                           nmDBusHelper, SIGNAL(slotSettingsRemoved()))) {
     3618-        allOk = true;
     3619+    if (!dbusConnection.connect(d->service,
     3620+                               d->path,
     3621+                               QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION),
     3622+                               QLatin1String("Removed"),
     3623+                               this, SIGNAL(slotSettingsRemoved()))) {
     3624+        allOk = false;
     3625     }
     3626-
     3627     return allOk;
     3628 }
     3629 
     3630+void QNetworkManagerSettingsConnection::slotSettingsRemoved()
     3631+{
     3632+    Q_EMIT removed(d->path);
     3633+}
     3634+
     3635 QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const
     3636 {
     3637     return d->connectionInterface;
     3638@@ -714,8 +1080,11 @@
     3639 
     3640 QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
     3641 {
     3642-    QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
     3643-    d->settingsMap = rep.value();
     3644+    if (d->settingsMap.isEmpty()) {
     3645+        qWarning() << "Using blocking call!";
     3646+        QDBusReply<QNmSettingsMap> reply = d->connectionInterface->call(QLatin1String("GetSettings"));
     3647+        d->settingsMap = reply.value();
     3648+    }
     3649     return d->settingsMap;
     3650 }
     3651 
     3652@@ -725,9 +1094,11 @@
     3653         d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString();
     3654 
     3655     if (devType == QLatin1String("802-3-ethernet"))
     3656-        return DEVICE_TYPE_802_3_ETHERNET;
     3657+        return DEVICE_TYPE_ETHERNET;
     3658     else if (devType == QLatin1String("802-11-wireless"))
     3659-        return DEVICE_TYPE_802_11_WIRELESS;
     3660+        return DEVICE_TYPE_WIFI;
     3661+    else if (devType == QLatin1String("gsm"))
     3662+        return DEVICE_TYPE_MODEM;
     3663     else
     3664         return DEVICE_TYPE_UNKNOWN;
     3665 }
     3666@@ -774,10 +1145,10 @@
     3667 {
     3668     NMDeviceType type = getType();
     3669 
     3670-    if (type == DEVICE_TYPE_802_3_ETHERNET) {
     3671+    if (type == DEVICE_TYPE_ETHERNET) {
     3672         return d->settingsMap.value(QLatin1String("802-3-ethernet"))
     3673                              .value(QLatin1String("mac-address")).toString();
     3674-    } else if (type == DEVICE_TYPE_802_11_WIRELESS) {
     3675+    } else if (type == DEVICE_TYPE_WIFI) {
     3676         return d->settingsMap.value(QLatin1String("802-11-wireless"))
     3677                              .value(QLatin1String("mac-address")).toString();
     3678     } else {
     3679@@ -787,7 +1158,7 @@
     3680 
     3681 QStringList QNetworkManagerSettingsConnection::getSeenBssids()
     3682 {
     3683-    if (getType() == DEVICE_TYPE_802_11_WIRELESS) {
     3684+    if (getType() == DEVICE_TYPE_WIFI) {
     3685         return d->settingsMap.value(QLatin1String("802-11-wireless"))
     3686                              .value(QLatin1String("seen-bssids")).toStringList();
     3687     } else {
     3688@@ -803,8 +1174,8 @@
     3689     bool valid;
     3690 };
     3691 
     3692-QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent)
     3693-    : QObject(parent), nmDBusHelper(0)
     3694+QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent)
     3695+    : QObject(parent)
     3696 {
     3697     d = new QNetworkManagerConnectionActivePrivate();
     3698     d->path = activeConnectionObjectPath;
     3699@@ -816,6 +1187,29 @@
     3700         d->valid = false;
     3701         return;
     3702     }
     3703+    QDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
     3704+                                                  d->path,
     3705+                                                  QLatin1String("org.freedesktop.DBus.Properties"),
     3706+                                                  QDBusConnection::systemBus());
     3707+
     3708+
     3709+    QList<QVariant> argumentList;
     3710+    argumentList << QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
     3711+    QDBusPendingReply<QVariantMap> propsReply
     3712+            = connectionActivePropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
     3713+                                                                       argumentList);
     3714+
     3715+    if (!propsReply.isError()) {
     3716+        propertyMap = propsReply.value();
     3717+    } else {
     3718+        qWarning() << propsReply.error().message();
     3719+    }
     3720+
     3721+    QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3722+                                  d->path,
     3723+                                  QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
     3724+                                  QLatin1String("PropertiesChanged"),
     3725+                                  this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
     3726     d->valid = true;
     3727 }
     3728 
     3729@@ -832,23 +1226,10 @@
     3730 
     3731 bool QNetworkManagerConnectionActive::setConnections()
     3732 {
     3733-    if(!isValid() )
     3734+    if (!isValid())
     3735         return false;
     3736 
     3737-    bool allOk = false;
     3738-    delete nmDBusHelper;
     3739-    nmDBusHelper = new QNmDBusHelper(this);
     3740-    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
     3741-            this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
     3742-    if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
     3743-                              d->path,
     3744-                              QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
     3745-                              QLatin1String("PropertiesChanged"),
     3746-                              nmDBusHelper,SLOT(slotPropertiesChanged(QMap<QString,QVariant>))) )  {
     3747-        allOk = true;
     3748-    }
     3749-
     3750-    return allOk;
     3751+    return true;
     3752 }
     3753 
     3754 QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const
     3755@@ -856,37 +1237,72 @@
     3756     return d->connectionInterface;
     3757 }
     3758 
     3759-QString QNetworkManagerConnectionActive::serviceName() const
     3760-{
     3761-    return d->connectionInterface->property("ServiceName").toString();
     3762-}
     3763-
     3764 QDBusObjectPath QNetworkManagerConnectionActive::connection() const
     3765 {
     3766-    QVariant prop = d->connectionInterface->property("Connection");
     3767-    return prop.value<QDBusObjectPath>();
     3768+    if (propertyMap.contains("Connection"))
     3769+        return propertyMap.value("Connection").value<QDBusObjectPath>();
     3770+    return QDBusObjectPath();
     3771 }
     3772 
     3773 QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const
     3774 {
     3775-    QVariant prop = d->connectionInterface->property("SpecificObject");
     3776-    return prop.value<QDBusObjectPath>();
     3777-}
     3778-
     3779-QList<QDBusObjectPath> QNetworkManagerConnectionActive::devices() const
     3780-{
     3781-    QVariant prop = d->connectionInterface->property("Devices");
     3782-    return prop.value<QList<QDBusObjectPath> >();
     3783+    if (propertyMap.contains("SpecificObject"))
     3784+        return propertyMap.value("SpecificObject").value<QDBusObjectPath>();
     3785+    return QDBusObjectPath();
     3786+}
     3787+
     3788+QStringList QNetworkManagerConnectionActive::devices() const
     3789+{
     3790+    QStringList list;
     3791+    if (propertyMap.contains("Devices")) {
     3792+        const QDBusArgument &dbusArgs = propertyMap.value("Devices").value<QDBusArgument>();
     3793+        QDBusObjectPath path;
     3794+
     3795+        dbusArgs.beginArray();
     3796+        while (!dbusArgs.atEnd()) {
     3797+            dbusArgs >> path;
     3798+            list.append(path.path());
     3799+        }
     3800+        dbusArgs.endArray();
     3801+    }
     3802+    return list;
     3803 }
     3804 
     3805 quint32 QNetworkManagerConnectionActive::state() const
     3806 {
     3807-    return d->connectionInterface->property("State").toUInt();
     3808+    if (propertyMap.contains("State"))
     3809+        return propertyMap.value("State").toUInt();
     3810+    return 0;
     3811 }
     3812 
     3813 bool QNetworkManagerConnectionActive::defaultRoute() const
     3814 {
     3815-    return d->connectionInterface->property("Default").toBool();
     3816+    if (propertyMap.contains("Default"))
     3817+        return propertyMap.value("Default").toBool();
     3818+    return false;
     3819+}
     3820+
     3821+bool QNetworkManagerConnectionActive::default6Route() const
     3822+{
     3823+    if (propertyMap.contains("Default6"))
     3824+        return propertyMap.value("Default6").toBool();
     3825+    return false;
     3826+}
     3827+
     3828+void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
     3829+{
     3830+    QMapIterator<QString, QVariant> i(map);
     3831+    while (i.hasNext()) {
     3832+        i.next();
     3833+        propertyMap.insert(i.key(),i.value());
     3834+        if (i.key() == QStringLiteral("State")) {
     3835+            quint32 state = i.value().toUInt();
     3836+            if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
     3837+                || state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
     3838+                Q_EMIT propertiesChanged(map);
     3839+            }
     3840+        }
     3841+    }
     3842 }
     3843 
     3844 class QNetworkManagerIp4ConfigPrivate
     3845--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
     3846+++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
     3847@@ -1,40 +1,32 @@
     3848 /****************************************************************************
     3849 **
     3850-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     3851+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
     3852 ** Contact: http://www.qt-project.org/legal
     3853 **
     3854 ** This file is part of the plugins of the Qt Toolkit.
     3855 **
     3856-** $QT_BEGIN_LICENSE:LGPL$
     3857+** $QT_BEGIN_LICENSE:LGPL21$
     3858 ** Commercial License Usage
     3859 ** Licensees holding valid commercial Qt licenses may use this file in
     3860 ** accordance with the commercial license agreement provided with the
     3861 ** Software or, alternatively, in accordance with the terms contained in
     3862-** a written agreement between you and Digia.  For licensing terms and
     3863-** conditions see http://qt.digia.com/licensing.  For further information
     3864+** a written agreement between you and Digia. For licensing terms and
     3865+** conditions see http://qt.digia.com/licensing. For further information
     3866 ** use the contact form at http://qt.digia.com/contact-us.
     3867 **
     3868 ** GNU Lesser General Public License Usage
     3869 ** Alternatively, this file may be used under the terms of the GNU Lesser
     3870-** General Public License version 2.1 as published by the Free Software
     3871-** Foundation and appearing in the file LICENSE.LGPL included in the
     3872-** packaging of this file.  Please review the following information to
     3873-** ensure the GNU Lesser General Public License version 2.1 requirements
     3874-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     3875+** General Public License version 2.1 or version 3 as published by the Free
     3876+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
     3877+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
     3878+** following information to ensure the GNU Lesser General Public License
     3879+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
     3880+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     3881 **
     3882 ** In addition, as a special exception, Digia gives you certain additional
     3883-** rights.  These rights are described in the Digia Qt LGPL Exception
     3884+** rights. These rights are described in the Digia Qt LGPL Exception
     3885 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     3886 **
     3887-** GNU General Public License Usage
     3888-** Alternatively, this file may be used under the terms of the GNU
     3889-** General Public License version 3.0 as published by the Free Software
     3890-** Foundation and appearing in the file LICENSE.GPL included in the
     3891-** packaging of this file.  Please review the following information to
     3892-** ensure the GNU General Public License version 3.0 requirements will be
     3893-** met: http://www.gnu.org/copyleft/gpl.html.
     3894-**
     3895-**
     3896 ** $QT_END_LICENSE$
     3897 **
     3898 ****************************************************************************/
     3899@@ -64,7 +56,6 @@
     3900 #include <QtDBus/QDBusObjectPath>
     3901 #include <QtDBus/QDBusContext>
     3902 #include <QMap>
     3903-#include "qnmdbushelper.h"
     3904 
     3905 #ifndef QT_NO_DBUS
     3906 
     3907@@ -72,31 +63,32 @@
     3908 typedef enum NMDeviceType
     3909 {
     3910     DEVICE_TYPE_UNKNOWN = 0,
     3911-    DEVICE_TYPE_802_3_ETHERNET,
     3912-    DEVICE_TYPE_802_11_WIRELESS,
     3913-    DEVICE_TYPE_GSM,
     3914-    DEVICE_TYPE_CDMA
     3915+    DEVICE_TYPE_ETHERNET,
     3916+    DEVICE_TYPE_WIFI,
     3917+    DEVICE_TYPE_MODEM = 8
     3918 } NMDeviceType;
     3919 
     3920 typedef enum
     3921 {
     3922     NM_DEVICE_STATE_UNKNOWN = 0,
     3923-    NM_DEVICE_STATE_UNMANAGED,
     3924-    NM_DEVICE_STATE_UNAVAILABLE,
     3925-    NM_DEVICE_STATE_DISCONNECTED,
     3926-    NM_DEVICE_STATE_PREPARE,
     3927-    NM_DEVICE_STATE_CONFIG,
     3928-    NM_DEVICE_STATE_NEED_AUTH,
     3929-    NM_DEVICE_STATE_IP_CONFIG,
     3930-    NM_DEVICE_STATE_ACTIVATED,
     3931-    NM_DEVICE_STATE_FAILED
     3932+    NM_DEVICE_STATE_UNMANAGED = 10,
     3933+    NM_DEVICE_STATE_UNAVAILABLE = 20,
     3934+    NM_DEVICE_STATE_DISCONNECTED = 30,
     3935+    NM_DEVICE_STATE_PREPARE = 40,
     3936+    NM_DEVICE_STATE_CONFIG = 50,
     3937+    NM_DEVICE_STATE_NEED_AUTH = 60,
     3938+    NM_DEVICE_STATE_IP_CONFIG = 70,
     3939+    NM_DEVICE_STATE_ACTIVATED = 100,
     3940+    NM_DEVICE_STATE_DEACTIVATING = 110,
     3941+    NM_DEVICE_STATE_FAILED = 120
     3942 } NMDeviceState;
     3943 
     3944 typedef enum
     3945 {
     3946     NM_ACTIVE_CONNECTION_STATE_UNKNOWN = 0,
     3947     NM_ACTIVE_CONNECTION_STATE_ACTIVATING,
     3948-    NM_ACTIVE_CONNECTION_STATE_ACTIVATED
     3949+    NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
     3950+    NM_ACTIVE_CONNECTION_STATE_DEACTIVATED = 4
     3951 } NMActiveConnectionState;
     3952 
     3953 #define NM_DBUS_SERVICE                     "org.freedesktop.NetworkManager"
     3954@@ -106,13 +98,14 @@
     3955 #define NM_DBUS_INTERFACE_DEVICE            NM_DBUS_INTERFACE ".Device"
     3956 #define NM_DBUS_INTERFACE_DEVICE_WIRED      NM_DBUS_INTERFACE_DEVICE ".Wired"
     3957 #define NM_DBUS_INTERFACE_DEVICE_WIRELESS   NM_DBUS_INTERFACE_DEVICE ".Wireless"
     3958+#define NM_DBUS_INTERFACE_DEVICE_MODEM      NM_DBUS_INTERFACE_DEVICE ".Modem"
     3959 #define NM_DBUS_PATH_ACCESS_POINT           NM_DBUS_PATH "/AccessPoint"
     3960 #define NM_DBUS_INTERFACE_ACCESS_POINT      NM_DBUS_INTERFACE ".AccessPoint"
     3961 
     3962-#define NM_DBUS_PATH_SETTINGS               "/org/freedesktop/NetworkManagerSettings"
     3963+#define NM_DBUS_PATH_SETTINGS               "/org/freedesktop/NetworkManager/Settings"
     3964 
     3965-#define NM_DBUS_IFACE_SETTINGS_CONNECTION   "org.freedesktop.NetworkManagerSettings.Connection"
     3966-#define NM_DBUS_IFACE_SETTINGS              "org.freedesktop.NetworkManagerSettings"
     3967+#define NM_DBUS_IFACE_SETTINGS_CONNECTION   "org.freedesktop.NetworkManager.Settings.Connection"
     3968+#define NM_DBUS_IFACE_SETTINGS              "org.freedesktop.NetworkManager.Settings"
     3969 #define NM_DBUS_INTERFACE_ACTIVE_CONNECTION NM_DBUS_INTERFACE ".Connection.Active"
     3970 #define NM_DBUS_INTERFACE_IP4_CONFIG        NM_DBUS_INTERFACE ".IP4Config"
     3971 
     3972@@ -141,12 +134,23 @@
     3973     Q_OBJECT
     3974 
     3975 public:
     3976+    typedef enum
     3977+    {
     3978+        NM_STATE_UNKNOWN = 0,
     3979+        NM_STATE_ASLEEP = 10,
     3980+        NM_STATE_DISCONNECTED = 20,
     3981+        NM_STATE_DISCONNECTING = 30,
     3982+        NM_STATE_CONNECTING = 40,
     3983+        NM_STATE_CONNECTED_LOCAL = 50,
     3984+        NM_STATE_CONNECTED_SITE = 60,
     3985+        NM_STATE_CONNECTED_GLOBAL = 70
     3986+    } NMState;
     3987 
     3988     QNetworkManagerInterface(QObject *parent = 0);
     3989     ~QNetworkManagerInterface();
     3990 
     3991-    QList <QDBusObjectPath> getDevices() const;
     3992-    void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject);
     3993+    QList <QDBusObjectPath> getDevices();
     3994+    void activateConnection(QDBusObjectPath connection,QDBusObjectPath device, QDBusObjectPath specificObject);
     3995     void deactivateConnection(QDBusObjectPath connectionPath) const;
     3996 
     3997     QDBusObjectPath path() const;
     3998@@ -155,21 +159,28 @@
     3999     bool wirelessEnabled() const;
     4000     bool wirelessHardwareEnabled() const;
     4001     QList <QDBusObjectPath> activeConnections() const;
     4002-    quint32 state();
     4003+    NMState state();
     4004+    QString version() const;
     4005     bool setConnections();
     4006     bool isValid();
     4007 
     4008 Q_SIGNALS:
     4009     void deviceAdded(QDBusObjectPath);
     4010     void deviceRemoved(QDBusObjectPath);
     4011-    void propertiesChanged( const QString &, QMap<QString,QVariant>);
     4012-    void stateChanged(const QString&, quint32);
     4013+    void propertiesChanged(QMap<QString,QVariant>);
     4014+    void stateChanged(quint32);
     4015     void activationFinished(QDBusPendingCallWatcher*);
     4016+    void propertiesReady();
     4017+    void devicesListReady();
     4018 
     4019 private Q_SLOTS:
     4020+    void propertiesSwap(QMap<QString,QVariant>);
     4021+
     4022 private:
     4023     QNetworkManagerInterfacePrivate *d;
     4024-    QNmDBusHelper *nmDBusHelper;
     4025+    QVariantMap propertyMap;
     4026+    QList<QDBusObjectPath> devicesPathList;
     4027+
     4028 };
     4029 
     4030 class QNetworkManagerInterfaceAccessPointPrivate;
     4031@@ -234,11 +245,14 @@
     4032 
     4033 Q_SIGNALS:
     4034     void propertiesChanged(QMap <QString,QVariant>);
     4035-    void propertiesChanged( const QString &, QMap<QString,QVariant>);
     4036+    void propertiesReady();
     4037+
     4038+private Q_SLOTS:
     4039+    void propertiesSwap(QMap<QString,QVariant>);
     4040+
     4041 private:
     4042     QNetworkManagerInterfaceAccessPointPrivate *d;
     4043-    QNmDBusHelper *nmDBusHelper;
     4044-
     4045+    QVariantMap propertyMap;
     4046 };
     4047 
     4048 class QNetworkManagerInterfaceDevicePrivate;
     4049@@ -264,10 +278,14 @@
     4050 
     4051 Q_SIGNALS:
     4052     void stateChanged(const QString &, quint32);
     4053-
     4054+    void propertiesChanged(QMap<QString,QVariant>);
     4055+    void connectionsChanged(QStringList);
     4056+    void propertiesReady();
     4057+private Q_SLOTS:
     4058+    void propertiesSwap(QMap<QString,QVariant>);
     4059 private:
     4060     QNetworkManagerInterfaceDevicePrivate *d;
     4061-    QNmDBusHelper *nmDBusHelper;
     4062+    QVariantMap propertyMap;
     4063 };
     4064 
     4065 class QNetworkManagerInterfaceDeviceWiredPrivate;
     4066@@ -287,12 +305,19 @@
     4067     bool carrier() const;
     4068     bool setConnections();
     4069     bool isValid();
     4070+    QStringList availableConnections();
     4071 
     4072 Q_SIGNALS:
     4073-    void propertiesChanged( const QString &, QMap<QString,QVariant>);
     4074+    void propertiesChanged(QMap<QString,QVariant>);
     4075+    void propertiesReady();
     4076+    void carrierChanged(bool);
     4077+
     4078+private Q_SLOTS:
     4079+    void propertiesSwap(QMap<QString,QVariant>);
     4080+
     4081 private:
     4082     QNetworkManagerInterfaceDeviceWiredPrivate *d;
     4083-    QNmDBusHelper *nmDBusHelper;
     4084+    QVariantMap propertyMap;
     4085 };
     4086 
     4087 class QNetworkManagerInterfaceDeviceWirelessPrivate;
     4088@@ -328,15 +353,71 @@
     4089     bool setConnections();
     4090     bool isValid();
     4091 
     4092+    void requestScan();
     4093 Q_SIGNALS:
     4094-    void propertiesChanged( const QString &, QMap<QString,QVariant>);
     4095-    void accessPointAdded(const QString &,QDBusObjectPath);
     4096-    void accessPointRemoved(const QString &,QDBusObjectPath);
     4097+    void propertiesChanged(QMap<QString,QVariant>);
     4098+    void accessPointAdded(const QString &);
     4099+    void accessPointRemoved(const QString &);
     4100+    void scanDone();
     4101+    void propertiesReady();
     4102+    void accessPointsReady();
     4103+
     4104+private Q_SLOTS:
     4105+    void scanIsDone();
     4106+    void propertiesSwap(QMap<QString,QVariant>);
     4107+
     4108+    void slotAccessPointAdded(QDBusObjectPath);
     4109+    void slotAccessPointRemoved(QDBusObjectPath);
     4110+
     4111 private:
     4112     QNetworkManagerInterfaceDeviceWirelessPrivate *d;
     4113-    QNmDBusHelper *nmDBusHelper;
     4114+    QVariantMap propertyMap;
     4115+    QList <QDBusObjectPath> accessPointsList;
     4116+};
     4117+
     4118+class QNetworkManagerInterfaceDeviceModemPrivate;
     4119+class QNetworkManagerInterfaceDeviceModem : public QObject
     4120+{
     4121+    Q_OBJECT
     4122+
     4123+public:
     4124+
     4125+    enum ModemCapability {
     4126+        None = 0x0,
     4127+        Pots = 0x1,
     4128+        Cmda_Edvo = 0x2,
     4129+        Gsm_Umts = 0x4,
     4130+        Lte = 0x08
     4131+       };
     4132+    Q_DECLARE_FLAGS(ModemCapabilities, ModemCapability)
     4133+
     4134+    explicit QNetworkManagerInterfaceDeviceModem(const QString &ifaceDevicePath,
     4135+                                                    QObject *parent = 0);
     4136+    ~QNetworkManagerInterfaceDeviceModem();
     4137+
     4138+    QDBusObjectPath path() const;
     4139+    QDBusInterface *connectionInterface() const;
     4140+
     4141+    bool setConnections();
     4142+    bool isValid();
     4143+
     4144+    ModemCapabilities modemCapabilities() const;
     4145+    ModemCapabilities currentCapabilities() const;
     4146+
     4147+Q_SIGNALS:
     4148+    void propertiesChanged(QMap<QString,QVariant>);
     4149+    void propertiesReady();
     4150+
     4151+private Q_SLOTS:
     4152+    void propertiesSwap(QMap<QString,QVariant>);
     4153+
     4154+private:
     4155+    QNetworkManagerInterfaceDeviceModemPrivate *d;
     4156+    QVariantMap propertyMap;
     4157 };
     4158 
     4159+Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkManagerInterfaceDeviceModem::ModemCapabilities)
     4160+
     4161 class QNetworkManagerSettingsPrivate;
     4162 class QNetworkManagerSettings : public QObject
     4163 {
     4164@@ -349,13 +430,16 @@
     4165 
     4166     QDBusInterface  *connectionInterface() const;
     4167     QList <QDBusObjectPath> listConnections();
     4168+    QString getConnectionByUuid(const QString &uuid);
     4169     bool setConnections();
     4170     bool isValid();
     4171 
     4172 Q_SIGNALS:
     4173     void newConnection(QDBusObjectPath);
     4174+    void connectionsListReady();
     4175 private:
     4176     QNetworkManagerSettingsPrivate *d;
     4177+    QList <QDBusObjectPath> connectionsList;
     4178 };
     4179 
     4180 class QNetworkManagerSettingsConnectionPrivate;
     4181@@ -382,12 +466,14 @@
     4182     bool isValid();
     4183 
     4184 Q_SIGNALS:
     4185-
     4186-    void updated(const QNmSettingsMap &settings);
     4187+    void updated();
     4188     void removed(const QString &path);
     4189+    void settingsReady();
     4190+
     4191+private Q_SLOTS:
     4192+    void slotSettingsRemoved();
     4193 
     4194 private:
     4195-    QNmDBusHelper *nmDBusHelper;
     4196     QNetworkManagerSettingsConnectionPrivate *d;
     4197 };
     4198 
     4199@@ -408,22 +494,26 @@
     4200     ~ QNetworkManagerConnectionActive();
     4201 
     4202     QDBusInterface  *connectionInterface() const;
     4203-    QString serviceName() const;
     4204     QDBusObjectPath connection() const;
     4205     QDBusObjectPath specificObject() const;
     4206-    QList<QDBusObjectPath> devices() const;
     4207+    QStringList devices() const;
     4208     quint32 state() const;
     4209     bool defaultRoute() const;
     4210+    bool default6Route() const;
     4211     bool setConnections();
     4212     bool isValid();
     4213 
     4214 
     4215 Q_SIGNALS:
     4216-    void propertiesChanged(QList<QDBusObjectPath>);
     4217-    void propertiesChanged( const QString &, QMap<QString,QVariant>);
     4218+    void propertiesChanged(QMap<QString,QVariant>);
     4219+    void propertiesReady();
     4220+
     4221+private Q_SLOTS:
     4222+    void propertiesSwap(QMap<QString,QVariant>);
     4223+
     4224 private:
     4225     QNetworkManagerConnectionActivePrivate *d;
     4226-    QNmDBusHelper *nmDBusHelper;
     4227+    QVariantMap propertyMap;
     4228 };
     4229 
     4230 class QNetworkManagerIp4ConfigPrivate;
     4231--- qtbase/src/plugins/bearer/networkmanager/qnmdbushelper.cpp
     4232+++ /dev/null
     4233@@ -1,130 +0,0 @@
     4234-/****************************************************************************
     4235-**
     4236-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     4237-** Contact: http://www.qt-project.org/legal
     4238-**
     4239-** This file is part of the plugins of the Qt Toolkit.
     4240-**
     4241-** $QT_BEGIN_LICENSE:LGPL$
     4242-** Commercial License Usage
     4243-** Licensees holding valid commercial Qt licenses may use this file in
     4244-** accordance with the commercial license agreement provided with the
     4245-** Software or, alternatively, in accordance with the terms contained in
     4246-** a written agreement between you and Digia.  For licensing terms and
     4247-** conditions see http://qt.digia.com/licensing.  For further information
     4248-** use the contact form at http://qt.digia.com/contact-us.
     4249-**
     4250-** GNU Lesser General Public License Usage
     4251-** Alternatively, this file may be used under the terms of the GNU Lesser
     4252-** General Public License version 2.1 as published by the Free Software
     4253-** Foundation and appearing in the file LICENSE.LGPL included in the
     4254-** packaging of this file.  Please review the following information to
     4255-** ensure the GNU Lesser General Public License version 2.1 requirements
     4256-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     4257-**
     4258-** In addition, as a special exception, Digia gives you certain additional
     4259-** rights.  These rights are described in the Digia Qt LGPL Exception
     4260-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     4261-**
     4262-** GNU General Public License Usage
     4263-** Alternatively, this file may be used under the terms of the GNU
     4264-** General Public License version 3.0 as published by the Free Software
     4265-** Foundation and appearing in the file LICENSE.GPL included in the
     4266-** packaging of this file.  Please review the following information to
     4267-** ensure the GNU General Public License version 3.0 requirements will be
     4268-** met: http://www.gnu.org/copyleft/gpl.html.
     4269-**
     4270-**
     4271-** $QT_END_LICENSE$
     4272-**
     4273-****************************************************************************/
     4274-
     4275-// this class is for helping qdbus get stuff
     4276-
     4277-#include "qnmdbushelper.h"
     4278-
     4279-#include "qnetworkmanagerservice.h"
     4280-
     4281-#include <QDBusError>
     4282-#include <QDBusInterface>
     4283-#include <QDBusMessage>
     4284-#include <QDBusReply>
     4285-
     4286-#include <QDebug>
     4287-
     4288-#ifndef QT_NO_DBUS
     4289-
     4290-QT_BEGIN_NAMESPACE
     4291-
     4292-QNmDBusHelper::QNmDBusHelper(QObject * parent)
     4293-        : QObject(parent)
     4294-{
     4295-}
     4296-
     4297-QNmDBusHelper::~QNmDBusHelper()
     4298-{
     4299-}
     4300-
     4301-void QNmDBusHelper::deviceStateChanged(quint32 state)
     4302- {
     4303-    QDBusMessage msg = this->message();
     4304-    if(state == NM_DEVICE_STATE_ACTIVATED
     4305-       || state == NM_DEVICE_STATE_DISCONNECTED
     4306-       || state == NM_DEVICE_STATE_UNAVAILABLE
     4307-       || state == NM_DEVICE_STATE_FAILED) {
     4308-        emit pathForStateChanged(msg.path(), state);
     4309-    }
     4310- }
     4311-
     4312-void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path)
     4313-{
     4314-    if(path.path().length() > 2) {
     4315-        QDBusMessage msg = this->message();
     4316-        emit pathForAccessPointAdded(msg.path(), path);
     4317-    }
     4318-}
     4319-
     4320-void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path)
     4321-{
     4322-    if(path.path().length() > 2) {
     4323-        QDBusMessage msg = this->message();
     4324-        emit pathForAccessPointRemoved(msg.path(), path);
     4325-    }
     4326-}
     4327-
     4328-void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map)
     4329-{
     4330-    QDBusMessage msg = this->message();
     4331-    QMapIterator<QString, QVariant> i(map);
     4332-    while (i.hasNext()) {
     4333-        i.next();
     4334-        if( i.key() == "State") { //state only applies to device interfaces
     4335-            quint32 state = i.value().toUInt();
     4336-            if( state == NM_DEVICE_STATE_ACTIVATED
     4337-                || state == NM_DEVICE_STATE_DISCONNECTED
     4338-                || state == NM_DEVICE_STATE_UNAVAILABLE
     4339-                || state == NM_DEVICE_STATE_FAILED) {
     4340-                emit  pathForPropertiesChanged( msg.path(), map);
     4341-            }
     4342-        } else if( i.key() == "ActiveAccessPoint") {
     4343-            emit pathForPropertiesChanged(msg.path(), map);
     4344-            //            qWarning()  << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value<QDBusObjectPath>().path();
     4345-            //      } else if( i.key() == "Strength")
     4346-            //            qWarning()  << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt();
     4347-            //   else
     4348-            //            qWarning()  << __PRETTY_FUNCTION__ << i.key() << ": " << i.value();
     4349-        } else if (i.key() == "ActiveConnections") {
     4350-            emit pathForPropertiesChanged(msg.path(), map);
     4351-        }
     4352-    }
     4353-}
     4354-
     4355-void QNmDBusHelper::slotSettingsRemoved()
     4356-{
     4357-    QDBusMessage msg = this->message();
     4358-    emit pathForSettingsRemoved(msg.path());
     4359-}
     4360-
     4361-QT_END_NAMESPACE
     4362-
     4363-#endif // QT_NO_DBUS
     4364--- qtbase/src/plugins/bearer/networkmanager/qnmdbushelper.h
     4365+++ /dev/null
     4366@@ -1,79 +0,0 @@
     4367-/****************************************************************************
     4368-**
     4369-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     4370-** Contact: http://www.qt-project.org/legal
     4371-**
     4372-** This file is part of the plugins of the Qt Toolkit.
     4373-**
     4374-** $QT_BEGIN_LICENSE:LGPL$
     4375-** Commercial License Usage
     4376-** Licensees holding valid commercial Qt licenses may use this file in
     4377-** accordance with the commercial license agreement provided with the
     4378-** Software or, alternatively, in accordance with the terms contained in
     4379-** a written agreement between you and Digia.  For licensing terms and
     4380-** conditions see http://qt.digia.com/licensing.  For further information
     4381-** use the contact form at http://qt.digia.com/contact-us.
     4382-**
     4383-** GNU Lesser General Public License Usage
     4384-** Alternatively, this file may be used under the terms of the GNU Lesser
     4385-** General Public License version 2.1 as published by the Free Software
     4386-** Foundation and appearing in the file LICENSE.LGPL included in the
     4387-** packaging of this file.  Please review the following information to
     4388-** ensure the GNU Lesser General Public License version 2.1 requirements
     4389-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     4390-**
     4391-** In addition, as a special exception, Digia gives you certain additional
     4392-** rights.  These rights are described in the Digia Qt LGPL Exception
     4393-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     4394-**
     4395-** GNU General Public License Usage
     4396-** Alternatively, this file may be used under the terms of the GNU
     4397-** General Public License version 3.0 as published by the Free Software
     4398-** Foundation and appearing in the file LICENSE.GPL included in the
     4399-** packaging of this file.  Please review the following information to
     4400-** ensure the GNU General Public License version 3.0 requirements will be
     4401-** met: http://www.gnu.org/copyleft/gpl.html.
     4402-**
     4403-**
     4404-** $QT_END_LICENSE$
     4405-**
     4406-****************************************************************************/
     4407-
     4408-#ifndef QNMDBUSHELPERPRIVATE_H
     4409-#define QNMDBUSHELPERPRIVATE_H
     4410-
     4411-#include <QDBusObjectPath>
     4412-#include <QDBusContext>
     4413-#include <QMap>
     4414-
     4415-#ifndef QT_NO_DBUS
     4416-
     4417-QT_BEGIN_NAMESPACE
     4418-
     4419-class QNmDBusHelper: public QObject, protected QDBusContext
     4420- {
     4421-     Q_OBJECT
     4422- public:
     4423-    QNmDBusHelper(QObject *parent = 0);
     4424-    ~QNmDBusHelper();
     4425-
     4426- public slots:
     4427-    void deviceStateChanged(quint32);
     4428-    void slotAccessPointAdded( QDBusObjectPath );
     4429-    void slotAccessPointRemoved( QDBusObjectPath );
     4430-    void slotPropertiesChanged( QMap<QString,QVariant>);
     4431-    void slotSettingsRemoved();
     4432-
     4433-Q_SIGNALS:
     4434-    void pathForStateChanged(const QString &, quint32);
     4435-    void pathForAccessPointAdded(const QString &,  QDBusObjectPath );
     4436-    void pathForAccessPointRemoved(const QString &,  QDBusObjectPath );
     4437-    void pathForPropertiesChanged(const QString &, QMap<QString,QVariant>);
     4438-    void pathForSettingsRemoved(const QString &);
     4439-};
     4440-
     4441-QT_END_NAMESPACE
     4442-
     4443-#endif // QT_NO_DBUS
     4444-
     4445-#endif// QNMDBUSHELPERPRIVATE_H
  • new file trunk/dports/aqua/qt5-mac/files/correct-systraymenu-iconhandling.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/correct-systraymenu-iconhandling.patch b/trunk/dports/aqua/qt5-mac/files/correct-systraymenu-iconhandling.patch
    new file mode 10644
    - +  
     1diff --git qtbase/src/widgets/widgets/qmenu.cpp qtbase/src/widgets/widgets/qmenu.cpp
     2index 7e48bad..00357c5 100644
     3--- qtbase/src/widgets/widgets/qmenu.cpp
     4+++ qtbase/src/widgets/widgets/qmenu.cpp
     5@@ -2978,8 +2978,19 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem* i
     6 {
     7     item->setText(action->text());
     8     item->setIsSeparator(action->isSeparator());
     9-    if (action->isIconVisibleInMenu())
     10+    if (action->isIconVisibleInMenu()) {
     11         item->setIcon(action->icon());
     12+//        if (QWidget *w = action->parentWidget()) {
     13+//            QStyleOption opt;
     14+//            opt.init(w);
     15+//            item->setIconSize(w->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, w));
     16+//        } else {
     17+//            QStyleOption opt;
     18+//            item->setIconSize(qApp->style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, 0));
     19+//        }
     20+    } else {
     21+        item->setIcon(QIcon());
     22+    }
     23     item->setVisible(action->isVisible());
     24     item->setShortcut(action->shortcut());
     25     item->setCheckable(action->isCheckable());
     26
  • new file trunk/dports/aqua/qt5-mac/files/dbus_correct_signal_name_disconnect.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/dbus_correct_signal_name_disconnect.patch b/trunk/dports/aqua/qt5-mac/files/dbus_correct_signal_name_disconnect.patch
    new file mode 10644
    - +  
     1From 2160e7e0b7842d4ef49fdd435b4a7f127d479b90 Mon Sep 17 00:00:00 2001
     2From: Jakub Adam <jakub.adam@jollamobile.com>
     3Date: Wed, 4 Jun 2014 14:48:02 +0200
     4Subject: [PATCH] Use correct signal name when disconnecting "NameOwnerChanged"
     5
     6A disconnectSignal() call with a wrong signal name caused that hook
     7wasn't found and thus kept in QDBusConnectionPrivate::signalHooks
     8forever.
     9
     10Change-Id: Id7cda225be7580529fc835b377636226abb229f9
     11---
     12 src/dbus/qdbusintegrator.cpp | 2 +-
     13 1 file changed, 1 insertion(+), 1 deletion(-)
     14
     15--- qtbase/src/dbus/qdbusintegrator.cpp
     16+++ qtbase/src/dbus/qdbusintegrator.cpp
     17@@ -2266,7 +2266,7 @@
     18                     watchedServices.erase(sit);
     19                     disconnectSignal(dbusServiceString(), QString(), dbusInterfaceString(),
     20                                   QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
     21-                                  this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
     22+                                  this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString)));
     23                 }
     24             }
     25         }
  • new file trunk/dports/aqua/qt5-mac/files/deactivate-menurole-heuristics.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/deactivate-menurole-heuristics.patch b/trunk/dports/aqua/qt5-mac/files/deactivate-menurole-heuristics.patch
    new file mode 10644
    - +  
     1diff --git qtbase/src/plugins/platforms/cocoa/messages.cpp qtbase/src/plugins/platforms/cocoa/messages.cpp
     2index 4f7b038..ea63338 100644
     3--- qtbase/src/plugins/platforms/cocoa/messages.cpp
     4+++ qtbase/src/plugins/platforms/cocoa/messages.cpp
     5@@ -78,16 +78,16 @@ QPlatformMenuItem::MenuRole detectMenuRole(const QString &caption)
     6 {
     7     QString captionNoAmpersand(caption);
     8     captionNoAmpersand.remove(QChar('&'));
     9-    const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
     10-    if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
     11-        return QPlatformMenuItem::AboutRole;
     12-    if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
     13-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
     14-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
     15-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
     16-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
     17-        return QPlatformMenuItem::PreferencesRole;
     18-    }
     19+//     const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
     20+//     if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
     21+//         return QPlatformMenuItem::AboutRole;
     22+//     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
     23+//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
     24+//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
     25+//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
     26+//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
     27+//         return QPlatformMenuItem::PreferencesRole;
     28+//     }
     29     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
     30         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
     31         return QPlatformMenuItem::QuitRole;
  • new file trunk/dports/aqua/qt5-mac/files/debug-negative-qtimerint.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/debug-negative-qtimerint.patch b/trunk/dports/aqua/qt5-mac/files/debug-negative-qtimerint.patch
    new file mode 10644
    - +  
     1diff --git qtbase/src/corelib/kernel/qobject.cpp qtbase/src/corelib/kernel/qobject.cpp
     2index e588808..f0e2d7c 100644
     3--- qtbase/src/corelib/kernel/qobject.cpp
     4+++ qtbase/src/corelib/kernel/qobject.cpp
     5@@ -1605,7 +1605,7 @@ int QObject::startTimer(int interval, Qt::TimerType timerType)
     6     Q_D(QObject);
     7 
     8     if (interval < 0) {
     9-        qWarning("QObject::startTimer: Timers cannot have negative intervals");
     10+        qWarning() << "QObject::startTimer: Timer" << this << "cannot have a negative interval";
     11         return 0;
     12     }
     13 
  • new file trunk/dports/aqua/qt5-mac/files/disable-generic-plugin-when-others-available.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/disable-generic-plugin-when-others-available.patch b/trunk/dports/aqua/qt5-mac/files/disable-generic-plugin-when-others-available.patch
    new file mode 10644
    - +  
     1--- qtbase/src/network/bearer/qnetworkconfigmanager_p.cpp
     2+++ qtbase/src/network/bearer/qnetworkconfigmanager_p.cpp
     3@@ -413,7 +413,7 @@
     4             }
     5         }
     6 
     7-        if (generic)
     8+        if (generic && sessionEngines.count() == 0)
     9             sessionEngines.append(generic);
     10 #endif // QT_NO_LIBRARY
     11     }
  • new file trunk/dports/aqua/qt5-mac/files/fix-qstandardpaths.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/fix-qstandardpaths.patch b/trunk/dports/aqua/qt5-mac/files/fix-qstandardpaths.patch
    new file mode 10644
    - +  
     1--- qtbase/src/corelib/io/orig.qstandardpaths_mac.cpp   2014-09-11 12:48:06.000000000 +0200
     2+++ qtbase/src/corelib/io/qstandardpaths_mac.cpp        2015-01-10 22:11:59.000000000 +0100
     3@@ -45,6 +45,7 @@
     4 
     5 #ifndef QT_BOOTSTRAPPED
     6 #include <qcoreapplication.h>
     7+#include <qlibraryinfo.h>
     8 #endif
     9 
     10 #include <CoreFoundation/CoreFoundation.h>
     11@@ -126,7 +127,7 @@
     12     if (err)
     13        return QString();
     14 
     15-   QString path = getFullPath(ref);
     16+    QString path = getFullPath(ref);
     17 
     18     if (type == QStandardPaths::DataLocation || type == QStandardPaths::CacheLocation)
     19         appendOrganizationAndApp(path);
     20@@ -175,17 +176,85 @@
     21     }
     22 }
     23 
     24+static void normaliseDirs(QStringList &dirs)
     25+{
     26+    // Normalise paths, skip relative paths
     27+    QMutableListIterator<QString> it(dirs);
     28+    while (it.hasNext()) {
     29+        const QString dir = it.next();
     30+        if (!dir.startsWith(QLatin1Char('/')))
     31+            it.remove();
     32+        else
     33+            it.setValue(QDir::cleanPath(dir));
     34+    }
     35+
     36+    // Remove duplicates from the list, there's no use for duplicated
     37+    // paths in XDG_CONFIG_DIRS - if it's not found in the given
     38+    // directory the first time, it won't be there the second time.
     39+    // Plus duplicate paths causes problems for example for mimetypes,
     40+    // where duplicate paths here lead to duplicated mime types returned
     41+    // for a file, eg "text/plain,text/plain" instead of "text/plain"
     42+    dirs.removeDuplicates();
     43+}
     44+
     45+static QStringList xdgConfigDirs()
     46+{
     47+    QStringList dirs;
     48+    // http://standards.freedesktop.org/basedir-spec/latest/
     49+    QString xdgConfigDirsEnv = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS"));
     50+    if (xdgConfigDirsEnv.isEmpty()) {
     51+#ifndef QT_BOOTSTRAPPED
     52+        dirs.append(QLibraryInfo::location(QLibraryInfo::PrefixPath) + QString::fromLatin1("/config"));
     53+#endif
     54+    } else {
     55+        dirs = xdgConfigDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
     56+
     57+        normaliseDirs(dirs);
     58+    }
     59+    return dirs;
     60+}
     61+
     62+static QStringList xdgDataDirs()
     63+{
     64+    QStringList dirs;
     65+    // http://standards.freedesktop.org/basedir-spec/latest/
     66+    QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
     67+    if (xdgDataDirsEnv.isEmpty()) {
     68+#ifndef QT_BOOTSTRAPPED
     69+        dirs.append(QLibraryInfo::location(QLibraryInfo::PrefixPath) + QString::fromLatin1("/share"));
     70+#endif
     71+    } else {
     72+        dirs = xdgDataDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
     73+
     74+        normaliseDirs(dirs);
     75+    }
     76+    return dirs;
     77+}
     78+
     79 QStringList QStandardPaths::standardLocations(StandardLocation type)
     80 {
     81     QStringList dirs;
     82 
     83+    if (type == GenericDataLocation) {
     84+        dirs.append(xdgDataDirs());
     85+    }
     86+
     87     if (type == GenericDataLocation || type == DataLocation || type == GenericCacheLocation || type == CacheLocation) {
     88         const QString path = macLocation(type, kOnAppropriateDisk);
     89         if (!path.isEmpty())
     90             dirs.append(path);
     91     }
     92 
     93+    if (type == GenericConfigLocation || type == ConfigLocation)
     94+        dirs.append(xdgConfigDirs());
     95+
     96     if (type == DataLocation) {
     97+        QStringList xdgDirs = xdgDataDirs();
     98+        for (int i = 0; i < xdgDirs.count(); ++i) {
     99+            appendOrganizationAndApp(xdgDirs[i]);
     100+        }
     101+        dirs.append(xdgDirs);
     102+
     103         CFBundleRef mainBundle = CFBundleGetMainBundle();
     104         if (mainBundle) {
     105             CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
  • new file trunk/dports/aqua/qt5-mac/files/fix_bug_in_internal_comparison_operator.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/fix_bug_in_internal_comparison_operator.patch b/trunk/dports/aqua/qt5-mac/files/fix_bug_in_internal_comparison_operator.patch
    new file mode 10644
    - +  
     1Author: Lars Knoll <lars.knoll@digia.com>
     2Date: Fri, 5 Sep 2014 12:58:19 +0200
     3Description: [PATCH] Fix bugs in internal comparison operators
     4 Lisandro removed the tests part as it didn't apply and we are not
     5 running them anyway.
     6MIME-Version: 1.0
     7Content-Type: text/plain; charset=UTF-8
     8Content-Transfer-Encoding: 8bit
     9
     10
     11The comparison operators between QJsonPrivate::String
     12and QJsonPrivate::Latin1String weren't all correct, leading
     13to wrong sorting of keys in QJsonObjects when the keys were
     14outside of the latin1 range and resulting lookup errors.
     15
     16Task-number: QTBUG-41100
     17Change-Id: Idceff615f85d7ab874ad2a8e4a6c1ce8c2aa0f65
     18Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
     19---
     20 src/corelib/json/qjson_p.h |   23 ++++++++++++++++++++---
     21 1 file changed, 20 insertions(+), 3 deletions(-)
     22
     23--- qtbase/src/corelib/json/qjson_p.h
     24+++ qtbase/src/corelib/json/qjson_p.h
     25@@ -352,7 +352,7 @@
     26         return !memcmp(d->utf16, str.d->utf16, d->length*sizeof(ushort));
     27     }
     28     inline bool operator<(const String &other) const;
     29-    inline bool operator >=(const String &other) const { return other < *this; }
     30+    inline bool operator >=(const String &other) const { return !(*this < other); }
     31 
     32     inline QString toString() const {
     33 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
     34@@ -412,12 +412,29 @@
     35             val = d->length - str.d->length;
     36         return val >= 0;
     37     }
     38+    inline bool operator<(const String &str) const
     39+    {
     40+        const qle_ushort *uc = (qle_ushort *) str.d->utf16;
     41+        if (!uc || *uc == 0)
     42+            return false;
     43+
     44+        const uchar *c = (uchar *)d->latin1;
     45+        const uchar *e = c + qMin((int)d->length, (int)str.d->length);
     46 
     47+        while (c < e) {
     48+            if (*c != *uc)
     49+                break;
     50+            ++c;
     51+            ++uc;
     52+        }
     53+        return (c == e ? (int)d->length < (int)str.d->length : *c < *uc);
     54+
     55+    }
     56     inline bool operator ==(const String &str) const {
     57         return (str == *this);
     58     }
     59     inline bool operator >=(const String &str) const {
     60-        return (str < *this);
     61+        return !(*this < str);
     62     }
     63 
     64     inline QString toString() const {
     65@@ -454,7 +471,7 @@
     66         a++,b++;
     67     if (l==-1)
     68         return (alen < blen);
     69-    return (ushort)*a - (ushort)*b;
     70+    return (ushort)*a < (ushort)*b;
     71 }
     72 
     73 inline bool String::operator<(const Latin1String &str) const
  • new file trunk/dports/aqua/qt5-mac/files/fix_sparc_atomics.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/fix_sparc_atomics.patch b/trunk/dports/aqua/qt5-mac/files/fix_sparc_atomics.patch
    new file mode 10644
    - +  
     1Description: Do not use specific headers for Sparc atomics
     2 By removing the unexistant sparc headers the C++11 ones will be used.
     3Author: Adam Majer <adamm@debian.org>
     4Forwarded: no
     5Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
     6
     7---
     8 src/corelib/thread/qbasicatomic.h |    2 --
     9 1 file changed, 2 deletions(-)
     10
     11--- qtbase/src/corelib/thread/qbasicatomic.h
     12+++ qtbase/src/corelib/thread/qbasicatomic.h
     13@@ -62,8 +62,6 @@
     14 #  include "QtCore/qatomic_ia64.h"
     15 #elif defined(Q_PROCESSOR_MIPS)
     16 #  include "QtCore/qatomic_mips.h"
     17-#elif defined(Q_PROCESSOR_SPARC)
     18-#  include "QtCore/qatomic_sparc.h"
     19 #elif defined(Q_PROCESSOR_X86)
     20 #  include <QtCore/qatomic_x86.h>
     21 
  • new file trunk/dports/aqua/qt5-mac/files/gnukfreebsd.diff

    diff --git a/trunk/dports/aqua/qt5-mac/files/gnukfreebsd.diff b/trunk/dports/aqua/qt5-mac/files/gnukfreebsd.diff
    new file mode 10644
    - +  
     1Author: Pino Toscano <toscano.pino@tiscali.it>
     2Description: Initial GNU/kFreeBSD support
     3 - add a gnukfreebsd-g++ qmake mkspec, mostly copied from the hurd-g++ one
     4 - properly use LD_LIBRARY_PATH on GNU/* systems
     5Last-Update: 2013-12-21
     6Forwarded: no
     7
     8---
     9 mkspecs/features/qt_functions.prf       |    2
     10 mkspecs/gnukfreebsd-g++/qmake.conf      |   52 ++++++++++++++++++
     11 mkspecs/gnukfreebsd-g++/qplatformdefs.h |   92 ++++++++++++++++++++++++++++++++
     12 3 files changed, 146 insertions(+)
     13
     14--- /dev/null
     15+++ qtbase/mkspecs/gnukfreebsd-g++/qmake.conf
     16@@ -0,0 +1,52 @@
     17+#
     18+# qmake configuration for gnukfreebsd-g++
     19+#
     20+
     21+MAKEFILE_GENERATOR      = UNIX
     22+QMAKE_PLATFORM          = gnukfreebsd
     23+CONFIG                 += incremental gdb_dwarf_index
     24+QMAKE_INCREMENTAL_STYLE = sublib
     25+
     26+QMAKE_CFLAGS_THREAD    += -D_REENTRANT
     27+QMAKE_CXXFLAGS_THREAD  += $$QMAKE_CFLAGS_THREAD
     28+
     29+QMAKE_INCDIR            =
     30+QMAKE_LIBDIR            =
     31+QMAKE_INCDIR_X11        =
     32+QMAKE_LIBDIR_X11        =
     33+QMAKE_INCDIR_OPENGL     =
     34+QMAKE_LIBDIR_OPENGL     =
     35+QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
     36+QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
     37+QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
     38+QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
     39+QMAKE_INCDIR_EGL        =
     40+QMAKE_LIBDIR_EGL        =
     41+QMAKE_INCDIR_OPENVG     =
     42+QMAKE_LIBDIR_OPENVG     =
     43+
     44+QMAKE_LIBS              =
     45+QMAKE_LIBS_DYNLOAD      = -ldl
     46+QMAKE_LIBS_X11          = -lXext -lX11 -lm
     47+QMAKE_LIBS_NIS          = -lnsl
     48+QMAKE_LIBS_EGL          = -lEGL
     49+QMAKE_LIBS_OPENGL       = -lGL
     50+QMAKE_LIBS_OPENGL_ES1   = -lGLES_CM
     51+QMAKE_LIBS_OPENGL_ES2   = -lGLESv2
     52+QMAKE_LIBS_OPENVG       = -lOpenVG
     53+QMAKE_LIBS_THREAD       = -lpthread
     54+
     55+QMAKE_AR                = ar cqs
     56+QMAKE_OBJCOPY           = objcopy
     57+QMAKE_NM                = nm -P
     58+QMAKE_RANLIB            =
     59+
     60+QMAKE_STRIP             = strip
     61+QMAKE_STRIPFLAGS_LIB   += --strip-unneeded
     62+QMAKE_INSTALL_FILE      = install -m 644 -p
     63+QMAKE_INSTALL_PROGRAM   = install -m 755 -p
     64+
     65+include(../common/unix.conf)
     66+include(../common/gcc-base-unix.conf)
     67+include(../common/g++-unix.conf)
     68+load(qt_config)
     69--- /dev/null
     70+++ qtbase/mkspecs/gnukfreebsd-g++/qplatformdefs.h
     71@@ -0,0 +1,92 @@
     72+/****************************************************************************
     73+**
     74+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
     75+** Contact: http://www.qt-project.org/legal
     76+**
     77+** This file is part of the qmake spec of the Qt Toolkit.
     78+**
     79+** $QT_BEGIN_LICENSE:LGPL$
     80+** Commercial License Usage
     81+** Licensees holding valid commercial Qt licenses may use this file in
     82+** accordance with the commercial license agreement provided with the
     83+** Software or, alternatively, in accordance with the terms contained in
     84+** a written agreement between you and Digia.  For licensing terms and
     85+** conditions see http://qt.digia.com/licensing.  For further information
     86+** use the contact form at http://qt.digia.com/contact-us.
     87+**
     88+** GNU Lesser General Public License Usage
     89+** Alternatively, this file may be used under the terms of the GNU Lesser
     90+** General Public License version 2.1 as published by the Free Software
     91+** Foundation and appearing in the file LICENSE.LGPL included in the
     92+** packaging of this file.  Please review the following information to
     93+** ensure the GNU Lesser General Public License version 2.1 requirements
     94+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
     95+**
     96+** In addition, as a special exception, Digia gives you certain additional
     97+** rights.  These rights are described in the Digia Qt LGPL Exception
     98+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
     99+**
     100+** GNU General Public License Usage
     101+** Alternatively, this file may be used under the terms of the GNU
     102+** General Public License version 3.0 as published by the Free Software
     103+** Foundation and appearing in the file LICENSE.GPL included in the
     104+** packaging of this file.  Please review the following information to
     105+** ensure the GNU General Public License version 3.0 requirements will be
     106+** met: http://www.gnu.org/copyleft/gpl.html.
     107+**
     108+**
     109+** $QT_END_LICENSE$
     110+**
     111+****************************************************************************/
     112+
     113+#ifndef QPLATFORMDEFS_H
     114+#define QPLATFORMDEFS_H
     115+
     116+// Get Qt defines/settings
     117+
     118+#include "qglobal.h"
     119+
     120+// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
     121+
     122+// 1) need to reset default environment if _BSD_SOURCE is defined
     123+// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
     124+// 3) it seems older glibc need this to include the X/Open stuff
     125+#ifndef _GNU_SOURCE
     126+#  define _GNU_SOURCE
     127+#endif
     128+
     129+#include <unistd.h>
     130+
     131+
     132+// We are hot - unistd.h should have turned on the specific APIs we requested
     133+
     134+
     135+#include <pthread.h>
     136+#include <dirent.h>
     137+#include <fcntl.h>
     138+#include <grp.h>
     139+#include <pwd.h>
     140+#include <signal.h>
     141+#include <dlfcn.h>
     142+
     143+#include <sys/types.h>
     144+#include <sys/ioctl.h>
     145+#include <sys/ipc.h>
     146+#include <sys/time.h>
     147+#include <sys/shm.h>
     148+#include <sys/socket.h>
     149+#include <sys/stat.h>
     150+#include <sys/wait.h>
     151+#include <netinet/in.h>
     152+#ifndef QT_NO_IPV6IFNAME
     153+#include <net/if.h>
     154+#endif
     155+
     156+#include "../common/posix/qplatformdefs.h"
     157+
     158+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
     159+#define QT_SNPRINTF            ::snprintf
     160+#define QT_VSNPRINTF           ::vsnprintf
     161+#endif
     162+
     163+#endif // QPLATFORMDEFS_H
     164--- qtbase/mkspecs/features/qt_functions.prf
     165+++ qtbase/mkspecs/features/qt_functions.prf
     166@@ -265,6 +265,8 @@
     167             deppath.name = PATH
     168         } else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) {
     169             deppath.name = LD_LIBRARY_PATH
     170+        } else:contains(QMAKE_HOST.os, ^GNU/.*) {
     171+            deppath.name = LD_LIBRARY_PATH
     172         } else:equals(QMAKE_HOST.os, Darwin) {
     173             contains(QT_CONFIG, qt_framework): \
     174                 deppath.name = DYLD_FRAMEWORK_PATH
  • new file trunk/dports/aqua/qt5-mac/files/load_testability_from_env_var.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/load_testability_from_env_var.patch b/trunk/dports/aqua/qt5-mac/files/load_testability_from_env_var.patch
    new file mode 10644
    - +  
     1Description: load testability from environment variable
     2Author: Thomi Richards <thomi.richards@canonical.com>
     3Forwarded: https://bugreports.qt-project.org/browse/QTBUG-32974
     4
     5--- qtbase/src/gui/kernel/qguiapplication.cpp
     6+++ qtbase/src/gui/kernel/qguiapplication.cpp
     7@@ -1256,6 +1256,9 @@
     8         argc = j;
     9     }
     10 
     11+    if (qgetenv("QT_LOAD_TESTABILITY").toInt() > 0)
     12+        loadTestability = true;
     13+
     14 #if defined(QT_DEBUG) && defined(Q_OS_LINUX)
     15     if (!doGrabUnderDebugger && !QGuiApplicationPrivate::noGrab && runningUnderDebugger()) {
     16         QGuiApplicationPrivate::noGrab = true;
  • new file trunk/dports/aqua/qt5-mac/files/qprocess-nozombies.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/qprocess-nozombies.patch b/trunk/dports/aqua/qt5-mac/files/qprocess-nozombies.patch
    new file mode 10644
    - +  
     1--- qtbase/src/corelib/io/orig.qprocess_unix.cpp        2014-04-10 20:37:11.000000000 +0200
     2+++ qtbase/src/corelib/io/qprocess_unix.cpp     2014-12-11 17:03:26.000000000 +0100
     3@@ -1320,17 +1320,18 @@
     4     processManager()->remove(q);
     5 }
     6 
     7+//https://codereview.qt-project.org/#/c/61294/
     8 bool QProcessPrivate::waitForDeadChild()
     9 {
     10     Q_Q(QProcess);
     11 
     12     // read a byte from the death pipe
     13     char c;
     14-    qt_safe_read(deathPipe[0], &c, 1);
     15+    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
     16 
     17     // check if our process is dead
     18     int exitStatus;
     19-    if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
     20+    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
     21         processManager()->remove(q);
     22         crashed = !WIFEXITED(exitStatus);
     23         exitCode = WEXITSTATUS(exitStatus);
  • new file trunk/dports/aqua/qt5-mac/files/remove_google_adsense.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/remove_google_adsense.patch b/trunk/dports/aqua/qt5-mac/files/remove_google_adsense.patch
    new file mode 10644
    - +  
     1Description: remove tracking javascript from examples
     2Author: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
     3Last-Update: 2014-02-17
     4
     5---
     6 examples/xml/htmlinfo/trolltech_com.html |   45 -------------------------------
     7 1 file changed, 45 deletions(-)
     8
     9--- qtbase/examples/xml/htmlinfo/trolltech_com.html
     10+++ qtbase/examples/xml/htmlinfo/trolltech_com.html
     11@@ -23,14 +23,6 @@
     12               content="Trolltech creates application development platforms for desktop and mobile device innovation." />
     13         <meta name="keywords" content="" />
     14     
     15-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"><!-- &nbsp;--></script>
     16-<script type="text/javascript">
     17-    <!-- Urchin script
     18-                _uacct = "UA-4457116-1";
     19-                urchinTracker();
     20-    -->
     21-       </script>
     22-     
     23         <base href="http://trolltech.com/homepage" />
     24       
     25     
     26@@ -910,43 +902,6 @@
     27     </div>
     28       
     29     </div>
     30-<!-- ProspectXtractor tracker script -->
     31-<script type="text/javascript"><!--
     32-function _pxPar()
     33-{
     34-var p="";
     35-p+="&ref="+escape(top.document.referrer);
     36-p+="&dt="+escape(document.title);
     37-p+="&sr="+screen.width+"x"+screen.height;
     38-p+="&sd="+screen.colorDepth;
     39-p+="&fv="+_pxFV();
     40-return p;
     41-}
     42-function _pxFV()
     43-{
     44-var f=0,n=navigator;
     45-if (n.plugins && n.mimeTypes.length) {
     46-var x=n.plugins["Shockwave Flash"];
     47-if(x && x.description) {
     48-var y=x.description;
     49-f=y.charAt(y.indexOf('.')-1);
     50-}
     51-} else {
     52-r=false;
     53-for(var i=15;i>=3&&r!=true;i-=1){
     54-execScript('on error resume next: r=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
     55-f=i;
     56-}
     57-}
     58-return f;
     59-}
     60-document.write('<img src="http://pxreg.onlineservicesas.com/pxreg/?id=50C9FD2F-61D5-4824-B726-50D6B1F89999'+_pxPar()+'" width="1" heigth="1" />');
     61-//-->
     62-</script>
     63-<noscript>
     64-<div><img src="http://pxreg.onlineservicesas.com/pxreg/?id=50C9FD2F-61D5-4824-B726-50D6B1F89999" width="1" height="1" alt="" /></div>
     65-</noscript>
     66-<!-- END ProspectXtractor tracker script -->
     67 </body>
     68 </html>
     69 
  • new file trunk/dports/aqua/qt5-mac/files/remove_icon_from_example.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/remove_icon_from_example.patch b/trunk/dports/aqua/qt5-mac/files/remove_icon_from_example.patch
    new file mode 10644
    - +  
     1Description: remove icon link from example html file
     2 This patch removes a suposedly privacy breach detected by lintian.
     3 As the Trolltech site is down and the example is simply not working I am
     4 just removing the link to it.
     5Author: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
     6Forwarded: not-needed
     7Last-Update: 2014-06-25
     8
     9---
     10 examples/xml/htmlinfo/trolltech_com.html |    3 ---
     11 1 file changed, 3 deletions(-)
     12
     13--- qtbase/examples/xml/htmlinfo/trolltech_com.html
     14+++ qtbase/examples/xml/htmlinfo/trolltech_com.html
     15@@ -110,9 +110,6 @@
     16         <style type="text/css" media="all">@import url(http://trolltech.com/IEFixes.css);</style>
     17     <![endif]-->
     18 
     19-    <link rel="shortcut icon" type="image/x-icon"
     20-          href="http://trolltech.com/favicon.ico" />
     21-
     22     <link rel="home" href="http://trolltech.com"
     23           title="Front page" />
     24     <link rel="search"
  • new file trunk/dports/aqua/qt5-mac/files/update-QtBearer-NetworkManager-backend-API.patch

    diff --git a/trunk/dports/aqua/qt5-mac/files/update-QtBearer-NetworkManager-backend-API.patch b/trunk/dports/aqua/qt5-mac/files/update-QtBearer-NetworkManager-backend-API.patch
    new file mode 10644
    - +  
     1From 151061ad4af9d1b844f0b029b4e84a3577487048 Mon Sep 17 00:00:00 2001
     2From: Lorn Potter <lorn.potter@jollamobile.com>
     3Date: Fri, 3 Oct 2014 19:30:04 +1000
     4Subject: [PATCH] update QtBearer NetworkManager backend API
     5
     6Task-number: QTBUG-41747
     7
     8Change-Id: Idb4afea0215b94957a11895c7db97a72ae680804
     9Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
     10---
     11 src/network/doc/src/bearermanagement.qdoc          |   2 +-
     12 .../networkmanager/qnetworkmanagerengine.cpp       | 124 ++++++++++-----------
     13 .../bearer/networkmanager/qnetworkmanagerengine.h  |   3 +-
     14 .../networkmanager/qnetworkmanagerservice.cpp      |  30 ++---
     15 .../bearer/networkmanager/qnetworkmanagerservice.h |   6 +-
     16 .../qnetworksession/test/tst_qnetworksession.cpp   |  12 +-
     17 6 files changed, 90 insertions(+), 87 deletions(-)
     18
     19--- qtbase/src/network/doc/src/bearermanagement.qdoc
     20+++ qtbase/src/network/doc/src/bearermanagement.qdoc
     21@@ -248,7 +248,7 @@
     22         \li Linux uses the \l {http://projects.gnome.org/NetworkManager}{NetworkManager}
     23            and \l {http://connman.net/}{ConnMan} / \l {http://ofono.org/}{oFono} APIs
     24            which support interface notifications and starting and stopping of network
     25-           interfaces.
     26+           interfaces. Network Manager version 0.9 and above is supported.
     27     \row
     28         \li Windows\unicode{0xAE} XP
     29         \li This platform supports interface notifications without active polling.
     30--- qtbase/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
     31+++ qtbase/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp
     32@@ -279,7 +279,11 @@
     33                                                  << QLatin1String("WCDMA")
     34                                                  << QLatin1String("HSPA")
     35                                                  << QLatin1String("Bluetooth")
     36-                                                 << QLatin1String("WiMAX");
     37+                                                 << QLatin1String("WiMAX")
     38+                                                 << QLatin1String("BearerEVDO")
     39+                                                 << QLatin1String("BearerLTE")
     40+                                                 << QLatin1String("Bearer3G")
     41+                                                 << QLatin1String("Bearer4G");
     42 
     43     if (!configuration.isValid()) {
     44         QVERIFY(configuration.bearerTypeName().isEmpty());
     45@@ -1035,7 +1039,11 @@
     46             if (config.bearerTypeName() != "2G" &&
     47                 config.bearerTypeName() != "CDMA2000" &&
     48                 config.bearerTypeName() != "WCDMA" &&
     49-                config.bearerTypeName() != "HSPA") {
     50+                config.bearerTypeName() != "HSPA" &&
     51+                config.bearerTypeName() != "EVDO" &&
     52+                config.bearerTypeName() != "LTE" &&
     53+                config.bearerTypeName() != "3G" &&
     54+                config.bearerTypeName() != "4G") {
     55                 // qDebug() << "Dumping config because bearer mismatches (cellular): " << config.name();
     56                 discoveredConfigs.removeOne(config);
     57             }