New upstream version 0.3.0

ubuntu/cosmic
Simon Quigley 7 years ago
commit b3c7c07f94

1
.gitignore vendored

@ -0,0 +1 @@
build/

@ -0,0 +1,83 @@
project(nm-tray)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(NM_TRAY_VERSION "0.3.0")
set(QT_MIN_VERSION "5.4.0")
set(CMAKE_AUTOMOC on)
set(CMAKE_AUTOUIC on)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS
Widgets
Gui
Network
DBus
LinguistTools
)
find_package(KF5NetworkManagerQt "5.24.0" REQUIRED)
include(GNUInstallDirs)
set(TRANSLATION_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
add_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS "-DTRANSLATION_DIR=\"${TRANSLATION_DIR}\"" "-DNM_TRAY_VERSION=\"${NM_TRAY_VERSION}\"")
if (NOT NM_TRAY_XDG_AUTOSTART_DIR)
#Note: we need the default to be /etc... (not the ${CMAKE_INSTALL_PREFIX}/etc)
set(NM_TRAY_XDG_AUTOSTART_DIR "/${CMAKE_INSTALL_SYSCONFDIR}/xdg/autostart")
endif ()
message(STATUS "Translations destination dir: ${TRANSLATION_DIR}")
message(STATUS "Autostart .desktop entry destination dir: ${NM_TRAY_XDG_AUTOSTART_DIR}\n (can be overriden by setting the NM_TRAY_XDG_AUTOSTART_DIR cmake variable)")
set(SRCS
src/log.cpp
src/icons.cpp
src/nmmodel.cpp
src/nmproxy.cpp
src/connectioninfo.cpp
src/nmlist.cpp
src/menuview.cpp
src/windowmenu.cpp
src/tray.cpp
src/translate.cpp
src/main.cpp
)
file(GLOB TSS "translations/${PROJECT_NAME}_*.ts")
if (UPDATE_TRANSLATIONS)
message(WARNING "!! Disable updating translation after make (-DUPDATE_TRANSLATIONS=no) to avoid 'make clean' delete them !!")
qt5_create_translation(QMS "translations/${PROJECT_NAME}.ts" ${TSS} "src")
else ()
qt5_add_translation(QMS ${TSS})
endif()
qt5_add_dbus_interface(SRCS
dbus/org.freedesktop.Notifications.xml
dbus/org.freedesktop.Notifications
)
add_executable(nm-tray
${SRCS}
${QMS}
)
set_property(TARGET nm-tray PROPERTY CXX_STANDARD 11)
set_property(TARGET nm-tray PROPERTY CXX_STANDARD_REQUIRED on)
target_link_libraries(nm-tray
Qt5::Widgets
Qt5::Gui
KF5::NetworkManagerQt
)
if (WITH_MODEMMANAGER_SUPPORT)
target_link_libraries(nm-tray KF5::ModemManagerQt)
endif()
install(TARGETS nm-tray RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" COMPONENT runtime)
install(FILES ${QMS} DESTINATION "${TRANSLATION_DIR}" COMPONENT translations)
install(FILES "resources/nm-tray.desktop" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications" COMPONENT data)
install(FILES "resources/nm-tray-autostart.desktop" DESTINATION "${NM_TRAY_XDG_AUTOSTART_DIR}" COMPONENT data)

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

@ -0,0 +1,26 @@
# nm-tray
**nm-tray** is a simple [NetworkManager](https://wiki.gnome.org/Projects/NetworkManager) front end with information icon residing in system tray (like e.g. nm-applet).
It's a pure Qt application. For interaction with *NetworkManager* it uses API provided by [**KF5::NetworkManagerQt**](https://projects.kde.org/projects/frameworks/networkmanager-qt) -> plain DBus communication.
**! This is work in progress and there are still many TODOs and debugs all around in the code !**
## License
This software is licensed under [GNU GPLv2 or later](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
## Build example
git clone https://github.com/palinek/nm-tray.git
cd nm-tray
mkdir build
cd build
cmake ..
make
./nm-tray
## Packages
For [arch users](https://www.archlinux.org/) there is an AUR packge [nm-tray-git](https://aur.archlinux.org/packages/nm-tray-git/) (thanks to [pmattern](https://github.com/pmattern)).
For [openSUSE users](https://www.opensuse.org/) there is a [package](https://build.opensuse.org/package/show/X11:LXQt:git/nm-tray) in the [X11:LXQt:git](https://build.opensuse.org/project/show/X11:LXQt:git) devel project of OBS.

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.Notifications">
<method name="GetServerInformation">
<arg direction="out" type="s" name="name"/>
<arg direction="out" type="s" name="vendor"/>
<arg direction="out" type="s" name="version"/>
<arg direction="out" type="s" name="spec_version"/>
</method>
<method name="CloseNotification">
<arg direction="in" type="u" name="id"/>
</method>
<method name="Notify">
<annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName.In6"/>
<arg direction="in" type="s" name="app_name"/>
<arg direction="in" type="u" name="replaces_id"/>
<arg direction="in" type="s" name="app_icon"/>
<arg direction="in" type="s" name="summary"/>
<arg direction="in" type="s" name="body"/>
<arg direction="in" type="as" name="actions"/>
<arg direction="in" type="a{sv}" name="hints"/>
<arg direction="in" type="i" name="expire_timeout"/>
<arg direction="out" type="u" name="id"/>
</method>
<method name="GetCapabilities">
<arg direction="out" type="as" name="capabilities"/>
</method>
<signal name="ActionInvoked">
<arg type="u"/>
<arg type="s"/>
</signal>
<signal name="NotificationClosed">
<arg type="u"/>
<arg type="u"/>
</signal>
</interface>
</node>

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=nm-tray
TryExec=nm-tray
Exec=nm-tray
NotShowIn=KDE;GNOME;
X-LXQt-Need-Tray=true

@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=nm-tray
Comment=NetworkManager frontend (tray icon)
Icon=network-transmit
TryExec=nm-tray
Exec=nm-tray
Categories=Network;System;Monitor;Qt;TrayIcon

@ -0,0 +1,102 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "connectioninfo.h"
#include "ui_connectioninfo.h"
#include "nmproxy.h"
#include <QScrollArea>
#include <QLabel>
#include <QItemSelection>
#include <QSortFilterProxyModel>
ConnectionInfo::ConnectionInfo(NmModel * model, QWidget *parent)
: QDialog{parent}
, ui{new Ui::ConnectionInfo}
, mModel{model}
, mActive{new NmProxy}
, mSorted{new QSortFilterProxyModel}
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
mActive->setNmModel(mModel, NmModel::ActiveConnectionType);
mSorted->setSortCaseSensitivity(Qt::CaseInsensitive);
mSorted->sort(0);
mSorted->setSourceModel(mActive.data());
for (int i = 0, row_cnt = mSorted->rowCount(); i < row_cnt; ++i)
{
addTab(mSorted->index(i, 0));
}
connect(mSorted.data(), &QAbstractItemModel::rowsInserted, [this] (QModelIndex const & parent, int first, int last) {
ui->tabWidget->setUpdatesEnabled(false);
for (int i = first; i <= last; ++i)
addTab(mSorted->index(i, 0, parent));
ui->tabWidget->setUpdatesEnabled(true);
});
connect(mSorted.data(), &QAbstractItemModel::rowsAboutToBeRemoved, [this] (QModelIndex const & parent, int first, int last) {
ui->tabWidget->setUpdatesEnabled(false);
for (int i = first; i <= last; ++i)
removeTab(mSorted->index(i, 0, parent));
ui->tabWidget->setUpdatesEnabled(true);
});
connect(mSorted.data(), &QAbstractItemModel::dataChanged, [this] (const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & /*roles*/) {
ui->tabWidget->setUpdatesEnabled(false);
for (auto const & i : QItemSelection{topLeft, bottomRight}.indexes())
changeTab(i);
ui->tabWidget->setUpdatesEnabled(true);
});
}
ConnectionInfo::~ConnectionInfo()
{
}
void ConnectionInfo::addTab(QModelIndex const & index)
{
QScrollArea * content = new QScrollArea;
QLabel * l = new QLabel{mSorted->data(index, NmModel::ActiveConnectionInfoRole).toString()};
content->setWidget(l);
//QTabWidget takes ownership of the page (if we will not take it back)
ui->tabWidget->insertTab(index.row(), content, mSorted->data(index, NmModel::IconRole).value<QIcon>(), mSorted->data(index, NmModel::NameRole).toString());
}
void ConnectionInfo::removeTab(QModelIndex const & index)
{
const int i = index.row();
QWidget * w = ui->tabWidget->widget(i);
ui->tabWidget->removeTab(i);
w->deleteLater();
}
void ConnectionInfo::changeTab(QModelIndex const & index)
{
const int i = index.row();
QScrollArea * content = qobject_cast<QScrollArea *>(ui->tabWidget->widget(i));
Q_ASSERT(nullptr != content);
// Note: the text is HTML formatted and the QLabel probably creates some DOM internal represntation.
// Should the DOM structure change, the QLabel will not update correctly upon the plain setText()
content->setWidget(new QLabel{mSorted->data(index, NmModel::ActiveConnectionInfoRole).toString()});
ui->tabWidget->tabBar()->setTabText(i, mSorted->data(index, NmModel::NameRole).toString());
ui->tabWidget->tabBar()->setTabIcon(i, mSorted->data(index, NmModel::IconRole).value<QIcon>());
}

@ -0,0 +1,56 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#ifndef CONNECTIONINFO_H
#define CONNECTIONINFO_H
#include <QDialog>
namespace Ui {
class ConnectionInfo;
}
class NmModel;
class NmProxy;
class QSortFilterProxyModel;
class ConnectionInfo : public QDialog
{
Q_OBJECT
public:
explicit ConnectionInfo(NmModel * model, QWidget *parent = nullptr);
~ConnectionInfo();
private:
void addTab(QModelIndex const & index);
void removeTab(QModelIndex const & index);
void changeTab(QModelIndex const & index);
private:
QScopedPointer<Ui::ConnectionInfo> ui;
NmModel * mModel;
QScopedPointer<NmProxy> mActive;
QScopedPointer<QSortFilterProxyModel> mSorted;
};
#endif // CONNECTIONINFO_H

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConnectionInfo</class>
<widget class="QDialog" name="ConnectionInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>614</height>
</rect>
</property>
<property name="windowTitle">
<string>Connection information</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,116 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "icons.h"
#include <QStringList>
#include <QDebug>
namespace icons
{
QIcon getIcon(Icon ico)
{
static const QStringList i_empty;
QStringList const * icon_names = &i_empty;
switch (ico)
{
case NETWORK_OFFLINE:
static const QStringList i_network_offline = { QStringLiteral("network-offline-symbolic") };
icon_names = &i_network_offline;
break;
case NETWORK_WIRED:
static const QStringList i_network_wired = { QStringLiteral("network-wired-symbolic") };
icon_names = &i_network_wired;
break;
case NETWORK_WIRED_DISCONNECTED:
static const QStringList i_network_wired_disconnected = { QStringLiteral("network-wired-disconnected-symbolic") };
icon_names = &i_network_wired_disconnected;
break;
case NETWORK_WIFI_DISCONNECTED:
static const QStringList i_wifi_disconnected = { QStringLiteral("network-wireless-disconnected-symbolic") };
icon_names = &i_wifi_disconnected;
break;
case NETWORK_WIFI_ACQUIRING:
static const QStringList i_wifi_acquiring = { QStringLiteral("network-wireless-acquiring-symbolic") };
icon_names = &i_wifi_acquiring;
break;
case NETWORK_WIFI_NONE:
static const QStringList i_wifi_none = { QStringLiteral("network-wireless-signal-none-symbolic"), QStringLiteral("network-wireless-connected-00-symbolic") };
icon_names = &i_wifi_none;
break;
case NETWORK_WIFI_WEAK:
static const QStringList i_wifi_weak = { QStringLiteral("network-wireless-signal-weak-symbolic"), QStringLiteral("network-wireless-connected-25-symbolic") };
icon_names = &i_wifi_weak;
break;
case NETWORK_WIFI_OK:
static const QStringList i_wifi_ok = { QStringLiteral("network-wireless-signal-ok-symbolic"), QStringLiteral("network-wireless-connected-50-symbolic") };
icon_names = &i_wifi_ok;
break;
case NETWORK_WIFI_GOOD:
static const QStringList i_wifi_good = { QStringLiteral("network-wireless-signal-good-symbolic"), QStringLiteral("network-wireless-connected-75-symbolic") };
icon_names = &i_wifi_good;
break;
case NETWORK_WIFI_EXCELENT:
static const QStringList i_wifi_excelent = { QStringLiteral("network-wireless-signal-excellent-symbolic"), QStringLiteral("network-wireless-connected-100-symbolic") };
icon_names = &i_wifi_excelent;
break;
case NETWORK_VPN:
static const QStringList i_network_vpn = { QStringLiteral("network-vpn") };
icon_names = &i_network_vpn;
break;
case SECURITY_LOW:
static const QStringList i_security_low = { QStringLiteral("security-low-symbolic") };
icon_names = &i_security_low;
break;
case SECURITY_HIGH:
static const QStringList i_security_high = { QStringLiteral("security-high-symbolic") };
icon_names = &i_security_high;
break;
case PREFERENCES_NETWORK:
static const QStringList i_preferences_network = { QStringLiteral("preferences-system-network") };
icon_names = &i_preferences_network;
break;
};
for (auto const & name : *icon_names)
{
QIcon icon{QIcon::fromTheme(name)};
if (!icon.isNull())
return icon;
}
//TODO: fallback!?!
return QIcon::fromTheme(QStringLiteral("network-transmit"));
}
Icon wifiSignalIcon(const int signal)
{
if (0 >= signal)
return icons::NETWORK_WIFI_NONE;
else if (25 >= signal)
return icons::NETWORK_WIFI_WEAK;
else if (50 >= signal)
return icons::NETWORK_WIFI_OK;
else if (75 >= signal)
return icons::NETWORK_WIFI_GOOD;
else
return icons::NETWORK_WIFI_EXCELENT;
}
}

@ -0,0 +1,53 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(ICONS_H)
#define ICONS_H
#include <QIcon>
namespace icons
{
enum Icon {
NETWORK_OFFLINE
, NETWORK_WIRED
, NETWORK_WIRED_DISCONNECTED
, NETWORK_WIFI_ACQUIRING
, NETWORK_WIFI_NONE
, NETWORK_WIFI_WEAK
, NETWORK_WIFI_OK
, NETWORK_WIFI_GOOD
, NETWORK_WIFI_EXCELENT
, NETWORK_WIFI_DISCONNECTED
, NETWORK_VPN
, SECURITY_LOW
, SECURITY_HIGH
, PREFERENCES_NETWORK
};
QIcon getIcon(Icon ico);
Icon wifiSignalIcon(const int signal);
}
#endif

@ -0,0 +1,31 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "log.h"
#include <QtGlobal>
#if defined(NDEBUG)
Q_LOGGING_CATEGORY(NM_TRAY, "nm-tray", QtInfoMsg)
#else
Q_LOGGING_CATEGORY(NM_TRAY, "nm-tray")
#endif

@ -0,0 +1,31 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(LOG_H)
#define LOG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(NM_TRAY)
#endif //LOG_H

@ -0,0 +1,40 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include <QApplication>
#include "tray.h"
#include "icons.h"
int main(int argc, char * argv[])
{
QApplication app{argc, argv};
app.setOrganizationName(QStringLiteral("nm-tray"));
app.setApplicationName(QStringLiteral("nm-tray"));
app.setWindowIcon(icons::getIcon(icons::PREFERENCES_NETWORK));
app.setQuitOnLastWindowClosed(false);
Tray tray;
return app.exec();
}

@ -0,0 +1,159 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2016~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "menuview.h"
#include "nmmodel.h"
#include <QSortFilterProxyModel>
#include <QScrollBar>
#include <QProxyStyle>
#include <QStyledItemDelegate>
#include <QApplication>
#include <QPainter>
#include <QDebug>
namespace
{
class SingleActivateStyle : public QProxyStyle
{
public:
using QProxyStyle::QProxyStyle;
virtual int styleHint(StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0) const override
{
if(hint == QStyle::SH_ItemView_ActivateItemOnSingleClick)
return 1;
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
};
class MultiIconDelegate : public QStyledItemDelegate
{
public:
using QStyledItemDelegate::QStyledItemDelegate;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
{
Q_ASSERT(index.isValid());
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
//add the security overlay icon
QIcon sec_icon = qvariant_cast<QIcon>(index.data(NmModel::IconSecurityRole));
if (!sec_icon.isNull())
{
QPixmap res_pixmap = opt.icon.pixmap(opt.decorationSize);
QPainter p{&res_pixmap};
QSize sec_size = res_pixmap.size();
sec_size /= 2;
QPoint sec_pos = res_pixmap.rect().bottomRight();
sec_pos -= QPoint{sec_size.width(), sec_size.height()};
p.drawPixmap(sec_pos, sec_icon.pixmap(sec_size));
opt.icon = QIcon{res_pixmap};
}
QStyle *style = option.widget ? option.widget->style() : QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, option.widget);
}
};
}
MenuView::MenuView(QAbstractItemModel * model, QWidget * parent /*= nullptr*/)
: QListView(parent)
, mProxy{new QSortFilterProxyModel{this}}
, mMaxItemsToShow(10)
{
setEditTriggers(NoEditTriggers);
setSizeAdjustPolicy(AdjustToContents);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setSelectionBehavior(SelectRows);
setSelectionMode(NoSelection);
setFrameShape(QFrame::HLine);
setFrameShadow(QFrame::Plain);
setStyle(new SingleActivateStyle);
mProxy->setSourceModel(model);
mProxy->setDynamicSortFilter(true);
mProxy->setFilterRole(Qt::DisplayRole);
mProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
mProxy->setSortRole(Qt::DisplayRole);
mProxy->setSortCaseSensitivity(Qt::CaseInsensitive);
mProxy->sort(0);
{
QScopedPointer<QItemSelectionModel> guard{selectionModel()};
setModel(mProxy);
}
{
QScopedPointer<QAbstractItemDelegate> guard{itemDelegate()};
setItemDelegate(new MultiIconDelegate{this});
}
}
void MenuView::setFilter(QString const & filter)
{
mProxy->setFilterFixedString(filter);
const int count = mProxy->rowCount();
if (0 < count)
{
if (count > mMaxItemsToShow)
{
setCurrentIndex(mProxy->index(mMaxItemsToShow - 1, 0));
verticalScrollBar()->triggerAction(QScrollBar::SliderToMinimum);
} else
{
setCurrentIndex(mProxy->index(count - 1, 0));
}
}
}
void MenuView::setMaxItemsToShow(int max)
{
mMaxItemsToShow = max;
}
void MenuView::activateCurrent()
{
QModelIndex const index = currentIndex();
if (index.isValid())
emit activated(index);
}
QSize MenuView::viewportSizeHint() const
{
const int count = mProxy->rowCount();
QSize s{0, 0};
if (0 < count)
{
const bool scrollable = mMaxItemsToShow < count;
s.setWidth(sizeHintForColumn(0) + (scrollable ? verticalScrollBar()->sizeHint().width() : 0));
s.setHeight(sizeHintForRow(0) * (scrollable ? mMaxItemsToShow : count));
}
return s;
}
QSize MenuView::minimumSizeHint() const
{
return QSize{0, 0};
}

@ -0,0 +1,62 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2016~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(MENU_VIEW_H)
#define MENU_VIEW_H
#include <QListView>
class QAbstractItemModel;
class QSortFilterProxyModel;
class MenuView : public QListView
{
Q_OBJECT
public:
MenuView(QAbstractItemModel * model, QWidget * parent = nullptr);
/*! \brief Sets the filter for entries to be presented
*/
void setFilter(QString const & filter);
/*! \brief Set the maximum number of items/results to show
*/
void setMaxItemsToShow(int max);
/*! \brief Set the maximum width of item to show
*/
void setMaxItemWidth(int max);
public Q_SLOTS:
/*! \brief Trigger action on currently active item
*/
void activateCurrent();
protected:
virtual QSize viewportSizeHint() const override;
virtual QSize minimumSizeHint() const override;
private:
QSortFilterProxyModel * mProxy;
int mMaxItemsToShow;
};
#endif //MENU_VIEW_H

@ -0,0 +1,93 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "nmlist.h"
#include "ui_nmlist.h"
#include "nmmodel.h"
#include "nmproxy.h"
#include <QSortFilterProxyModel>
template <typename T>
void installDblClick(QAbstractItemView * view, QAbstractItemModel * m)
{
T * net_model = qobject_cast<T *>(m);
if (net_model)
{
QAbstractProxyModel * proxy = qobject_cast<QAbstractProxyModel *>(view->model());
Q_ASSERT(nullptr != proxy && proxy->sourceModel() == net_model);
QObject::connect(view, &QAbstractItemView::doubleClicked, [net_model, proxy] (QModelIndex const & i) {
QModelIndex source_i = proxy->mapToSource(i);
switch (static_cast<NmModel::ItemType>(net_model->data(source_i, NmModel::ItemTypeRole).toInt()))
{
case NmModel::ActiveConnectionType:
net_model->deactivateConnection(source_i);
break;
case NmModel::WifiNetworkType:
case NmModel::ConnectionType:
net_model->activateConnection(source_i);
break;
default:
//do nothing
break;
}
});
}
}
NmList::NmList(QString const & title, QAbstractItemModel * m, QWidget *parent)
: QDialog(parent)
, ui(new Ui::NmList)
{
ui->setupUi(this);
setWindowTitle(title);
Q_ASSERT(qobject_cast<NmModel*>(m));
QSortFilterProxyModel * proxy_sort = new QSortFilterProxyModel{this};
proxy_sort->setSortCaseSensitivity(Qt::CaseInsensitive);
proxy_sort->sort(0);
proxy_sort->setSourceModel(m);
ui->treeView->setModel(proxy_sort);
installDblClick<NmModel>(ui->treeView, m);
NmProxy * proxy = new NmProxy(this);
proxy->setNmModel(qobject_cast<NmModel*>(m), NmModel::ActiveConnectionType);
proxy_sort = new QSortFilterProxyModel{this};
proxy_sort->setSortCaseSensitivity(Qt::CaseInsensitive);
proxy_sort->sort(0);
proxy_sort->setSourceModel(proxy);
ui->listActive->setModel(proxy_sort);
installDblClick<NmProxy>(ui->listActive, proxy);
proxy = new NmProxy(this);
proxy->setNmModel(qobject_cast<NmModel*>(m), NmModel::WifiNetworkType);
proxy_sort = new QSortFilterProxyModel{this};
proxy_sort->setSortCaseSensitivity(Qt::CaseInsensitive);
proxy_sort->sort(0);
proxy_sort->setSourceModel(proxy);
ui->listWifi->setModel(proxy_sort);
installDblClick<NmProxy>(ui->listWifi, proxy);
}
NmList::~NmList()
{
delete ui;
}

@ -0,0 +1,46 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#ifndef NMLIST_H
#define NMLIST_H
#include <QDialog>
namespace Ui {
class NmList;
}
class QAbstractItemModel;
class NmList : public QDialog
{
Q_OBJECT
public:
explicit NmList(QString const & title, QAbstractItemModel * m, QWidget *parent = nullptr);
~NmList();
private:
Ui::NmList *ui;
};
#endif // NMLIST_H

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NmList</class>
<widget class="QDialog" name="NmList">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>507</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QLabel" name="labelAll">
<property name="text">
<string>All information</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QListView" name="listActive"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelActive">
<property name="text">
<string>Active connections</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QListView" name="listWifi"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelWifi">
<property name="text">
<string>Available wireless</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QTreeView" name="treeView">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,98 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(NMMODEL_H)
#define NMMODEL_H
#include <QAbstractItemModel>
class NmModelPrivate;
class NmModel : public QAbstractItemModel
{
Q_OBJECT
public:
enum ItemType
{
HelperType
, ActiveConnectionType
, ConnectionType
, DeviceType
, WifiNetworkType
};
enum ItemRole
{
ItemTypeRole = Qt::UserRole + 1
, NameRole
, IconTypeRole
, IconRole
, ConnectionTypeRole
, ActiveConnectionTypeRole = ConnectionTypeRole
, ConnectionTypeStringRole
, ActiveConnectionTypeStringRole = ConnectionTypeStringRole
, ConnectionUuidRole
, ActiveConnectionUuidRole = ConnectionUuidRole
, ConnectionPathRole
, ActiveConnectionPathRole = ConnectionPathRole
, ActiveConnectionInfoRole
, ActiveConnectionStateRole
, ActiveConnectionMasterRole
, ActiveConnectionDevicesRole
, IconSecurityTypeRole
, IconSecurityRole
, SignalRole
};
public:
explicit NmModel(QObject * parent = nullptr);
~NmModel();
//QAbstractItemModel methods
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
virtual QModelIndex parent(const QModelIndex &index) const override;
virtual QVariant data(const QModelIndex &index, int role) const override;
QModelIndex indexTypeRoot(ItemType type) const;
public Q_SLOTS:
//NetworkManager management methods
void activateConnection(QModelIndex const & index);
void deactivateConnection(QModelIndex const & index);
private:
bool isValidDataIndex(const QModelIndex & index) const;
template <int role>
QVariant dataRole(const QModelIndex & index) const;
private:
QScopedPointer<NmModelPrivate> d;
};
#endif //NMMODEL_H

@ -0,0 +1,129 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(NMMODEL_P_H)
#define NMMODEL_P_H
#include <NetworkManagerQt/Manager>
#include <NetworkManagerQt/Settings>
#include <NetworkManagerQt/WirelessDevice>
class NmModelPrivate : public QObject
{
Q_OBJECT
public:
NmModelPrivate();
~NmModelPrivate();
void removeActiveConnection(int pos);
void clearActiveConnections();
void insertActiveConnections();
void addActiveConnection(NetworkManager::ActiveConnection::Ptr conn);
void removeConnection(int pos);
void clearConnections();
void insertConnections();
void addConnection(NetworkManager::Connection::Ptr conn);
void removeDevice(int pos);
void clearDevices();
void insertDevices();
void addDevice(NetworkManager::Device::Ptr conn);
void removeWifiNetwork(int pos);
void clearWifiNetworks();
void insertWifiNetworks();
void addWifiNetwork(NetworkManager::WirelessNetwork::Ptr net);
NetworkManager::ActiveConnection::Ptr findActiveConnection(QString const & path);
template <typename Predicate>
NetworkManager::Device::Ptr findDevice(Predicate const & pred);
NetworkManager::Device::Ptr findDeviceUni(QString const & uni);
NetworkManager::Device::Ptr findDeviceInterface(QString const & interfaceName);
NetworkManager::WirelessNetwork::Ptr findWifiNetwork(QString const & ssid, QString const & devUni);
Q_SIGNALS:
void connectionAdd(NetworkManager::Connection::Ptr conn);
void connectionUpdate(NetworkManager::Connection * conn);
void connectionRemove(NetworkManager::Connection * conn);
void activeConnectionAdd(NetworkManager::ActiveConnection::Ptr conn);
void activeConnectionUpdate(NetworkManager::ActiveConnection * conn);
void activeConnectionRemove(NetworkManager::ActiveConnection * conn);
void activeConnectionsReset();
void deviceAdd(NetworkManager::Device::Ptr dev);
void deviceUpdate(NetworkManager::Device * dev);
void deviceRemove(NetworkManager::Device * dev);
void wifiNetworkAdd(NetworkManager::Device * dev, QString const & ssid);
void wifiNetworkUpdate(NetworkManager::WirelessNetwork * net);
void wifiNetworkRemove(NetworkManager::Device * dev, QString const & ssid);
private Q_SLOT:
//connection
void onConnectionUpdated();
void onConnectionRemoved();
//active connection
void onActiveConnectionUpdated();
//device
void onDeviceUpdated();
void onWifiNetworkAppeared(QString const & ssid);
void onWifiNetworkDisappeared(QString const & ssid);
//wifi network
void onWifiNetworkUpdated();
//notifier
void onDeviceAdded(QString const & uni);
void onDeviceRemoved(QString const & uni);
void onActiveConnectionAdded(QString const & path);
void onActiveConnectionRemoved(QString const & path);
void onActiveConnectionsChanged();
//settings notifier
void onConnectionAdded(QString const & path);
void onConnectionRemoved(QString const & path);
public:
NetworkManager::ActiveConnection::List mActiveConns;
NetworkManager::Connection::List mConnections;
NetworkManager::Device::List mDevices;
NetworkManager::WirelessNetwork::List mWifiNets;
};
enum ItemId
{
ITEM_ROOT = 0x0
, ITEM_ACTIVE = 0x01
, ITEM_ACTIVE_LEAF = 0x11
, ITEM_CONNECTION = 0x2
, ITEM_CONNECTION_LEAF = 0x21
, ITEM_DEVICE = 0x3
, ITEM_DEVICE_LEAF = 0x31
, ITEM_WIFINET = 0x4
, ITEM_WIFINET_LEAF = 0x41
};
#endif //NMMODEL_P_H

@ -0,0 +1,259 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "nmproxy.h"
#include "log.h"
void NmProxy::setSourceModel(QAbstractItemModel * sourceModel)
{
//we operate only on our known model
Q_ASSERT(sourceModel->metaObject() == &NmModel::staticMetaObject);
Q_ASSERT(root.isValid());
beginResetModel();
if (nullptr != this->sourceModel())
{
disconnect(this->sourceModel(), &QAbstractItemModel::dataChanged, this, &NmProxy::onSourceDataChanged);
disconnect(this->sourceModel(), &QAbstractItemModel::headerDataChanged, this, &NmProxy::onSourceHeaderDataChanged);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsAboutToBeInserted, this, &NmProxy::onSourceRowsAboutToBeInserted);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsInserted, this, &NmProxy::onSourceRowsInserted);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsAboutToBeRemoved, this, &NmProxy::onSourceRowsAboutToBeRemoved);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsRemoved, this, &NmProxy::onSourceRowsRemoved);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsAboutToBeInserted, this, &NmProxy::onSourceColumnsAboutToBeInserted);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsInserted, this, &NmProxy::onSourceColumnsInserted);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsAboutToBeRemoved, this, &NmProxy::onSourceColumnsAboutToBeRemoved);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsRemoved, this, &NmProxy::onSourceColumnsRemoved);
disconnect(this->sourceModel(), &QAbstractItemModel::modelAboutToBeReset, this, &NmProxy::onSourceModelAboutToBeReset);
disconnect(this->sourceModel(), &QAbstractItemModel::modelReset, this, &NmProxy::onSourceModelReset);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsAboutToBeMoved, this, &NmProxy::onSourceRowsAboutToBeMoved);
disconnect(this->sourceModel(), &QAbstractItemModel::rowsMoved, this, &NmProxy::onSourceRowsMoved);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsAboutToBeMoved, this, &NmProxy::onSourceColumnsAboutToBeMoved);
disconnect(this->sourceModel(), &QAbstractItemModel::columnsMoved, this, &NmProxy::onSourceColumnsMoved);
}
QAbstractProxyModel::setSourceModel(sourceModel);
connect(sourceModel, &QAbstractItemModel::dataChanged, this, &NmProxy::onSourceDataChanged);
connect(sourceModel, &QAbstractItemModel::headerDataChanged, this, &NmProxy::onSourceHeaderDataChanged);
connect(sourceModel, &QAbstractItemModel::rowsAboutToBeInserted, this, &NmProxy::onSourceRowsAboutToBeInserted);
connect(sourceModel, &QAbstractItemModel::rowsInserted, this, &NmProxy::onSourceRowsInserted);
connect(sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved, this, &NmProxy::onSourceRowsAboutToBeRemoved);
connect(sourceModel, &QAbstractItemModel::rowsRemoved, this, &NmProxy::onSourceRowsRemoved);
connect(sourceModel, &QAbstractItemModel::columnsAboutToBeInserted, this, &NmProxy::onSourceColumnsAboutToBeInserted);
connect(sourceModel, &QAbstractItemModel::columnsInserted, this, &NmProxy::onSourceColumnsInserted);
connect(sourceModel, &QAbstractItemModel::columnsAboutToBeRemoved, this, &NmProxy::onSourceColumnsAboutToBeRemoved);
connect(sourceModel, &QAbstractItemModel::columnsRemoved, this, &NmProxy::onSourceColumnsRemoved);
connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, this, &NmProxy::onSourceModelAboutToBeReset);
connect(sourceModel, &QAbstractItemModel::modelReset, this, &NmProxy::onSourceModelReset);
connect(sourceModel, &QAbstractItemModel::rowsAboutToBeMoved, this, &NmProxy::onSourceRowsAboutToBeMoved);
connect(sourceModel, &QAbstractItemModel::rowsMoved, this, &NmProxy::onSourceRowsMoved);
connect(sourceModel, &QAbstractItemModel::columnsAboutToBeMoved, this, &NmProxy::onSourceColumnsAboutToBeMoved);
connect(sourceModel, &QAbstractItemModel::columnsMoved, this, &NmProxy::onSourceColumnsMoved);
endResetModel();
}
void NmProxy::setNmModel(NmModel * model, NmModel::ItemType shownType)
{
root = model->indexTypeRoot(shownType);
setSourceModel(model);
//qCDebug(NM_TRAY) << __FUNCTION__ << model->indexTypeRoot(shownType) << "->" << root;
}
QModelIndex NmProxy::index(int row, int column, const QModelIndex & proxyParent) const
{
QModelIndex i;
if (hasIndex(row, column, proxyParent))
i = createIndex(row, column);
//qCDebug(NM_TRAY) << __FUNCTION__ << row << column << proxyParent << "->" << i;
return i;
}
QModelIndex NmProxy::parent(const QModelIndex &/*proxyIndex*/) const
{
//showing only one level/list: leaf -> invalid, root -> invalid
QModelIndex i;
//qCDebug(NM_TRAY) << __FUNCTION__ << proxyIndex << "->" << i;
return i;
}
int NmProxy::rowCount(const QModelIndex &proxyParent) const
{
//showing only one level/list: leaf -> source root rowcount, root -> 0
if (proxyParent.isValid())
return 0;
else
return sourceModel()->rowCount(root);
}
int NmProxy::columnCount(const QModelIndex &proxyParent) const
{
return sourceModel()->columnCount(mapToSource(proxyParent));
}
void NmProxy::activateConnection(QModelIndex const & index) const
{
qobject_cast<NmModel *>(sourceModel())->activateConnection(mapToSource(index));
}
void NmProxy::deactivateConnection(QModelIndex const & index) const
{
qobject_cast<NmModel *>(sourceModel())->deactivateConnection(mapToSource(index));
}
QModelIndex NmProxy::mapToSource(const QModelIndex & proxyIndex) const
{
QModelIndex i;
if (proxyIndex.isValid())
i = sourceModel()->index(proxyIndex.row(), proxyIndex.column(), root);
//qCDebug(NM_TRAY) << __FUNCTION__ << proxyIndex << "->" << i;
return i;
}
QModelIndex NmProxy::mapFromSource(const QModelIndex & sourceIndex) const
{
QModelIndex i;
if (sourceIndex.isValid() && root != sourceIndex)
i = createIndex(sourceIndex.row(), sourceIndex.column());
//qCDebug(NM_TRAY) << __FUNCTION__ << sourceIndex << "->" << i;
return i;
}
void NmProxy::onSourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
{
if (root == topLeft.parent())
emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight), roles);
}
void NmProxy::onSourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)
{
emit headerDataChanged(orientation, first, last);
}
void NmProxy::onSourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
{
if (root == parent)
beginInsertRows(mapFromSource(parent), first, last);
}
void NmProxy::onSourceRowsInserted(const QModelIndex &parent, int, int)
{
if (root == parent)
endInsertRows();
}
void NmProxy::onSourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
{
if (root == parent)
beginRemoveRows(mapFromSource(parent), first, last);
}
void NmProxy::onSourceRowsRemoved(const QModelIndex &parent, int, int)
{
if (root == parent)
endRemoveRows();
}
void NmProxy::onSourceColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
{
if (root == parent)
beginInsertColumns(mapFromSource(parent), first, last);
}
void NmProxy::onSourceColumnsInserted(const QModelIndex &parent, int, int)
{
if (root == parent)
endInsertColumns();
}
void NmProxy::onSourceColumnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)
{
if (root == parent)
beginRemoveColumns(mapFromSource(parent), first, last);
}
void NmProxy::onSourceColumnsRemoved(const QModelIndex &parent, int, int)
{
if (root == parent)
endRemoveColumns();
}
void NmProxy::onSourceModelAboutToBeReset()
{
beginResetModel();
}
void NmProxy::onSourceModelReset()
{
endResetModel();
}
void NmProxy::onSourceRowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
{
if (root == sourceParent)
{
if (root == destinationParent)
beginMoveRows(mapFromSource(sourceParent), sourceStart, sourceEnd, destinationParent, destinationRow);
else
beginRemoveRows(mapFromSource(sourceParent), sourceStart, sourceEnd);
} else if (root == destinationParent)
beginInsertRows(mapFromSource(destinationParent), destinationRow, destinationRow + (sourceEnd - sourceStart));
}
void NmProxy::onSourceRowsMoved( const QModelIndex &sourceParent, int, int, const QModelIndex &destinationParent, int)
{
if (root == sourceParent)
{
if (root == destinationParent)
endMoveRows();
else
endRemoveRows();
} else if (root == destinationParent)
endInsertRows();
}
void NmProxy::onSourceColumnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
{
if (root == sourceParent)
{
if (root == destinationParent)
beginMoveColumns(mapFromSource(sourceParent), sourceStart, sourceEnd, destinationParent, destinationColumn);
else
beginRemoveColumns(mapFromSource(sourceParent), sourceStart, sourceEnd);
} else if (root == destinationParent)
beginInsertColumns(mapFromSource(destinationParent), destinationColumn, destinationColumn + (sourceEnd - sourceStart));
}
void NmProxy::onSourceColumnsMoved( const QModelIndex &sourceParent, int, int, const QModelIndex &destinationParent, int)
{
if (root == sourceParent)
{
if (root == destinationParent)
endMoveColumns();
else
endRemoveColumns();
} else if (root == destinationParent)
endInsertColumns();
}

@ -0,0 +1,79 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(NMPROXY_H)
#define NMPROXY_H
#include <QAbstractProxyModel>
#include "nmmodel.h"
class NmProxy : public QAbstractProxyModel
{
Q_OBJECT
public:
using QAbstractProxyModel::QAbstractProxyModel;
virtual void setSourceModel(QAbstractItemModel * sourceModel) override;
void setNmModel(NmModel * model, NmModel::ItemType shownType);
virtual QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const override;
virtual QModelIndex parent(const QModelIndex &index) const override;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
void activateConnection(QModelIndex const & index) const;
void deactivateConnection(QModelIndex const & index) const;
protected:
virtual QModelIndex mapToSource(const QModelIndex & proxyIndex) const override;
virtual QModelIndex mapFromSource(const QModelIndex & sourceIndex) const override;
private Q_SLOTS:
void onSourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
void onSourceHeaderDataChanged(Qt::Orientation orientation, int first, int last);
void onSourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void onSourceRowsInserted(const QModelIndex &parent, int first, int last);
void onSourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
void onSourceRowsRemoved(const QModelIndex &parent, int first, int last);
void onSourceColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void onSourceColumnsInserted(const QModelIndex &parent, int first, int last);
void onSourceColumnsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
void onSourceColumnsRemoved(const QModelIndex &parent, int first, int last);
void onSourceModelAboutToBeReset();
void onSourceModelReset();
void onSourceRowsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
void onSourceRowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
void onSourceColumnsAboutToBeMoved( const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn);
void onSourceColumnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
private:
QModelIndex root;
};
#endif //NMPROXY_H

@ -0,0 +1,49 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include <QCoreApplication>
#include <QLocale>
#include <QTranslator>
#include <QLibraryInfo>
#if !defined(TRANSLATION_DIR)
#define TRANSLATION_DIR "/usr/share/nm-tray"
#endif
void translate()
{
const QString locale = QLocale::system().name();
QTranslator * qt_trans = new QTranslator{qApp};
if (qt_trans->load(QLatin1String("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
qApp->installTranslator(qt_trans);
else
delete qt_trans;
QString trans_dir = qgetenv("NM_TRAY_TRANSLATION_DIR").constData();
QTranslator * my_trans = new QTranslator{qApp};
if (my_trans->load(QLatin1String("nm-tray_") + locale, trans_dir.isEmpty() ? TRANSLATION_DIR : trans_dir))
qApp->installTranslator(my_trans);
else
delete my_trans;
}
Q_COREAPP_STARTUP_FUNCTION(translate)

@ -0,0 +1,397 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "tray.h"
#include <QSystemTrayIcon>
#include <QMenu>
#include <QMessageBox>
#include <QApplication>
#include <QPersistentModelIndex>
#include <NetworkManagerQt/Manager>
#include <NetworkManagerQt/WirelessDevice>
#include "icons.h"
#include "nmmodel.h"
#include "nmproxy.h"
#include "log.h"
#include "dbus/org.freedesktop.Notifications.h"
#include "nmlist.h"
#include "connectioninfo.h"
#include "windowmenu.h"
// config keys
static const QString ENABLE_NOTIFICATIONS = QStringLiteral("enableNotifications");
class TrayPrivate
{
public:
TrayPrivate();
void updateState(QModelIndex const & index, bool removing);
void primaryConnectionUpdate();
void setShown(QPersistentModelIndex const & index);
void updateIcon();
void refreshIcon();
void openCloseDialog(QDialog * dialog);
void notify(QModelIndex const & index, bool removing);
public:
QSystemTrayIcon mTrayIcon;
QMenu mContextMenu;
QTimer mStateTimer;
QAction * mActEnableNetwork;
QAction * mActEnableWifi;
QAction * mActConnInfo;
QAction * mActDebugInfo;
NmModel mNmModel;
NmProxy mActiveConnections;
QPersistentModelIndex mPrimaryConnection;
QPersistentModelIndex mShownConnection;
QList<QPersistentModelIndex> mConnectionsToNotify; //!< just "created" connections to which notification wasn't sent yet
icons::Icon mIconCurrent;
icons::Icon mIcon2Show;
QTimer mIconTimer;
QScopedPointer<QDialog> mConnDialog;
QScopedPointer<QDialog> mInfoDialog;
org::freedesktop::Notifications mNotification;
// configuration
bool mEnableNotifications; //!< should info about connection establishment etc. be send by org.freedesktop.Notifications
};
TrayPrivate::TrayPrivate()
: mNotification{QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"), QDBusConnection::sessionBus()}
{
mActiveConnections.setNmModel(&mNmModel, NmModel::ActiveConnectionType);
}
void TrayPrivate::updateState(QModelIndex const & index, bool removing)
{
notify(index, removing);
const auto state = static_cast<NetworkManager::ActiveConnection::State>(mActiveConnections.data(index, NmModel::ActiveConnectionStateRole).toInt());
const bool is_primary = mPrimaryConnection == index;
//qCDebug(NM_TRAY) << __FUNCTION__ << index << removing << mActiveConnections.data(index, NmModel::NameRole) << mActiveConnections.data(index, NmModel::ConnectionUuidRole).toString() << is_primary << mActiveConnections.data(index, NmModel::ConnectionTypeRole).toInt() << state;
if (removing || NetworkManager::ActiveConnection::Deactivated == state || NetworkManager::ActiveConnection::Deactivating == state)
{
if (is_primary)
{
mPrimaryConnection = QModelIndex{};
setShown(mPrimaryConnection);
} else if (mShownConnection == index)
{
setShown(mPrimaryConnection);
}
} else
{
if (is_primary || NetworkManager::ActiveConnection::Activating == state)
{
setShown(index);
} else if (mShownConnection == index)
{
setShown(mPrimaryConnection);
}
}
//TODO: optimize this text assembly (to not do it every time)?
if (mPrimaryConnection.isValid())
{
mTrayIcon.setToolTip(Tray::tr("<pre>Connection <strong>%1</strong>(%2) active</pre>")
.arg(mPrimaryConnection.data(NmModel::NameRole).toString())
.arg(mPrimaryConnection.data(NmModel::ActiveConnectionTypeStringRole).toString())
);
} else
{
mTrayIcon.setToolTip(Tray::tr("<pre>No active connection</pre>"));
}
}
void TrayPrivate::primaryConnectionUpdate()
{
NetworkManager::ActiveConnection::Ptr prim_conn = NetworkManager::primaryConnection();
if (!prim_conn || !prim_conn->isValid())
{
mPrimaryConnection = QModelIndex{};
setShown(mPrimaryConnection);
return;
}
//qCDebug(NM_TRAY) << __FUNCTION__ << prim_conn->uuid();
QModelIndexList l = mActiveConnections.match(mActiveConnections.index(0, 0, QModelIndex{}), NmModel::ActiveConnectionUuidRole, prim_conn->uuid(), -1, Qt::MatchExactly);
//qCDebug(NM_TRAY) << __FUNCTION__ << l.size();
//nothing to do if the connection not populated in model yet
if (0 >= l.size())
return;
Q_ASSERT(1 == l.size());
mPrimaryConnection = l.first();
updateState(mPrimaryConnection, false);
}
void TrayPrivate::setShown(QPersistentModelIndex const & index)
{
mShownConnection = index;
mIcon2Show = mShownConnection.isValid()
? static_cast<icons::Icon>(mActiveConnections.data(mShownConnection, NmModel::IconTypeRole).toInt()) : icons::NETWORK_OFFLINE;
//postpone setting the icon (for case we change the icon in till our event is finished)
mIconTimer.start();
}
void TrayPrivate::updateIcon()
{
if (mIconCurrent == mIcon2Show)
return;
mIconCurrent = mIcon2Show;
refreshIcon();
}
void TrayPrivate::refreshIcon()
{
//Note: the icons::getIcon chooses the right icon from list of possible candidates
// -> we need to refresh the icon in case of icon theme change
mTrayIcon.setIcon(icons::getIcon(mIconCurrent));
}
void TrayPrivate::openCloseDialog(QDialog * dialog)
{
if (dialog->isHidden() || dialog->isMinimized())
{
dialog->showNormal();
dialog->activateWindow();
dialog->raise();
} else
dialog->close();
}
void TrayPrivate::notify(QModelIndex const & index, bool removing)
{
if (!mEnableNotifications)
{
return;
}
QString summary, body;
if (removing)
{
mConnectionsToNotify.removeOne(index);
summary = Tray::tr("Connection lost");
body = Tray::tr("We have just lost the connection to %1 '%2'.");
} else
{
const int notif_i = mConnectionsToNotify.indexOf(index);
// do nothing if not just added or the connection is not activated yet
if (-1 == notif_i
|| NetworkManager::ActiveConnection::Activated != static_cast<NetworkManager::ActiveConnection::State>(mActiveConnections.data(index, NmModel::ActiveConnectionStateRole).toInt())
)
{
return;
}
mConnectionsToNotify.removeAt(notif_i); // fire the notification only once
summary = Tray::tr("Connection established");
body = Tray::tr("We have just established the connection to %1 '%2'.");
}
// TODO: do somehow check the result?
mNotification.Notify(Tray::tr("NetworkManager(nm-tray)")
, 0
, icons::getIcon(static_cast<icons::Icon>(mActiveConnections.data(index, NmModel::IconTypeRole).toInt())).name()
, summary
, body.arg(mActiveConnections.data(index, NmModel::ConnectionTypeStringRole).toString()).arg(mActiveConnections.data(index, NmModel::NameRole).toString())
, {}
, {}
, -1);
}
Tray::Tray(QObject *parent/* = nullptr*/)
: QObject{parent}
, d{new TrayPrivate}
{
d->mEnableNotifications = QSettings{}.value(ENABLE_NOTIFICATIONS, true).toBool();
connect(&d->mTrayIcon, &QSystemTrayIcon::activated, this, &Tray::onActivated);
//postpone the update in case of signals flood
connect(&d->mStateTimer, &QTimer::timeout, this, &Tray::setActionsStates);
d->mStateTimer.setSingleShot(true);
d->mStateTimer.setInterval(200);
d->mIconCurrent = static_cast<icons::Icon>(-1);
d->setShown(QModelIndex{});
d->refreshIcon(); //force setting the icon instantly
//postpone updating of the icon
connect(&d->mIconTimer, &QTimer::timeout, [this] { d->updateIcon(); });
d->mIconTimer.setSingleShot(true);
d->mIconTimer.setInterval(0);
d->mActEnableNetwork = d->mContextMenu.addAction(Tray::tr("Enable Networking"));
d->mActEnableWifi = d->mContextMenu.addAction(Tray::tr("Enable Wi-fi"));
d->mContextMenu.addSeparator();
QAction * enable_notifications = d->mContextMenu.addAction(Tray::tr("Enable notifications"));
d->mContextMenu.addSeparator();
d->mActConnInfo = d->mContextMenu.addAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Tray::tr("Connection information"));
d->mActDebugInfo = d->mContextMenu.addAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Tray::tr("Debug information"));
connect(d->mContextMenu.addAction(QIcon::fromTheme(QStringLiteral("document-edit")), Tray::tr("Edit connections...")), &QAction::triggered
, this, &Tray::onEditConnectionsTriggered);
d->mContextMenu.addSeparator();
connect(d->mContextMenu.addAction(QIcon::fromTheme(QStringLiteral("help-about")), Tray::tr("About")), &QAction::triggered
, this, &Tray::onAboutTriggered);
connect(d->mContextMenu.addAction(QIcon::fromTheme(QStringLiteral("application-exit")), Tray::tr("Quit")), &QAction::triggered
, this, &Tray::onQuitTriggered);
//for listening on the QEvent::ThemeChange (is delivered only to QWidget objects)
d->mContextMenu.installEventFilter(this);
d->mActEnableNetwork->setCheckable(true);
d->mActEnableWifi->setCheckable(true);
enable_notifications->setCheckable(true);
enable_notifications->setChecked(d->mEnableNotifications);
connect(d->mActEnableNetwork, &QAction::triggered, [this] (bool checked) { NetworkManager::setNetworkingEnabled(checked); });
connect(d->mActEnableWifi, &QAction::triggered, [this] (bool checked) { NetworkManager::setWirelessEnabled(checked); });
connect(enable_notifications, &QAction::triggered, [this] (bool checked) { d->mEnableNotifications = checked; QSettings{}.setValue(ENABLE_NOTIFICATIONS, checked); });
connect(d->mActConnInfo, &QAction::triggered, [this] (bool ) {
if (d->mInfoDialog.isNull())
{
d->mInfoDialog.reset(new ConnectionInfo{&d->mNmModel});
connect(d->mInfoDialog.data(), &QDialog::finished, [this] {
d->mInfoDialog.reset(nullptr);
});
}
d->openCloseDialog(d->mInfoDialog.data());
});
connect(d->mActDebugInfo, &QAction::triggered, [this] (bool ) {
if (d->mConnDialog.isNull())
{
d->mConnDialog.reset(new NmList{Tray::tr("nm-tray info"), &d->mNmModel});
connect(d->mConnDialog.data(), &QDialog::finished, [this] {
d->mConnDialog.reset(nullptr);
});
}
d->openCloseDialog(d->mConnDialog.data());
});
// Note: Force all the updates as the NetworkManager::Notifier signals aren't
// emitted at application startup.
d->primaryConnectionUpdate();
setActionsStates();
connect(NetworkManager::notifier(), &NetworkManager::Notifier::networkingEnabledChanged, &d->mStateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessEnabledChanged, &d->mStateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessHardwareEnabledChanged, &d->mStateTimer, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(NetworkManager::notifier(), &NetworkManager::Notifier::primaryConnectionChanged, this, &Tray::onPrimaryConnectionChanged);
connect(&d->mActiveConnections, &QAbstractItemModel::rowsInserted, [this] (QModelIndex const & parent, int first, int last) {
for (int i = first; i <= last; ++i)
{
const QModelIndex index = d->mActiveConnections.index(i, 0, parent);
//qCDebug(NM_TRAY) << "rowsInserted" << index;
if (d->mEnableNotifications)
{
d->mConnectionsToNotify.append(index);
}
d->updateState(index, false);
}
});
connect(&d->mActiveConnections, &QAbstractItemModel::rowsAboutToBeRemoved, [this] (QModelIndex const & parent, int first, int last) {
//qCDebug(NM_TRAY) << "rowsAboutToBeRemoved";
for (int i = first; i <= last; ++i)
d->updateState(d->mActiveConnections.index(i, 0, parent), true);
});
connect(&d->mActiveConnections, &QAbstractItemModel::dataChanged, [this] (const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & /*roles*/) {
//qCDebug(NM_TRAY) << "dataChanged";
for (auto const & i : QItemSelection{topLeft, bottomRight}.indexes())
d->updateState(i, false);
});
d->mTrayIcon.setContextMenu(&d->mContextMenu);
QTimer::singleShot(0, [this] { d->mTrayIcon.show(); });
}
Tray::~Tray()
{
}
bool Tray::eventFilter(QObject * object, QEvent * event)
{
Q_ASSERT(&d->mContextMenu == object);
if (QEvent::ThemeChange == event->type())
d->refreshIcon();
return false;
}
void Tray::onEditConnectionsTriggered()
{
// Note: let this object dangle, if the process isn't finished until our application is closed
QProcess * editor = new QProcess;
editor->setProcessChannelMode(QProcess::ForwardedChannels);
// TODO: allow the command to be configurable!?
qCInfo(NM_TRAY) << "starting the nm-connection-editor";
editor->start(QStringLiteral("nm-connection-editor"));
editor->closeWriteChannel();
connect(editor, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), [editor] {
qCInfo(NM_TRAY) << "the nm-connection-editor finished";
editor->deleteLater();
});
}
void Tray::onAboutTriggered()
{
QMessageBox::about(nullptr, Tray::tr("%1 about").arg(QStringLiteral("nm-tray"))
, Tray::tr("<strong><a href=\"https://github.com/palinek/nm-tray\">nm-tray</a></strong> is a simple Qt based"
" frontend for <a href=\"https://wiki.gnome.org/Projects/NetworkManager\">NetworkManager</a>.<br/><br/>"
"Version: %1").arg(NM_TRAY_VERSION));
}
void Tray::onQuitTriggered()
{
QApplication::instance()->quit();
}
void Tray::onActivated()
{
QMenu * menu = new WindowMenu(&d->mNmModel);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(QCursor::pos());
}
void Tray::setActionsStates()
{
const bool net_enabled = NetworkManager::isNetworkingEnabled();
d->mActEnableNetwork->setChecked(net_enabled);
d->mActEnableWifi->setChecked(NetworkManager::isWirelessEnabled());
d->mActEnableWifi->setEnabled(NetworkManager::isNetworkingEnabled() && NetworkManager::isWirelessHardwareEnabled());
d->mActConnInfo->setEnabled(net_enabled);
}
void Tray::onPrimaryConnectionChanged(QString const & /*uni*/)
{
d->primaryConnectionUpdate();
}

@ -0,0 +1,58 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2015~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(TRAY_H)
#define TRAY_H
#include <QObject>
#include <QScopedPointer>
class TrayPrivate;
class Tray : public QObject
{
Q_OBJECT
public:
Tray(QObject *parent = nullptr);
~Tray();
protected:
virtual bool eventFilter(QObject * object, QEvent * event) override;
private Q_SLOTS:
//menu
void onEditConnectionsTriggered();
void onAboutTriggered();
void onQuitTriggered();
void onActivated();
//NetworkManager
void setActionsStates();
void onPrimaryConnectionChanged(QString const & uni);
private:
QScopedPointer<TrayPrivate> d;
};
#endif //TRAY_H

@ -0,0 +1,182 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2016~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#include "windowmenu.h"
#include "nmmodel.h"
#include "nmproxy.h"
#include "menuview.h"
#include <QWidgetAction>
#include <functional>
#include <QTimer>
class WindowMenuPrivate
{
public:
NmModel * mNmModel;
QScopedPointer<NmProxy> mWirelessModel;
QWidgetAction * mWirelessAction;
QScopedPointer<NmProxy> mActiveModel;
QWidgetAction * mActiveAction;
QScopedPointer<NmProxy> mConnectionModel;
QWidgetAction * mConnectionAction;
QAction * mMakeDirtyAction;
QTimer mDelaySizeRefreshTimer;
WindowMenuPrivate(WindowMenu * q);
template <typename F>
void onActivated(QModelIndex const & index
, QAbstractItemModel const * topParent
, F const & functor);
void forceSizeRefresh();
void onViewRowChange(QAction * viewAction, QAbstractItemModel const * model);
private:
WindowMenu * q_ptr;
Q_DECLARE_PUBLIC(WindowMenu);
};
WindowMenuPrivate::WindowMenuPrivate(WindowMenu * q)
: q_ptr{q}
{
}
template <typename F>
void WindowMenuPrivate::onActivated(QModelIndex const & index
, QAbstractItemModel const * topParent
, F const & functor)
{
QModelIndex i = index;
for (QAbstractProxyModel const * proxy = qobject_cast<QAbstractProxyModel const *>(index.model())
; nullptr != proxy && topParent != proxy
; proxy = qobject_cast<QAbstractProxyModel const *>(proxy->sourceModel())
)
{
i = proxy->mapToSource(i);
}
functor(i);
}
void WindowMenuPrivate::forceSizeRefresh()
{
Q_Q(WindowMenu);
if (!q->isVisible())
{
return;
}
const QSize old_size = q->size();
//TODO: how to force the menu to recalculate it's size in a more elegant way?
q->addAction(mMakeDirtyAction);
q->removeAction(mMakeDirtyAction);
// ensure to be visible (should the resize make it out of screen)
if (old_size != q->size())
{
q->popup(q->geometry().topLeft());
}
}
void WindowMenuPrivate::onViewRowChange(QAction * viewAction, QAbstractItemModel const * model)
{
viewAction->setVisible(model->rowCount(QModelIndex{}) > 0);
mDelaySizeRefreshTimer.start();
}
WindowMenu::WindowMenu(NmModel * nmModel, QWidget * parent /*= nullptr*/)
: QMenu{parent}
, d_ptr{new WindowMenuPrivate{this}}
{
Q_D(WindowMenu);
d->mNmModel = nmModel;
//active proxy & widgets
d->mActiveModel.reset(new NmProxy);
d->mActiveModel->setNmModel(d->mNmModel, NmModel::ActiveConnectionType);
MenuView * active_view = new MenuView{d->mActiveModel.data()};
connect(active_view, &QAbstractItemView::activated, [this, d] (const QModelIndex & index) {
d->onActivated(index, d->mActiveModel.data(), std::bind(&NmProxy::deactivateConnection, d->mActiveModel.data(), std::placeholders::_1));
close();
});
d->mActiveAction = new QWidgetAction{this};
d->mActiveAction->setDefaultWidget(active_view);
connect(d->mActiveModel.data(), &QAbstractItemModel::modelReset, [d] { d->onViewRowChange(d->mActiveAction, d->mActiveModel.data()); });
connect(d->mActiveModel.data(), &QAbstractItemModel::rowsInserted, [d] { d->onViewRowChange(d->mActiveAction, d->mActiveModel.data()); });
connect(d->mActiveModel.data(), &QAbstractItemModel::rowsRemoved, [d] { d->onViewRowChange(d->mActiveAction, d->mActiveModel.data()); });
//wireless proxy & widgets
d->mWirelessModel.reset(new NmProxy);
d->mWirelessModel->setNmModel(d->mNmModel, NmModel::WifiNetworkType);
MenuView * wifi_view = new MenuView{d->mWirelessModel.data()};
connect(wifi_view, &QAbstractItemView::activated, [this, d] (const QModelIndex & index) {
d->onActivated(index, d->mWirelessModel.data(), std::bind(&NmProxy::activateConnection, d->mWirelessModel.data(), std::placeholders::_1));
close();
});
d->mWirelessAction = new QWidgetAction{this};
d->mWirelessAction->setDefaultWidget(wifi_view);
connect(d->mWirelessModel.data(), &QAbstractItemModel::modelReset, [d] { d->onViewRowChange(d->mWirelessAction, d->mWirelessModel.data()); });
connect(d->mWirelessModel.data(), &QAbstractItemModel::rowsInserted, [d] { d->onViewRowChange(d->mWirelessAction, d->mWirelessModel.data()); });
connect(d->mWirelessModel.data(), &QAbstractItemModel::rowsRemoved, [d] { d->onViewRowChange(d->mWirelessAction, d->mWirelessModel.data()); });
//connection proxy & widgets
d->mConnectionModel.reset(new NmProxy);
d->mConnectionModel->setNmModel(d->mNmModel, NmModel::ConnectionType);
MenuView * connection_view = new MenuView{d->mConnectionModel.data()};
connect(connection_view, &QAbstractItemView::activated, [this, d] (const QModelIndex & index) {
d->onActivated(index, d->mConnectionModel.data(), std::bind(&NmProxy::activateConnection, d->mConnectionModel.data(), std::placeholders::_1));
close();
});
d->mConnectionAction = new QWidgetAction{this};
d->mConnectionAction->setDefaultWidget(connection_view);
connect(d->mConnectionModel.data(), &QAbstractItemModel::modelReset, [d] { d->onViewRowChange(d->mConnectionAction, d->mConnectionModel.data()); });
connect(d->mConnectionModel.data(), &QAbstractItemModel::rowsInserted, [d] { d->onViewRowChange(d->mConnectionAction, d->mConnectionModel.data()); });
connect(d->mConnectionModel.data(), &QAbstractItemModel::rowsRemoved, [d] { d->onViewRowChange(d->mConnectionAction, d->mConnectionModel.data()); });
addAction(tr("Active connection(s)"))->setEnabled(false);
addAction(d->mActiveAction);
addAction(tr("Wi-Fi network(s)"))->setEnabled(false);
addAction(d->mWirelessAction);
addAction(tr("Known connection(s)"))->setEnabled(false);
addAction(d->mConnectionAction);
d->mMakeDirtyAction = new QAction{this};
d->mDelaySizeRefreshTimer.setInterval(200);
d->mDelaySizeRefreshTimer.setSingleShot(true);
connect(&d->mDelaySizeRefreshTimer, &QTimer::timeout, [d] { d->forceSizeRefresh(); });
d->onViewRowChange(d->mActiveAction, d->mActiveModel.data());
d->onViewRowChange(d->mWirelessAction, d->mWirelessModel.data());
d->onViewRowChange(d->mConnectionAction, d->mConnectionModel.data());
}
WindowMenu::~WindowMenu()
{
}

@ -0,0 +1,46 @@
/*COPYRIGHT_HEADER
This file is a part of nm-tray.
Copyright (c)
2016~now Palo Kisa <palo.kisa@gmail.com>
nm-tray is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
COPYRIGHT_HEADER*/
#if !defined(WINDOW_MENU_H)
#define WINDOW_MENU_H
#include <QMenu>
class WindowMenuPrivate;
class NmModel;
class WindowMenu : public QMenu
{
Q_OBJECT
public:
WindowMenu(NmModel * nmModel, QWidget * parent = nullptr);
~WindowMenu();
private:
QScopedPointer<WindowMenuPrivate> d_ptr;
Q_DECLARE_PRIVATE(WindowMenu);
};
#endif //WINDOW_MENU_H

@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>ConnectionInfo</name>
<message>
<location filename="../src/connectioninfo.ui" line="14"/>
<source>Connection information</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NmList</name>
<message>
<location filename="../src/nmlist.ui" line="14"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="20"/>
<source>All information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="30"/>
<source>Active connections</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="40"/>
<source>Available wireless</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NmModel</name>
<message>
<location filename="../src/nmmodel.cpp" line="792"/>
<source>root</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="794"/>
<source>active connection(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="796"/>
<source>connection(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="798"/>
<source>device(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="800"/>
<source>wifi network(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1030"/>
<source>unknown</source>
<comment>hardware address</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="55"/>
<source>nm-tray - wireless password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="56"/>
<source>Password is needed for connection to &apos;%1&apos;:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1133"/>
<source>General</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1134"/>
<source>Interface</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1136"/>
<source>Hardware Address</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1138"/>
<source>Driver</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1140"/>
<source>Speed</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1142"/>
<source> Kb/s</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1144"/>
<source>unknown</source>
<comment>Speed</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1148"/>
<source>Security</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1152"/>
<source>IPv4</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1153"/>
<source>IPv6</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1164"/>
<source>IP Address</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1166"/>
<source>Subnet Mask</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1175"/>
<source>Default route</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1181"/>
<source>DNS(%1)</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Tray</name>
<message>
<location filename="../src/tray.cpp" line="190"/>
<source>Connection lost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="191"/>
<source>We have just lost the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="203"/>
<source>Connection established</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="204"/>
<source>We have just established the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="208"/>
<source>NetworkManager(nm-tray)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="241"/>
<source>Enable Networking</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="242"/>
<source>Enable Wi-fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="244"/>
<source>Enable notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="246"/>
<source>Connection information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="247"/>
<source>Debug information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="249"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="251"/>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="335"/>
<source>%1 about</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="336"/>
<source>&lt;strong&gt;&lt;a href=&quot;https://github.com/palinek/nm-tray&quot;&gt;nm-tray&lt;/a&gt;&lt;/strong&gt; is a simple Qt based frontend for &lt;a href=&quot;https://wiki.gnome.org/Projects/NetworkManager&quot;&gt;NetworkManager&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Version: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="276"/>
<source>nm-tray info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WindowMenu</name>
<message>
<location filename="../src/windowmenu.cpp" line="133"/>
<source>Active connection(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/windowmenu.cpp" line="136"/>
<source>Wi-Fi network(s)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -0,0 +1,260 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
<name>ConnectionInfo</name>
<message>
<location filename="../src/connectioninfo.ui" line="14"/>
<source>Connection information</source>
<translation>Verbindungsinformationen</translation>
</message>
</context>
<context>
<name>NmList</name>
<message>
<location filename="../src/nmlist.ui" line="14"/>
<source>Dialog</source>
<translatorcomment>Did not translate as &quot;Dialog&quot; seems to get replaced with string &quot;nm-tray info&quot; from context &quot;Tray&quot;.</translatorcomment>
<translation>Dialog</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="20"/>
<source>All information</source>
<translation>Verfügbare Informationen</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="30"/>
<source>Active connections</source>
<translation>Aktive Verbindungen</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="40"/>
<source>Available wireless</source>
<translation>Verfügbare drahtlose Verbindungen</translation>
</message>
</context>
<context>
<name>NmModel</name>
<message>
<location filename="../src/nmmodel.cpp" line="792"/>
<source>root</source>
<translatorcomment>Translated as &quot;network&quot; hence not literally at all. Not sure what&apos;s best here but this seems a bit more reasonable to me.</translatorcomment>
<translation>Netzwerk</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="794"/>
<source>active connection(s)</source>
<translation>Aktive Verbindungen</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="796"/>
<source>connection(s)</source>
<translation>Verbindungen</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="798"/>
<source>device(s)</source>
<translation>Geräte</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="800"/>
<source>wifi network(s)</source>
<translation>Drahtlose Netzwerke</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1030"/>
<source>unknown</source>
<comment>hardware address</comment>
<translation>unbekannt</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="55"/>
<source>nm-tray - wireless password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="56"/>
<source>Password is needed for connection to &apos;%1&apos;:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1133"/>
<source>General</source>
<comment>Active connection information</comment>
<translation>Allgemeines</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1134"/>
<source>Interface</source>
<comment>Active connection information</comment>
<translation>Schnittstelle</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1136"/>
<source>Hardware Address</source>
<comment>Active connection information</comment>
<translation>Hardware-Adresse</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1138"/>
<source>Driver</source>
<comment>Active connection information</comment>
<translation>Treiber</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1140"/>
<source>Speed</source>
<comment>Active connection information</comment>
<translation>Übertragungsrate</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1142"/>
<source> Kb/s</source>
<translation> Kb/s</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1144"/>
<source>unknown</source>
<comment>Speed</comment>
<translation>unbekannt</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1148"/>
<source>Security</source>
<comment>Active connection information</comment>
<translation>Sicherheit</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1152"/>
<source>IPv4</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1153"/>
<source>IPv6</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1164"/>
<source>IP Address</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1166"/>
<source>Subnet Mask</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1175"/>
<source>Default route</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1181"/>
<source>DNS(%1)</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Tray</name>
<message>
<location filename="../src/tray.cpp" line="190"/>
<source>Connection lost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="191"/>
<source>We have just lost the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="203"/>
<source>Connection established</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="204"/>
<source>We have just established the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="208"/>
<source>NetworkManager(nm-tray)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="241"/>
<source>Enable Networking</source>
<translation>Netzwerk aktivieren</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="242"/>
<source>Enable Wi-fi</source>
<translation>Drahtlose Verbindungen aktivieren</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="244"/>
<source>Enable notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="246"/>
<source>Connection information</source>
<translation>Verbindungsinformationen</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="247"/>
<source>Debug information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="249"/>
<source>About</source>
<translation>Über</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="251"/>
<source>Quit</source>
<translation>Beenden</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="335"/>
<source>%1 about</source>
<translation>%1 über</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="336"/>
<source>&lt;strong&gt;&lt;a href=&quot;https://github.com/palinek/nm-tray&quot;&gt;nm-tray&lt;/a&gt;&lt;/strong&gt; is a simple Qt based frontend for &lt;a href=&quot;https://wiki.gnome.org/Projects/NetworkManager&quot;&gt;NetworkManager&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Version: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This is the about nm-tray!</source>
<translatorcomment>Pimped this a little bit. Hope that&apos;s okay.</translatorcomment>
<translation type="obsolete">nm-tray ist eine auf Qt basierende Nutzeroberfläche für den NetworkManager zur Ausführung in der Leiste von Desktop-Umgebungen.</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="276"/>
<source>nm-tray info</source>
<translation>nm-tray Informationen</translation>
</message>
</context>
<context>
<name>WindowMenu</name>
<message>
<location filename="../src/windowmenu.cpp" line="133"/>
<source>Active connection(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/windowmenu.cpp" line="136"/>
<source>Wi-Fi network(s)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -0,0 +1,253 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="pl">
<context>
<name>ConnectionInfo</name>
<message>
<location filename="../src/connectioninfo.ui" line="14"/>
<source>Connection information</source>
<translation>Informacje o połączeniu</translation>
</message>
</context>
<context>
<name>NmList</name>
<message>
<location filename="../src/nmlist.ui" line="14"/>
<source>Dialog</source>
<translation>Okno dialogowe</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="20"/>
<source>All information</source>
<translation>Wszystkie informacje</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="30"/>
<source>Active connections</source>
<translation>Aktywne połączenia</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="40"/>
<source>Available wireless</source>
<translation>Dostępne połączenia bezprzewodowe</translation>
</message>
</context>
<context>
<name>NmModel</name>
<message>
<location filename="../src/nmmodel.cpp" line="792"/>
<source>root</source>
<translation>root</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="794"/>
<source>active connection(s)</source>
<translation>aktywne połączenia</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="796"/>
<source>connection(s)</source>
<translation>połączenia</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="798"/>
<source>device(s)</source>
<translation>urządzenia</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="800"/>
<source>wifi network(s)</source>
<translation>sieci bezprzewodowe</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1030"/>
<source>unknown</source>
<comment>hardware address</comment>
<translation>nieznany</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="55"/>
<source>nm-tray - wireless password</source>
<translation>nm-tray - hasło połączenia bezprzewodowego</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="56"/>
<source>Password is needed for connection to &apos;%1&apos;:</source>
<translation>Potrzebne jest hasło, aby połączyć się z &apos;%1&apos;:</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1133"/>
<source>General</source>
<comment>Active connection information</comment>
<translation>Ogólne</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1134"/>
<source>Interface</source>
<comment>Active connection information</comment>
<translation>Interfejs</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1136"/>
<source>Hardware Address</source>
<comment>Active connection information</comment>
<translation>Adres urządzenia</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1138"/>
<source>Driver</source>
<comment>Active connection information</comment>
<translation>Informacje o aktywnym połączeniu</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1140"/>
<source>Speed</source>
<comment>Active connection information</comment>
<translation>Prędkość</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1142"/>
<source> Kb/s</source>
<translation>Kb/s</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1144"/>
<source>unknown</source>
<comment>Speed</comment>
<translation>nieznana</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1148"/>
<source>Security</source>
<comment>Active connection information</comment>
<translation>Bezpieczeństwo</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1152"/>
<source>IPv4</source>
<comment>Active connection information</comment>
<translation>IPv4</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1153"/>
<source>IPv6</source>
<comment>Active connection information</comment>
<translation>IPv6</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1164"/>
<source>IP Address</source>
<comment>Active connection information</comment>
<translation>Adres IP</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1166"/>
<source>Subnet Mask</source>
<comment>Active connection information</comment>
<translation>Maska podsieci</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1175"/>
<source>Default route</source>
<comment>Active connection information</comment>
<translation>Brama domyślna</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1181"/>
<source>DNS(%1)</source>
<comment>Active connection information</comment>
<translation>DNS(%1)</translation>
</message>
</context>
<context>
<name>Tray</name>
<message>
<location filename="../src/tray.cpp" line="190"/>
<source>Connection lost</source>
<translation>Utracono połączenie</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="191"/>
<source>We have just lost the connection to %1 &apos;%2&apos;.</source>
<translation>Utracono połączenie z %1 &apos;%2&apos;.</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="203"/>
<source>Connection established</source>
<translation>Ustanowiono połączenie</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="204"/>
<source>We have just established the connection to %1 &apos;%2&apos;.</source>
<translation>Ustanowiono połączenie z %1 &apos;%2&apos;.</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="208"/>
<source>NetworkManager(nm-tray)</source>
<translation>NetworkManager(nm-tray)</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="241"/>
<source>Enable Networking</source>
<translation>Włącz sieci</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="242"/>
<source>Enable Wi-fi</source>
<translation>Włącz Wi-Fi</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="244"/>
<source>Enable notifications</source>
<translation>Włącz powiadomienia</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="246"/>
<source>Connection information</source>
<translation>Informacje o połączeniu</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="247"/>
<source>Debug information</source>
<translation>Informacje debugowania</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="249"/>
<source>About</source>
<translation>O programie</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="251"/>
<source>Quit</source>
<translation>Zakończ</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="335"/>
<source>%1 about</source>
<translation>o %1</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="336"/>
<source>&lt;strong&gt;&lt;a href=&quot;https://github.com/palinek/nm-tray&quot;&gt;nm-tray&lt;/a&gt;&lt;/strong&gt; is a simple Qt based frontend for &lt;a href=&quot;https://wiki.gnome.org/Projects/NetworkManager&quot;&gt;NetworkManager&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Version: %1</source>
<translation>&lt;strong&gt;&lt;a href=&quot;https://github.com/palinek/nm-tray&quot;&gt;nm-tray&lt;/a&gt;&lt;/strong&gt; jest prostą, napisaną w Qt nakładką dla &lt;a href=&quot;https://wiki.gnome.org/Projects/NetworkManager&quot;&gt;NetworkManagera&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Wersja: %1</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="276"/>
<source>nm-tray info</source>
<translation>Informacje o nm-tray</translation>
</message>
</context>
<context>
<name>WindowMenu</name>
<message>
<location filename="../src/windowmenu.cpp" line="133"/>
<source>Active connection(s)</source>
<translation>Aktywne połączenia</translation>
</message>
<message>
<location filename="../src/windowmenu.cpp" line="136"/>
<source>Wi-Fi network(s)</source>
<translation>Sieci Wi-Fi</translation>
</message>
</context>
</TS>

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="sk">
<context>
<name>ConnectionInfo</name>
<message>
<location filename="../src/connectioninfo.ui" line="14"/>
<source>Connection information</source>
<translation>Informácie o spojení</translation>
</message>
</context>
<context>
<name>NmList</name>
<message>
<location filename="../src/nmlist.ui" line="14"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="20"/>
<source>All information</source>
<translation>Všetky informácie</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="30"/>
<source>Active connections</source>
<translation>Aktívne spojenia</translation>
</message>
<message>
<location filename="../src/nmlist.ui" line="40"/>
<source>Available wireless</source>
<translation>Dostupné bezdôtové</translation>
</message>
</context>
<context>
<name>NmModel</name>
<message>
<location filename="../src/nmmodel.cpp" line="792"/>
<source>root</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="794"/>
<source>active connection(s)</source>
<translation>aktívne spojenie/a</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="796"/>
<source>connection(s)</source>
<translation>spojenie/a</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="798"/>
<source>device(s)</source>
<translation>zariadenie/a</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="800"/>
<source>wifi network(s)</source>
<translation>wifi sieť/siete</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1030"/>
<source>unknown</source>
<comment>hardware address</comment>
<translation>neznáme</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="55"/>
<source>nm-tray - wireless password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="56"/>
<source>Password is needed for connection to &apos;%1&apos;:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1133"/>
<source>General</source>
<comment>Active connection information</comment>
<translation>Základné</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1134"/>
<source>Interface</source>
<comment>Active connection information</comment>
<translation>Rozhranie</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1136"/>
<source>Hardware Address</source>
<comment>Active connection information</comment>
<translation>Hardvérová adresa</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1138"/>
<source>Driver</source>
<comment>Active connection information</comment>
<translation>Ovládač</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1140"/>
<source>Speed</source>
<comment>Active connection information</comment>
<translation>Rýchlosť</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1142"/>
<source> Kb/s</source>
<translation></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1144"/>
<source>unknown</source>
<comment>Speed</comment>
<translation>neznáme</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1148"/>
<source>Security</source>
<comment>Active connection information</comment>
<translation>Bezpečnosť</translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1152"/>
<source>IPv4</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1153"/>
<source>IPv6</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1164"/>
<source>IP Address</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1166"/>
<source>Subnet Mask</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1175"/>
<source>Default route</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/nmmodel.cpp" line="1181"/>
<source>DNS(%1)</source>
<comment>Active connection information</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Tray</name>
<message>
<location filename="../src/tray.cpp" line="190"/>
<source>Connection lost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="191"/>
<source>We have just lost the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="203"/>
<source>Connection established</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="204"/>
<source>We have just established the connection to %1 &apos;%2&apos;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="208"/>
<source>NetworkManager(nm-tray)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="241"/>
<source>Enable Networking</source>
<translatorcomment>don&apos;t know how to correctly translate</translatorcomment>
<translation>Zapnúť sieť</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="242"/>
<source>Enable Wi-fi</source>
<translation>Zapnúť Wi-fi</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="244"/>
<source>Enable notifications</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="246"/>
<source>Connection information</source>
<translation>Informácie o spojení</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="247"/>
<source>Debug information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="249"/>
<source>About</source>
<translation>O ...</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="251"/>
<source>Quit</source>
<translation>Vypnúť</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="335"/>
<source>%1 about</source>
<translation>O %1</translation>
</message>
<message>
<location filename="../src/tray.cpp" line="336"/>
<source>&lt;strong&gt;&lt;a href=&quot;https://github.com/palinek/nm-tray&quot;&gt;nm-tray&lt;/a&gt;&lt;/strong&gt; is a simple Qt based frontend for &lt;a href=&quot;https://wiki.gnome.org/Projects/NetworkManager&quot;&gt;NetworkManager&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Version: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/tray.cpp" line="276"/>
<source>nm-tray info</source>
<translation>nm-tray info</translation>
</message>
</context>
<context>
<name>WindowMenu</name>
<message>
<location filename="../src/windowmenu.cpp" line="133"/>
<source>Active connection(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/windowmenu.cpp" line="136"/>
<source>Wi-Fi network(s)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
Loading…
Cancel
Save