~ubuntu-branches/ubuntu/wily/plasma-nm/wily-proposed

« back to all changes in this revision

Viewing changes to libs/uiutils.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Jonathan Riddell, Harald Sitter, Scarlett Clark
  • Date: 2014-10-01 16:14:15 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20141001161415-b3q27oqg8xqumbq7
Tags: 4:5.1.0.1-0ubuntu1
[ Jonathan Riddell ]
* New upstream release

[ Harald Sitter ]
* Drop ugly workaround to make a desktop file exectuable
  + This either should be done upstream or be lintian overridden (former
    seems more suitable). Upstream has been poked on IRC.
* Add lintian overrides
  + missing manpages: we don't care
  + package name doesn't match soname: we don't care for internal libraries
  + shlib-without-versioned-soname: we don't care for internal libraries
* Fix copyright short license for LGPL-KDEeV

[ Scarlett Clark ]
* Fix copyright short licence for LGPL-2.1-KDEeV 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Copyright 2008-2010 Sebastian Kügler <sebas@kde.org>
 
3
    Copyright 2013-2014 Jan Grulich <jgrulich@redhat.com>
3
4
 
4
5
    This program is free software; you can redistribute it and/or
5
6
    modify it under the terms of the GNU General Public License as
22
23
#include "uiutils.h"
23
24
 
24
25
// KDE
25
 
#include <KDebug>
26
 
#include <KLocale>
27
 
#include <KGlobal>
 
26
#include <KLocalizedString>
28
27
 
29
28
#include <NetworkManagerQt/BluetoothDevice>
30
29
#include <NetworkManagerQt/Manager>
54
53
{
55
54
    QString deviceText;
56
55
    switch (type) {
57
 
    case NetworkManager::Device::Ethernet:
58
 
        deviceText = i18nc("title of the interface widget in nm's popup", "Wired Ethernet");
59
 
        break;
60
56
    case NetworkManager::Device::Wifi:
61
 
        deviceText = i18nc("title of the interface widget in nm's popup", "Wireless 802.11");
 
57
        deviceText = i18nc("title of the interface widget in nm's popup", "Wi-Fi");
62
58
        break;
63
59
    case NetworkManager::Device::Bluetooth:
64
60
        deviceText = i18nc("title of the interface widget in nm's popup", "Bluetooth");
81
77
    case NetworkManager::Device::Vlan:
82
78
        deviceText = i18nc("title of the interface widget in nm's popup", "Virtual (vlan)");
83
79
        break;
 
80
#if NM_CHECK_VERSION(0, 9, 10)
 
81
    case NetworkManager::Device::Team:
 
82
        deviceText = i18nc("title of the interface widget in nm's popup", "Virtual (team)");
 
83
        break;
 
84
#endif
84
85
    case NetworkManager::Device::Modem: {
85
86
        const NetworkManager::ModemDevice::Ptr nmModemIface = iface.objectCast<NetworkManager::ModemDevice>();
86
87
        if (nmModemIface) {
94
95
                deviceText = i18nc("title of the interface widget in nm's popup", "Mobile Broadband");
95
96
                break;
96
97
            case NetworkManager::ModemDevice::NoCapability:
97
 
                kWarning() << "Unhandled modem sub type: NetworkManager::ModemDevice::NoCapability";
 
98
                qWarning() << "Unhandled modem sub type: NetworkManager::ModemDevice::NoCapability";
98
99
                break;
99
100
            }
100
101
        }
101
102
    }
102
103
        break;
 
104
    case NetworkManager::Device::Ethernet:
103
105
    default:
104
106
        deviceText = i18nc("title of the interface widget in nm's popup", "Wired Ethernet");
105
107
        break;
153
155
        icon = "network-wireless";
154
156
        break;
155
157
    case ConnectionSettings::Wired:
156
 
        text = i18n("Wired");
 
158
        text = i18n("Wired Ethernet");
157
159
        icon = "network-wired";
158
160
        break;
159
161
    case ConnectionSettings::Wireless:
160
 
        text = i18n("Wireless");
 
162
        text = i18n("Wi-Fi");
161
163
        icon = "network-wireless";
162
164
        break;
 
165
#if NM_CHECK_VERSION(0, 9, 10)
 
166
    case ConnectionSettings::Team:
 
167
        text = i18n("Team");
 
168
        break;
 
169
#endif
163
170
    default:
164
171
        text = i18n("Unknown connection type");
165
172
        break;
352
359
{
353
360
    QString out;
354
361
    if (bitrate < 1000) {
355
 
        out = i18nc("connection speed", "<numid>%1</numid> Bit/s", bitrate);
 
362
        out = i18nc("connection speed", "%1 Bit/s", bitrate);
356
363
    } else if (bitrate < 1000000) {
357
 
        out = i18nc("connection speed", "<numid>%1</numid> MBit/s", bitrate/1000);
 
364
        out = i18nc("connection speed", "%1 MBit/s", bitrate/1000);
358
365
    } else {
359
 
        out = i18nc("connection speed", "<numid>%1</numid> GBit/s", bitrate/1000000);
 
366
        out = i18nc("connection speed", "%1 GBit/s", bitrate/1000000);
360
367
    }
361
368
    return out;
362
369
}
482
489
QString UiUtils::convertNspTypeToString(WimaxNsp::NetworkType type)
483
490
{
484
491
    switch (type) {
485
 
        case WimaxNsp::Unknown: return i18nc("Unknown", "Unknown Wimax NSP type");
 
492
        case WimaxNsp::Unknown: return i18nc("unknown Wimax NSP type", "Unknown");
486
493
        case WimaxNsp::Home: return i18n("Home");
487
494
        case WimaxNsp::Partner: return i18n("Partner");
488
495
        case WimaxNsp::RoamingPartner: return i18n("Roaming partner");
540
547
    return tip;
541
548
}
542
549
 
543
 
QString UiUtils::shortToolTipFromWirelessSecurity(NetworkManager::Utils::WirelessSecurityType type)
544
 
{
545
 
    QString tip;
546
 
    switch (type) {
547
 
        case NetworkManager::Utils::None:
548
 
            tip = i18nc("@info:tooltip no security", "Insecure");
549
 
            break;
550
 
        case NetworkManager::Utils::StaticWep:
551
 
            tip = i18nc("@info:tooltip WEP security", "WEP");
552
 
            break;
553
 
        case NetworkManager::Utils::Leap:
554
 
            tip = i18nc("@info:tooltip LEAP security", "LEAP");
555
 
            break;
556
 
        case NetworkManager::Utils::DynamicWep:
557
 
            tip = i18nc("@info:tooltip Dynamic WEP security", "Dynamic WEP");
558
 
            break;
559
 
        case NetworkManager::Utils::WpaPsk:
560
 
            tip = i18nc("@info:tooltip WPA-PSK security", "WPA-PSK");
561
 
            break;
562
 
        case NetworkManager::Utils::WpaEap:
563
 
            tip = i18nc("@info:tooltip WPA-EAP security", "WPA-EAP");
564
 
            break;
565
 
        case NetworkManager::Utils::Wpa2Psk:
566
 
            tip = i18nc("@info:tooltip WPA2-PSK security", "WPA2-PSK");
567
 
            break;
568
 
        case NetworkManager::Utils::Wpa2Eap:
569
 
            tip = i18nc("@info:tooltip WPA2-EAP security", "WPA2-EAP");
570
 
            break;
571
 
        default:
572
 
            tip = i18nc("@info:tooltip unknown security", "Unknown security type");
573
 
            break;
574
 
    }
575
 
    return tip;
576
 
}
577
 
 
578
 
QString UiUtils::connectionDetails(const Device::Ptr& device, const Connection::Ptr& connection, const QStringList& keys)
579
 
{
580
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
581
 
    QString details;
582
 
 
583
 
    const bool connected = device && connection && device->activeConnection() &&
584
 
                           device->activeConnection()->connection() == connection && device->activeConnection()->state() == ActiveConnection::Activated;
585
 
 
586
 
    foreach (const QString& key, keys) {
587
 
        if (key == "interface:name") {
588
 
            if (device) {
589
 
                QString name;
590
 
                if (device->ipInterfaceName().isEmpty()) {
591
 
                    name = device->interfaceName();
592
 
                } else {
593
 
                    name = device->ipInterfaceName();
594
 
                }
595
 
                details += QString(format).arg(i18n("System name:"), name);
596
 
            }
597
 
        } else if (key == "ipv4:address") {
598
 
            if (device && device->ipV4Config().isValid() && connected) {
599
 
                if (device->ipV4Config().addresses().isEmpty()) {
600
 
                    continue;
601
 
                }
602
 
                QHostAddress addr = device->ipV4Config().addresses().first().ip();
603
 
                if (!addr.isNull()) {
604
 
                    details += QString(format).arg(i18n("IPv4 Address:"), addr.toString());
605
 
                }
606
 
            }
607
 
        } else if (key == "ipv4:gateway") {
608
 
            if (device && device->ipV4Config().isValid() && connected) {
609
 
                if (device->ipV4Config().addresses().isEmpty()) {
610
 
                    continue;
611
 
                }
612
 
                QHostAddress addr = device->ipV4Config().addresses().first().gateway();
613
 
                if (!addr.isNull()) {
614
 
                    details += QString(format).arg(i18n("IPv4 Gateway:"), addr.toString());
615
 
                }
616
 
            }
617
 
        } else if (key == "ipv6:address") {
618
 
            if (device && device->ipV6Config().isValid() && connected) {
619
 
                if (device->ipV6Config().addresses().isEmpty()) {
620
 
                    continue;
621
 
                }
622
 
                QHostAddress addr = device->ipV6Config().addresses().first().ip();
623
 
                if (!addr.isNull()) {
624
 
                    details += QString(format).arg(i18n("IPv6 Address:"), addr.toString());
625
 
                }
626
 
            }
627
 
        } else if (key == "ipv6:gateway") {
628
 
            if (device && device->ipV6Config().isValid() && connected) {
629
 
                if (device->ipV6Config().addresses().isEmpty()) {
630
 
                    continue;
631
 
                }
632
 
                QHostAddress addr = device->ipV6Config().addresses().first().gateway();
633
 
                if (!addr.isNull() && addr.toString() != "::") {
634
 
                    details += QString(format).arg(i18n("IPv6 Gateway:"), addr.toString());
635
 
                }
636
 
            }
637
 
        } else if (key == "interface:driver") {
638
 
            if (device) {
639
 
                details += QString(format).arg(i18n("Driver:"), device->driver());
640
 
            }
641
 
        }
642
 
    }
643
 
 
644
 
    return details;
645
 
}
646
 
 
647
 
QString UiUtils::bluetoothDetails(const BluetoothDevice::Ptr& btDevice, const QStringList& keys)
648
 
{
649
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
650
 
    QString details;
651
 
 
652
 
    foreach (const QString& key, keys) {
653
 
        if (key == "bluetooth:name") {
654
 
            if (btDevice) {
655
 
                details += QString(format).arg(i18nc("Name", "Bluetooth name"), btDevice->name());
656
 
            }
657
 
        } else if (key == "interface:hardwareAddress") {
658
 
            if (btDevice) {
659
 
                details += QString(format).arg(i18n("MAC Address:"), btDevice->hardwareAddress());
660
 
            }
661
 
        }
662
 
    }
663
 
 
664
 
    return details;
665
 
}
666
 
 
667
 
QString UiUtils::modemDetails(const ModemDevice::Ptr& modemDevice, const QStringList& keys)
668
 
{
669
 
#if WITH_MODEMMANAGER_SUPPORT
670
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
671
 
    QString details;
672
 
    ModemManager::Modem::Ptr modemNetwork;
673
 
    ModemManager::Modem3gpp::Ptr gsmNet;
674
 
    ModemManager::ModemCdma::Ptr cdmaNet;
675
 
 
676
 
    ModemManager::ModemDevice::Ptr modem = ModemManager::findModemDevice(modemDevice->udi());
677
 
    if (modem) {
678
 
        modemNetwork = modem->interface(ModemManager::ModemDevice::ModemInterface).objectCast<ModemManager::Modem>();
679
 
        gsmNet = modem->interface(ModemManager::ModemDevice::GsmInterface).objectCast<ModemManager::Modem3gpp>();
680
 
        cdmaNet = modem->interface(ModemManager::ModemDevice::CdmaInterface).objectCast<ModemManager::ModemCdma>();
681
 
    }
682
 
 
683
 
    foreach (const QString& key, keys) {
684
 
        if (key == "mobile:operator") {
685
 
            if (gsmNet) {
686
 
                details += QString(format).arg(i18n("Operator:"), gsmNet->operatorName());
687
 
            } else if (cdmaNet) {
688
 
                details += QString(format).arg(i18n("Network ID:"), cdmaNet->nid());
689
 
            }
690
 
        } else if (key == "mobile:quality") {
691
 
            if (modemNetwork) {
692
 
                details += QString(format).arg(i18n("Signal Quality:"), QString("%1%").arg(modemNetwork->signalQuality().signal));
693
 
            }
694
 
        } else if (key == "mobile:technology") {
695
 
            if (modemNetwork) {
696
 
                details += QString(format).arg(i18n("Access Technology:"), UiUtils::convertAccessTechnologyToString(modemNetwork->accessTechnologies()));
697
 
            }
698
 
        } else if (key == "mobile:mode") {
699
 
            if (modemNetwork) {
700
 
                details += QString(format).arg(i18n("Allowed Mode:"), UiUtils::convertAllowedModeToString(modemNetwork->currentModes().allowed));
701
 
            }
702
 
        } else if (key == "mobile:unlock") {
703
 
            if (modemNetwork) {
704
 
                details += QString(format).arg(i18n("Unlock Required:"), UiUtils::convertLockReasonToString(modemNetwork->unlockRequired()));
705
 
            }
706
 
        } else if (key == "mobile:imei") {
707
 
            if (modemNetwork) {
708
 
                details += QString(format).arg(i18n("IMEI:"), modemNetwork->equipmentIdentifier());
709
 
            }
710
 
        } else if (key == "mobile:imsi") {
711
 
            if (modemDevice) {
712
 
                ModemManager::Sim::Ptr simCard;
713
 
                simCard = modemDevice->getModemCardIface();
714
 
                if (simCard) {
715
 
                    details += QString(format).arg(i18n("IMSI:"), simCard->imsi());
716
 
                }
717
 
            }
718
 
        }
719
 
    }
720
 
    return details;
721
 
#else
722
 
    Q_UNUSED(modemDevice)
723
 
    Q_UNUSED(keys)
724
 
    return QString();
725
 
#endif
726
 
}
727
 
 
728
 
QString UiUtils::vpnDetails(const VpnConnection::Ptr& vpnConnection, const VpnSetting::Ptr& vpnSetting, const QStringList& keys)
729
 
{
730
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
731
 
    QString details;
732
 
 
733
 
    foreach (const QString& key, keys) {
734
 
        if (key == "vpn:plugin") {
735
 
            if (vpnSetting) {
736
 
                details += QString(format).arg(i18n("VPN plugin:"), vpnSetting->serviceType().section('.', -1));
737
 
            }
738
 
        } else if (key == "vpn:banner") {
739
 
            if (vpnConnection) {
740
 
                details += QString(format).arg(i18n("Banner:"), vpnConnection->banner().simplified());
741
 
            }
742
 
        }
743
 
    }
744
 
 
745
 
    return details;
746
 
}
747
 
 
748
 
QString UiUtils::wimaxDetails(const NetworkManager::WimaxDevice::Ptr& wimaxDevice, const WimaxNsp::Ptr& wimaxNsp, const NetworkManager::Connection::Ptr& connection, const QStringList& keys)
749
 
{
750
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
751
 
    QString details;
752
 
 
753
 
    const bool connected = wimaxDevice && connection && wimaxDevice->activeConnection() &&
754
 
                           wimaxDevice->activeConnection()->connection() == connection && wimaxDevice->activeConnection()->state() == ActiveConnection::Activated;
755
 
 
756
 
    foreach (const QString& key, keys) {
757
 
        if (key == "wimax:bsid") {
758
 
            if (connected && wimaxDevice) {
759
 
                details += QString(format).arg(i18n("Bsid:"), wimaxDevice->bsid());
760
 
            }
761
 
        } else if (key == "wimax:nsp") {
762
 
            if (wimaxNsp) {
763
 
                details += QString(format).arg(i18n("NSP Name:"), wimaxNsp->name());
764
 
            }
765
 
        } else if (key == "wimax:signal") {
766
 
            if (wimaxNsp) {
767
 
                details += QString(format).arg(i18n("Signal Quality:"), i18n("%1%", wimaxNsp->signalQuality()));
768
 
            }
769
 
        } else if (key == "wimax:type") {
770
 
            if (wimaxNsp) {
771
 
                details += QString(format).arg(i18n("Network Type:"), UiUtils::convertNspTypeToString(wimaxNsp->networkType()));
772
 
            }
773
 
        }
774
 
    }
775
 
 
776
 
    return details;
777
 
}
778
 
 
779
 
QString UiUtils::wiredDetails(const WiredDevice::Ptr& wiredDevice, const NetworkManager::Connection::Ptr& connection, const QStringList& keys)
780
 
{
781
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
782
 
    QString details;
783
 
 
784
 
    const bool connected = wiredDevice && connection && wiredDevice->activeConnection() &&
785
 
                           wiredDevice->activeConnection()->connection() == connection && wiredDevice->activeConnection()->state() == ActiveConnection::Activated;
786
 
 
787
 
    foreach (const QString& key, keys) {
788
 
        if (key == "interface:bitrate") {
789
 
            if (wiredDevice && connected) {
790
 
                details += QString(format).arg(i18n("Connection speed:"), UiUtils::connectionSpeed(wiredDevice->bitRate()));
791
 
            }
792
 
        } else if (key == "interface:hardwareaddress") {
793
 
            if (wiredDevice) {
794
 
                details += QString(format).arg(i18n("MAC Address:"), wiredDevice->permanentHardwareAddress());
795
 
            }
796
 
        }
797
 
    }
798
 
 
799
 
    return details;
800
 
}
801
 
 
802
 
QString UiUtils::wirelessDetails(const WirelessDevice::Ptr& wirelessDevice, const AccessPoint::Ptr& ap, const NetworkManager::Connection::Ptr& connection, const QStringList& keys)
803
 
{
804
 
    const QString format = "<tr><td align=\"right\" width=\"50%\"><b>%1</b></td><td align=\"left\" width=\"50%\">&nbsp;%2</td></tr>";
805
 
    QString details;
806
 
 
807
 
    const bool connected = wirelessDevice && connection && wirelessDevice->activeConnection() &&
808
 
                           wirelessDevice->activeConnection()->connection() == connection && wirelessDevice->activeConnection()->state() == ActiveConnection::Activated;
809
 
 
810
 
 
811
 
    foreach (const QString& key, keys) {
812
 
        if (key == "interface:bitrate") {
813
 
            if (wirelessDevice && connected) {
814
 
                details += QString(format).arg(i18n("Connection speed:"), UiUtils::connectionSpeed(wirelessDevice->bitRate()));
815
 
            }
816
 
        } else if (key == "interface:hardwareaddress") {
817
 
            if (wirelessDevice) {
818
 
                details += QString(format).arg(i18n("MAC Address:"), wirelessDevice->permanentHardwareAddress());
819
 
            }
820
 
        } else if (key == "wireless:mode") {
821
 
            if (wirelessDevice) {
822
 
                details += QString(format).arg(i18n("Mode:"), UiUtils::operationModeToString(wirelessDevice->mode()));
823
 
            }
824
 
        } else if (key == "wireless:signal") {
825
 
            if (ap) {
826
 
                details += QString(format).arg(i18n("Signal strength:"), i18n("%1%", ap->signalStrength()));
827
 
            }
828
 
        } else if (key == "wireless:ssid") {
829
 
            if (ap) {
830
 
                details += QString(format).arg(i18n("Access point (SSID):"), ap->ssid());
831
 
            }
832
 
        } else if (key == "wireless:accesspoint") {
833
 
            if (ap) {
834
 
                details += QString(format).arg(i18n("Access point (BSSID):"), ap->hardwareAddress());
835
 
            }
836
 
        } else if (key == "wireless:channel") {
837
 
            if (ap) {
838
 
                details += QString(format).arg(i18nc("Wifi AP channel and frequency", "Channel:"), i18n("%1 (%2 MHz)", NetworkManager::Utils::findChannel(ap->frequency()), ap->frequency()));
839
 
            }
840
 
        } else if (key == "wireless:security") {
841
 
            NetworkManager::Utils::WirelessSecurityType security = Utils::Unknown;
842
 
            if (ap) {
843
 
                security = NetworkManager::Utils::findBestWirelessSecurity(wirelessDevice->wirelessCapabilities(), true, (wirelessDevice->mode() == NetworkManager::WirelessDevice::Adhoc),
844
 
                                                                           ap->capabilities(), ap->wpaFlags(), ap->rsnFlags());
845
 
                if (security != Utils::Unknown) {
846
 
                    details += QString(format).arg(i18n("Security:"), UiUtils::labelFromWirelessSecurity(security));
847
 
                }
848
 
            } else if (connection) {
849
 
                // Necessary for example for AdHoc connections
850
 
                security = Utils::securityTypeFromConnectionSetting(connection->settings());
851
 
                if (security != Utils::Unknown) {
852
 
                    details += QString(format).arg(i18n("Security:"), UiUtils::labelFromWirelessSecurity(security));
853
 
                }
854
 
            }
855
 
        } else if (key == "wireless:band") {
856
 
            if (ap) {
857
 
                details += QString(format).arg(i18n("Frequency band:"), UiUtils::wirelessBandToString(NetworkManager::Utils::findFrequencyBand(ap->frequency())));
858
 
            }
859
 
        }
860
 
    }
861
 
 
862
 
    return details;
863
 
}
864
 
 
865
550
QString UiUtils::formatDateRelative(const QDateTime & lastUsed)
866
551
{
867
552
    QString lastUsedText;
868
553
    if (lastUsed.isValid()) {
869
554
        const QDateTime now = QDateTime::currentDateTime();
870
555
        if (lastUsed.daysTo(now) == 0 ) {
871
 
            int secondsAgo = lastUsed.secsTo(now);
 
556
            const int secondsAgo = lastUsed.secsTo(now);
872
557
            if (secondsAgo < (60 * 60 )) {
873
 
                int minutesAgo = secondsAgo / 60;
 
558
                const int minutesAgo = secondsAgo / 60;
874
559
                lastUsedText = i18ncp(
875
560
                                   "Label for last used time for a network connection used in the last hour, as the number of minutes since usage",
876
561
                                   "One minute ago",
877
562
                                   "%1 minutes ago",
878
563
                                   minutesAgo);
879
564
            } else {
880
 
                int hoursAgo = secondsAgo / (60 * 60);
 
565
                const int hoursAgo = secondsAgo / (60 * 60);
881
566
                lastUsedText = i18ncp(
882
567
                                   "Label for last used time for a network connection used in the last day, as the number of hours since usage",
883
568
                                   "One hour ago",
887
572
        } else if (lastUsed.daysTo(now) == 1) {
888
573
            lastUsedText = i18nc("Label for last used time for a network connection used the previous day", "Yesterday");
889
574
        } else {
890
 
            lastUsedText = KGlobal::locale()->formatDate(lastUsed.date(), KLocale::ShortDate);
 
575
            lastUsedText = QLocale().toString(lastUsed.date(), QLocale::ShortFormat);
891
576
        }
892
577
    } else {
893
578
        lastUsedText =  i18nc("Label for last used time for a "
921
606
        } else if (lastUsed.daysTo(now) == 1) {
922
607
            lastUsedText = i18nc("Label for last used time for a network connection used the previous day", "Last used yesterday");
923
608
        } else {
924
 
            lastUsedText = i18n("Last used on %1", KGlobal::locale()->formatDate(lastUsed.date(), KLocale::ShortDate));
 
609
            lastUsedText = i18n("Last used on %1", QLocale().toString(lastUsed.date(), QLocale::ShortFormat));
925
610
        }
926
611
    } else {
927
612
        lastUsedText =  i18nc("Label for last used time for a "