Commit 28530ec3 authored by Jan Grulich's avatar Jan Grulich
Browse files

Improve details layout

parent 973f4b2b
project(plasma-networkmanagement)
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
set(QT_MIN_VERSION "5.2.0")
set(PLASMA_NM_VERSION 1.0.0)
......@@ -22,16 +22,16 @@ include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
DBus
Designer
# Designer
Network
Test
Quick
Widgets
)
find_package(KF5 CONFIG REQUIRED
find_package(KF5 REQUIRED
I18n WindowSystem Service Completion WidgetsAddons KIO CoreAddons Wallet ItemViews XmlGui
ConfigWidgets IconThemes Solid DBusAddons Notifications Plasma Declarative Init KDE4Support)
ConfigWidgets IconThemes Solid DBusAddons Notifications Plasma Declarative Init KDELibs4Support)
find_package(KF5NetworkManagerQt)
set_package_properties(KF5NetworkManagerQt PROPERTIES
......
......@@ -41,7 +41,7 @@ Item {
width: Math.min(parent.width, parent.height)
height: width
svg: svgIcons;
elementId: connectionIconProvider.connectionIcon
elementId: connectionIconProvider.connectionIcon;
PlasmaComponents.BusyIndicator {
id: connectingIndicator;
......
......@@ -175,51 +175,108 @@ PlasmaComponents.ListItem {
}
}
PlasmaComponents.Button {
id: configureButton;
anchors {
right: parent.right;
rightMargin: padding.margins.right;
top: detailsSeparator.bottom;
topMargin: padding.margins.top;
}
opacity: connectionItem.containsMouse && Uuid ? 1 : 0
visible: opacity != 0
text: i18n("Configure");
Behavior on opacity { NumberAnimation { duration: units.shortDuration } }
onClicked: {
handler.editConnection(Uuid);
}
}
// PlasmaComponents.Button {
// id: configureButton;
//
// anchors {
// right: parent.right;
// rightMargin: padding.margins.right;
// top: detailsSeparator.bottom;
// topMargin: padding.margins.top;
// }
//
// opacity: connectionItem.containsMouse && Uuid ? 1 : 0
// visible: opacity != 0
// text: i18n("Configure");
//
// Behavior on opacity { NumberAnimation { duration: units.shortDuration } }
//
// onClicked: {
// handler.editConnection(Uuid);
// }
// }
Column {
id: details;
anchors {
left: parent.left;
leftMargin: units.iconSizes.medium + padding.margins.left;
right: configureButton.visible && Uuid ? configureButton.left : parent.right;
leftMargin: units.iconSizes.medium;
right: parent.right;
top: detailsSeparator.bottom;
topMargin: padding.margins.top;
}
Repeater {
id: repeater;
property int longestString: 0;
model: ConnectionDetails.length/2;
PlasmaComponents.Label {
Item {
anchors {
left: parent.left;
right: parent.right;
topMargin: padding.margins.top;
}
height: paintedHeight;
font.pointSize: theme.smallestFont.pointSize;
opacity: 0.6;
textFormat: Text.StyledText;
text: "<b>" + ConnectionDetails[index*2] + "</b>: " + ConnectionDetails[(index*2)+1];
wrapMode: Text.Wrap;
height: Math.max(detailNameLabel.height, detailValueLabel.height);
// height: background.height;
// PlasmaCore.FrameSvgItem {
// id : background
//
// anchors {
// left: parent.left;
// right: parent.right;
// verticalCenter: parent.verticalCenter;
// }
//
// height: Math.max(detailNameLabel.paintedHeight, detailValueLabel.paintedHeight) + padding.margins.top;
// imagePath: "widgets/listitem"
// prefix: "section";
// visible: index % 2 == 0;
// }
PlasmaComponents.Label {
id: detailNameLabel;
anchors {
left: parent.left;
leftMargin: repeater.longestString - paintedWidth + padding.margins.left;
verticalCenter: parent.verticalCenter;
}
height: paintedHeight;
font.pointSize: theme.smallestFont.pointSize;
horizontalAlignment: Text.AlignRight;
opacity: 0.6;
text: "<b>" + ConnectionDetails[index*2] + "</b>: ";
Component.onCompleted: {
if (paintedWidth > repeater.longestString) {
repeater.longestString = paintedWidth;
}
}
}
PlasmaComponents.Label {
id: detailValueLabel;
anchors {
left: detailNameLabel.right;
right: parent.right;
verticalCenter: parent.verticalCenter;
}
height: paintedHeight;
elide: Text.ElideRight;
font.pointSize: theme.smallestFont.pointSize;
opacity: 0.6;
text: ConnectionDetails[(index*2)+1];
textFormat: Text.StyledText;
}
}
}
}
......
......@@ -39,8 +39,8 @@ Item {
}
Plasmoid.toolTipMainText: ""
Plasmoid.toolTipSubText: networkStatus.activeConnections
Plasmoid.icon: connectionIconProvider.connectionTooltipIcon
Plasmoid.toolTipSubText: networkStatus.activeConnections;
Plasmoid.icon: connectionIconProvider.connectionTooltipIcon;
Plasmoid.compactRepresentation: CompactRepresentation { }
......
......@@ -32,7 +32,7 @@ target_link_libraries(kde-nm-connection-editor
KF5::Wallet
KF5::ItemViews
KF5::XmlGui
KF5::KDE4Support
KF5::KDELibs4Support
)
if (WITH_MODEMMANAGER_SUPPORT)
......
......@@ -48,7 +48,7 @@ target_link_libraries(kded_networkmanagement
KF5::WindowSystem
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
)
if (WITH_MODEMMANAGER_SUPPORT)
......@@ -58,4 +58,4 @@ endif()
install(TARGETS kded_networkmanagement DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES networkmanagement.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
install(FILES networkmanagement.notifyrc DESTINATION ${DATA_INSTALL_DIR}/networkmanagement)
install(FILES networkmanagement.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
......@@ -20,7 +20,7 @@ target_link_libraries(plasmanetworkmanagement-internal
KF5::Completion
KF5::I18n
KF5::IconThemes
KF5::KDE4Support
KF5::KDELibs4Support
KF5::Plasma
KF5::Notifications
Qt5::Xml
......
......@@ -82,15 +82,12 @@ ConnectionIcon::ConnectionIcon(QObject* parent)
}
foreach (NetworkManager::ActiveConnection::Ptr activeConnection, NetworkManager::activeConnections()) {
activeConnectionAdded(activeConnection->path());
if (activeConnection->vpn()) {
NetworkManager::VpnConnection::Ptr vpnConnection;
vpnConnection = activeConnection.objectCast<NetworkManager::VpnConnection>();
if (vpnConnection) {
connect(vpnConnection.data(), SIGNAL(stateChanged(NetworkManager::VpnConnection::State,NetworkManager::VpnConnection::StateChangeReason)),
SLOT(vpnConnectionStateChanged(NetworkManager::VpnConnection::State,NetworkManager::VpnConnection::StateChangeReason)), Qt::UniqueConnection);
if (vpnConnection->state() == NetworkManager::VpnConnection::Activated) {
m_vpn = true;
}
if (vpnConnection && vpnConnection->state() == NetworkManager::VpnConnection::Activated) {
m_vpn = true;
}
}
}
......
......@@ -35,7 +35,7 @@ class ConnectionIcon : public QObject
{
Q_PROPERTY(bool connecting READ connecting NOTIFY connectingChanged)
Q_PROPERTY(QString connectionIcon READ connectionIcon NOTIFY connectionIconChanged)
Q_PROPERTY(QString connectionTooltipIcon READ connectionIcon NOTIFY connectionTooltipIconChanged)
Q_PROPERTY(QString connectionTooltipIcon READ connectionTooltipIcon NOTIFY connectionTooltipIconChanged)
Q_OBJECT
public:
explicit ConnectionIcon(QObject* parent = 0);
......
......@@ -98,7 +98,7 @@ target_link_libraries(plasmanetworkmanagement-editor
KF5::Wallet
KF5::ItemViews
KF5::XmlGui
KF5::KDE4Support
KF5::KDELibs4Support
)
if (WITH_MODEMMANAGER_SUPPORT)
......
......@@ -367,23 +367,23 @@ void IPv4Widget::selectionChanged(const QItemSelection & selected)
void IPv4Widget::tableViewItemChanged(QStandardItem *item)
{
if (item->text().isEmpty()) {
return;
}
const int column = item->column();
if (column == 0) { // ip
int row = item->row();
QStandardItem *netmaskItem = d->model.item(row, column + 1); // netmask
if (netmaskItem && netmaskItem->text().isEmpty()) {
QHostAddress addr(item->text());
const quint32 netmask = suggestNetmask(addr.toIPv4Address());
if (netmask) {
QHostAddress v(netmask);
netmaskItem->setText(v.toString());
}
}
}
return;
}
const int column = item->column();
if (column == 0) { // ip
int row = item->row();
QStandardItem *netmaskItem = d->model.item(row, column + 1); // netmask
if (netmaskItem && netmaskItem->text().isEmpty()) {
QHostAddress addr(item->text());
const quint32 netmask = suggestNetmask(addr.toIPv4Address());
if (netmask) {
QHostAddress v(netmask);
netmaskItem->setText(v.toString());
}
}
}
}
void IPv4Widget::slotRoutesDialog()
......@@ -418,7 +418,7 @@ void IPv4Widget::slotDnsServers()
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
KEditListWidget * listWidget = new KEditListWidget(dialog);
listWidget->setItems(m_ui->dns->text().split(','));
listWidget->setItems(m_ui->dns->text().split(',').replaceInStrings(" ", ""));
dialog->layout()->addWidget(listWidget);
dialog->layout()->addWidget(buttons);
......@@ -444,7 +444,7 @@ void IPv4Widget::slotDnsDomains()
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
KEditListWidget * listWidget = new KEditListWidget(dialog);
listWidget->setItems(m_ui->dnsSearch->text().split(','));
listWidget->setItems(m_ui->dnsSearch->text().split(',').replaceInStrings(" ", ""));
dialog->layout()->addWidget(listWidget);
dialog->layout()->addWidget(buttons);
......
......@@ -408,7 +408,7 @@ void IPv6Widget::slotDnsServers()
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
KEditListWidget * listWidget = new KEditListWidget(dialog);
listWidget->setItems(m_ui->dns->text().split(','));
listWidget->setItems(m_ui->dns->text().split(',').replaceInStrings(" ", ""));
dialog->layout()->addWidget(listWidget);
dialog->layout()->addWidget(buttons);
......@@ -434,7 +434,7 @@ void IPv6Widget::slotDnsDomains()
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
KEditListWidget * listWidget = new KEditListWidget(dialog);
listWidget->setItems(m_ui->dnsSearch->text().split(','));
listWidget->setItems(m_ui->dnsSearch->text().split(',').replaceInStrings(" ", ""));
dialog->layout()->addWidget(listWidget);
dialog->layout()->addWidget(buttons);
......
......@@ -25,7 +25,7 @@ target_link_libraries(plasmanetworkmanagement_l2tpui
KF5::WidgetsAddons
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
)
install(TARGETS plasmanetworkmanagement_l2tpui DESTINATION ${PLUGIN_INSTALL_DIR}/plasmanetworkmanagement/vpnuiplugin)
......
......@@ -48,7 +48,7 @@ if (OPENCONNECT_FOUND)
KF5::WidgetsAddons
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
${OPENCONNECT_LIBRARIES}
${maybe_OPENSSL_LIBRARIES}
)
......
......@@ -23,7 +23,7 @@ target_link_libraries(plasmanetworkmanagement_openswanui
KF5::WidgetsAddons
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
)
install(TARGETS plasmanetworkmanagement_openswanui DESTINATION ${PLUGIN_INSTALL_DIR}/plasmanetworkmanagement/vpnuiplugin)
......
......@@ -23,7 +23,7 @@ target_link_libraries(plasmanetworkmanagement_pptpui
KF5::WidgetsAddons
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
)
install(TARGETS plasmanetworkmanagement_pptpui DESTINATION ${PLUGIN_INSTALL_DIR}/plasmanetworkmanagement/vpnuiplugin)
......
......@@ -17,7 +17,7 @@ target_link_libraries(plasmanetworkmanagement_strongswanui
KF5::Service
KF5::I18n
KF5::KIOWidgets
KF5::KDE4Support
KF5::KDELibs4Support
KF5::NetworkManagerQt
)
......
......@@ -24,7 +24,7 @@ target_link_libraries(plasmanetworkmanagement_vpncui
KF5::WidgetsAddons
KF5::KIOWidgets
KF5::CoreAddons
KF5::KDE4Support
KF5::KDELibs4Support
)
install(TARGETS plasmanetworkmanagement_vpncui DESTINATION ${PLUGIN_INSTALL_DIR}/plasmanetworkmanagement/vpnuiplugin)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment