mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
generic: free space notifier rewrite
able to watch any mounted device, not just the home directory. bonus points for configuration interface that does not show up only when the device used to store the home directory is low on space Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8fc853bcb3
commit
3ad56ec0b3
26 changed files with 900 additions and 1241 deletions
|
@ -308,7 +308,6 @@ add_subdirectory(kcontrol)
|
|||
add_subdirectory(klipper)
|
||||
add_subdirectory(kmenuedit)
|
||||
add_subdirectory(krunner)
|
||||
add_subdirectory(freespacenotifier)
|
||||
add_subdirectory(kinfocenter)
|
||||
|
||||
if(Q_WS_X11 AND X11_Xinput_FOUND)
|
||||
|
@ -330,7 +329,7 @@ add_subdirectory(plasma)
|
|||
add_subdirectory(statusnotifierwatcher)
|
||||
add_subdirectory(kstyles)
|
||||
|
||||
# imported from kde-runtime and other sub-projects
|
||||
# Imported from kde-runtime and other sub-projects
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(knotify)
|
||||
add_subdirectory(kuiserver)
|
||||
|
@ -347,7 +346,7 @@ add_subdirectory(kquitapp)
|
|||
if (Q_WS_X11)
|
||||
add_subdirectory(kstart)
|
||||
endif (Q_WS_X11)
|
||||
# imported from kde-baseapps
|
||||
# Imported from kde-baseapps
|
||||
add_subdirectory(dolphin)
|
||||
add_subdirectory(kate)
|
||||
add_subdirectory(kdepasswd)
|
||||
|
@ -355,9 +354,11 @@ add_subdirectory(kdesudo)
|
|||
add_subdirectory(kdialog)
|
||||
add_subdirectory(keditbookmarks)
|
||||
add_subdirectory(kfind)
|
||||
add_subdirectory(konsole)
|
||||
# Goodies
|
||||
add_subdirectory(kmediaplayer)
|
||||
add_subdirectory(kmail)
|
||||
add_subdirectory(konsole)
|
||||
add_subdirectory(kfreespace)
|
||||
# Background processes
|
||||
add_subdirectory(kdontchangethehostname)
|
||||
add_subdirectory(kglobalaccel)
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
project(freespacenotifier)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kded_freespacenotifier_SRCS
|
||||
freespacenotifier.cpp
|
||||
module.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kded_freespacenotifier_SRCS
|
||||
settings.kcfgc
|
||||
)
|
||||
|
||||
kde4_add_plugin(kded_freespacenotifier ${kded_freespacenotifier_SRCS})
|
||||
|
||||
target_link_libraries(kded_freespacenotifier ${KDE4_KIO_LIBS})
|
||||
|
||||
install(
|
||||
TARGETS kded_freespacenotifier
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(
|
||||
FILES freespacenotifier.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded
|
||||
)
|
||||
install(
|
||||
FILES freespacenotifier.notifyrc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/freespacenotifier
|
||||
)
|
||||
install(
|
||||
FILES freespacenotifier.kcfg
|
||||
DESTINATION ${KDE4_KCFG_INSTALL_DIR}
|
||||
)
|
|
@ -1,346 +0,0 @@
|
|||
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
|
||||
the instance of code that it refers to (the kde programs) are copyrighted
|
||||
by the authors who actually wrote it.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
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 Library 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) 19yy <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) 19yy 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 Library General
|
||||
Public License instead of this License.
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC *.ui *.kcfg >> rc.cpp
|
||||
$XGETTEXT *.cpp -o $podir/freespacenotifier.pot
|
|
@ -1,3 +0,0 @@
|
|||
This is a small KDED module that monitors free disk space on the home dir
|
||||
partition and shows a warning dialog when it runs too low,
|
||||
with a configurable limit and the possibility to postpone.
|
|
@ -1,182 +0,0 @@
|
|||
/* This file is part of the KDE Project
|
||||
Copyright (c) 2006 Lukas Tinkl <ltinkl@suse.cz>
|
||||
Copyright (c) 2008 Lubos Lunak <l.lunak@suse.cz>
|
||||
Copyright (c) 2009 Ivo Anjo <knuckles@gmail.com>
|
||||
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "freespacenotifier.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QSpinBox>
|
||||
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include <KDebug>
|
||||
#include <KLocale>
|
||||
#include <KRun>
|
||||
#include <KConfigDialog>
|
||||
#include <KDiskFreeSpaceInfo>
|
||||
|
||||
#include "settings.h"
|
||||
#include "ui_freespacenotifier_prefs_base.h"
|
||||
|
||||
FreeSpaceNotifier::FreeSpaceNotifier( QObject* parent )
|
||||
: QObject( parent )
|
||||
, lastAvailTimer( NULL )
|
||||
, notification( NULL )
|
||||
, lastAvail( -1 )
|
||||
{
|
||||
// If we are running, notifications are enabled
|
||||
FreeSpaceNotifierSettings::setEnableNotification( true );
|
||||
|
||||
connect( &timer, SIGNAL(timeout()), SLOT(checkFreeDiskSpace()) );
|
||||
timer.start( 1000 * 60 /* 1 minute */ );
|
||||
}
|
||||
|
||||
FreeSpaceNotifier::~FreeSpaceNotifier()
|
||||
{
|
||||
// The notification is automatically destroyed when it goes away, so we only need to do this if
|
||||
// it is still being shown
|
||||
if ( notification ) notification->deref();
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::checkFreeDiskSpace()
|
||||
{
|
||||
if ( notification || !FreeSpaceNotifierSettings::enableNotification() )
|
||||
return;
|
||||
KDiskFreeSpaceInfo fsInfo = KDiskFreeSpaceInfo::freeSpaceInfo( QDir::homePath() );
|
||||
if ( fsInfo.isValid() )
|
||||
{
|
||||
int limit = FreeSpaceNotifierSettings::minimumSpace(); // MiB
|
||||
int availpct = int( 100 * fsInfo.available() / fsInfo.size() );
|
||||
qint64 avail = fsInfo.available() / ( 1024 * 1024 ); // to MiB
|
||||
bool warn = false;
|
||||
if( avail < limit ) // avail disk space dropped under a limit
|
||||
{
|
||||
if( lastAvail < 0 ) // always warn the first time
|
||||
{
|
||||
lastAvail = avail;
|
||||
warn = true;
|
||||
}
|
||||
else if( avail > lastAvail ) // the user freed some space
|
||||
lastAvail = avail; // so warn if it goes low again
|
||||
else if( avail < lastAvail / 2 ) // available dropped to a half of previous one, warn again
|
||||
{
|
||||
warn = true;
|
||||
lastAvail = avail;
|
||||
}
|
||||
// do not change lastAvail otherwise, to handle free space slowly going down
|
||||
}
|
||||
if ( warn )
|
||||
{
|
||||
notification = new KNotification( "freespacenotif", 0, KNotification::Persistent );
|
||||
|
||||
notification->setText( i18nc( "Warns the user that the system is running low on space on his home folder, indicating the percentage and absolute MiB size remaining, and asks if the user wants to do something about it", "You are running low on disk space on your home folder (currently %2%, %1 MiB free).\nWould you like to run a file manager to free some disk space?", avail, availpct ) );
|
||||
notification->setActions( QStringList() << i18nc( "Opens a file manager like dolphin", "Open File Manager" ) << i18nc( "Closes the notification", "Do Nothing" ) << i18nc( "Allows the user to configure the warning notification being shown", "Configure Warning" ) );
|
||||
//notification->setPixmap( ... ); // TODO: Maybe add a picture here?
|
||||
|
||||
connect( notification, SIGNAL(action1Activated()), SLOT(openFileManager()) );
|
||||
connect( notification, SIGNAL(action2Activated()), SLOT(cleanupNotification()) );
|
||||
connect( notification, SIGNAL(action3Activated()), SLOT(showConfiguration()) );
|
||||
connect( notification, SIGNAL(closed()), SLOT(cleanupNotification()) );
|
||||
|
||||
notification->setComponentData( KComponentData( "freespacenotifier" ) );
|
||||
notification->sendEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::openFileManager()
|
||||
{
|
||||
cleanupNotification();
|
||||
new KRun( KUrl( QDir::homePath() ), 0 );
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::showConfiguration()
|
||||
{
|
||||
cleanupNotification();
|
||||
|
||||
if ( KConfigDialog::showDialog( "settings" ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog( 0, "settings", FreeSpaceNotifierSettings::self() );
|
||||
QWidget *generalSettingsDlg = new QWidget();
|
||||
|
||||
Ui::freespacenotifier_prefs_base preferences;
|
||||
preferences.setupUi( generalSettingsDlg );
|
||||
|
||||
dialog->addPage( generalSettingsDlg, i18nc( "The settings dialog main page name, as in 'general settings'", "General" ), "system-run" );
|
||||
connect( dialog, SIGNAL(finished()), this, SLOT(configDialogClosed()) );
|
||||
dialog->setAttribute( Qt::WA_DeleteOnClose );
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::cleanupNotification()
|
||||
{
|
||||
notification = NULL;
|
||||
|
||||
// warn again if constantly below limit for too long
|
||||
if( lastAvailTimer == NULL )
|
||||
{
|
||||
lastAvailTimer = new QTimer( this );
|
||||
connect( lastAvailTimer, SIGNAL(timeout()), SLOT(resetLastAvailable()) );
|
||||
}
|
||||
lastAvailTimer->start( 1000 * 60 * 60 /* 1 hour*/ );
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::resetLastAvailable()
|
||||
{
|
||||
lastAvail = -1;
|
||||
lastAvailTimer->deleteLater();
|
||||
lastAvailTimer = NULL;
|
||||
}
|
||||
|
||||
void FreeSpaceNotifier::configDialogClosed()
|
||||
{
|
||||
if ( !FreeSpaceNotifierSettings::enableNotification() )
|
||||
disableFSNotifier();
|
||||
}
|
||||
|
||||
/* The idea here is to disable ourselves by telling kded to stop autostarting us, and
|
||||
* to kill the current running instance.
|
||||
*/
|
||||
void FreeSpaceNotifier::disableFSNotifier()
|
||||
{
|
||||
QDBusInterface iface( "org.kde.kded", "/kded", "org.kde.kded" );
|
||||
if ( dbusError( iface ) ) return;
|
||||
|
||||
// Disable current module autoload
|
||||
iface.call( "setModuleAutoloading", "freespacenotifier", false );
|
||||
if ( dbusError( iface ) ) return;
|
||||
|
||||
// Unload current module
|
||||
iface.call( "unloadModule", "freespacenotifier" );
|
||||
if ( dbusError( iface ) ) return;
|
||||
}
|
||||
|
||||
bool FreeSpaceNotifier::dbusError( QDBusInterface &iface )
|
||||
{
|
||||
QDBusError err = iface.lastError();
|
||||
if ( err.isValid() )
|
||||
{
|
||||
kError() << "Failed to perform operation on kded [" << err.name() << "]:" << err.message();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* This file is part of the KDE Project
|
||||
Copyright (c) 2006 Lukas Tinkl <ltinkl@suse.cz>
|
||||
Copyright (c) 2008 Lubos Lunak <l.lunak@suse.cz>
|
||||
Copyright (c) 2009 Ivo Anjo <knuckles@gmail.com>
|
||||
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FREESPACENOTIFIER_H_
|
||||
#define _FREESPACENOTIFIER_H_
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtDBus/QDBusInterface>
|
||||
|
||||
#include <KNotification>
|
||||
|
||||
class FreeSpaceNotifier
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FreeSpaceNotifier( QObject* parent = NULL );
|
||||
virtual ~FreeSpaceNotifier();
|
||||
private slots:
|
||||
void checkFreeDiskSpace();
|
||||
void resetLastAvailable();
|
||||
void openFileManager();
|
||||
void showConfiguration();
|
||||
void cleanupNotification();
|
||||
void configDialogClosed();
|
||||
private:
|
||||
QTimer timer;
|
||||
QTimer* lastAvailTimer;
|
||||
KNotification *notification;
|
||||
qint64 lastAvail; // used to suppress repeated warnings when available space hasn't changed
|
||||
|
||||
void disableFSNotifier();
|
||||
bool dbusError( QDBusInterface &iface );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name="freespacenotifierrc"/>
|
||||
<group name="General">
|
||||
<entry name="minimumSpace" type="Int">
|
||||
<label>Minimum free space before user starts being notified.</label>
|
||||
<default>200</default>
|
||||
<min>1</min>
|
||||
<max>100000</max>
|
||||
</entry>
|
||||
<entry name="enableNotification" type="Bool">
|
||||
<label>Is the free space notification enabled.</label>
|
||||
<default>1</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -1,423 +0,0 @@
|
|||
[Global]
|
||||
IconName=drive-harddisk
|
||||
Comment=KDE Free Space Notifier Daemon
|
||||
Comment[ar]=مراقب كدي لمنبه المساحة الحرّة
|
||||
Comment[ast]=Degorriu de notificaciones d'espaciu llibre de KDE
|
||||
Comment[bg]=Демон на KDE за свободно пространство
|
||||
Comment[bn]=কে.ডি.ই. ফ্রী স্পেস বিজ্ঞপ্তি ডিমন
|
||||
Comment[bs]=KDE‑ov demon izveštavača o slobodnom prostoru
|
||||
Comment[ca]=Dimoni de notificacions d'espai lliure del KDE
|
||||
Comment[ca@valencia]=Dimoni de notificacions d'espai lliure del KDE
|
||||
Comment[cs]=Upozorňovací démon volného místa KDE
|
||||
Comment[da]=KDE dæmon til bekendtgørelse om ledig plads
|
||||
Comment[de]=KDE-Dienst für Speicherplatzbenachrichtigung
|
||||
Comment[el]=Δαίμονας ειδοποιήσεων ελευθέρου χώρου του KDE
|
||||
Comment[en_GB]=KDE Free Space Notifier Dæmon
|
||||
Comment[es]=Demonio de notificaciones de espacio libre de KDE
|
||||
Comment[et]=KDE vaba ruumi teavitamise deemon
|
||||
Comment[eu]=KDEren leku askea jakinarazteko daimona
|
||||
Comment[fi]=KDE:n vapaan tilan ilmoitustaustaprosessi
|
||||
Comment[fr]=Démon de notification d'espace libre de KDE
|
||||
Comment[ga]=Fógróir Spáis Shaoir KDE
|
||||
Comment[gl]=Daemon notificador do espazo libre de KDE
|
||||
Comment[he]=KDE Free Space Notifier Daemon
|
||||
Comment[hi]=केडीई खाली स्थान सूचना डेमन
|
||||
Comment[hr]=KDE-ov servis za obavještavanje o slobodnom prostoru
|
||||
Comment[hu]=KDE szabad hely értesítő szolgáltatás
|
||||
Comment[ia]=Demone de notification de spatio libere de KDE
|
||||
Comment[id]=Jurik Notifikasi RUang Kosong KDE
|
||||
Comment[is]=KDE tilkynningaþjónn fyrir laust pláss
|
||||
Comment[it]=Demone di notifica dello spazio libero di KDE
|
||||
Comment[ja]=KDE 空き領域デーモン
|
||||
Comment[kk]=KDE-нің бос орын туралы құлақтандыру қызметі
|
||||
Comment[km]=ដេមិនជូនដំណឹងទំហំទំនេររបស់ KDE
|
||||
Comment[kn]=ಕೆಡಿಇ ಖಾಲಿ ಜಾಗ ಸೂಚನಾ ನೇಪಥಿಕ (ಡೀಮನ್)
|
||||
Comment[ko]=KDE 남은 공간 알림 데몬
|
||||
Comment[lt]=KDE laisvos vietos pranešimų tarnyba
|
||||
Comment[lv]=KDE brīvās vietas paziņošanas dēmons
|
||||
Comment[ml]=കെഡിഇയിലെ ലഭ്യമായ സ്ഥലം അറിയിയ്ക്കുന്നതിനുള്ള നിരന്തര പ്രവൃത്തി
|
||||
Comment[mr]=केडीई मोकळी जागा निदर्शक डीमन
|
||||
Comment[nb]=KDEs varslingsdaemon for ledig plass
|
||||
Comment[nds]=KDE-Dämoon för Freeruumbescheden
|
||||
Comment[nl]=KDE-daemon voor het melden van vrije ruimte
|
||||
Comment[nn]=KDE-varsel om lite plass
|
||||
Comment[pa]=KDE ਖਾਲੀ ਥਾਂ ਨੋਟੀਫਿਕੇਸ਼ਨ ਡੈਮਨ
|
||||
Comment[pl]=Demon powiadomień o wolnym miejscu KDE
|
||||
Comment[pt]=Servidor de Notificação de Espaço Livre do KDE
|
||||
Comment[pt_BR]=Serviço de notificação de espaço livre do KDE
|
||||
Comment[ro]=Demon de notificare KDE a spațiului liber
|
||||
Comment[ru]=Служба уведомлений о свободном месте на диске
|
||||
Comment[si]=KDE හිස් ඉඩ දැනුම්දීමේ ඩීමනය
|
||||
Comment[sk]=Monitor voľného miesta KDE
|
||||
Comment[sl]=KDE-jev obvestilnik o neporabljenem prostoru
|
||||
Comment[sr]=КДЕ‑ов демон извештавача о слободном простору
|
||||
Comment[sr@ijekavian]=КДЕ‑ов демон извјештавача о слободном простору
|
||||
Comment[sr@ijekavianlatin]=KDE‑ov demon izvještavača o slobodnom prostoru
|
||||
Comment[sr@latin]=KDE‑ov demon izveštavača o slobodnom prostoru
|
||||
Comment[sv]=KDE:s demon för information om ledigt utrymme
|
||||
Comment[th]=ดีมอนการแจ้งพื้นที่ว่างของ KDE
|
||||
Comment[tr]=KDE Boş Alan Bildirme Servisi
|
||||
Comment[ug]=KDE بىكار بوشلۇق خەۋەرچى نازارەتچىسى
|
||||
Comment[uk]=Фонова служба сповіщення про переповнення диска KDE
|
||||
Comment[vi]=Trình nền thông báo không gian trống KDE
|
||||
Comment[wa]=Démon KDE notifieu del plaece di libe
|
||||
Comment[x-test]=xxKDE Free Space Notifier Daemonxx
|
||||
Comment[zh_CN]=KDE 空闲空间通知守护程序
|
||||
Comment[zh_TW]=KDE 剩餘空間通知伺服程式
|
||||
Name=Low Disk Space
|
||||
Name[ar]=مساحة القرص منخفضة
|
||||
Name[ast]=Pocu espaciu en discu
|
||||
Name[bg]=Дисковото пространство е твърде малко
|
||||
Name[bn]=ডিস্ক-এ জায়গা কম
|
||||
Name[bs]=Malo prostora na disku
|
||||
Name[ca]=Espai escàs al disc
|
||||
Name[ca@valencia]=Espai escàs al disc
|
||||
Name[cs]=Málo místa na disku
|
||||
Name[da]=Lav diskplads
|
||||
Name[de]=Wenig Speicherplatz
|
||||
Name[el]=Χαμηλή χωρητικότητα δίσκου
|
||||
Name[en_GB]=Low Disk Space
|
||||
Name[es]=Poco espacio en disco
|
||||
Name[et]=Kettaruumi napib
|
||||
Name[eu]=Leku gutxi diskoan
|
||||
Name[fi]=Vähäinen levytila
|
||||
Name[fr]=Espace disque faible
|
||||
Name[ga]=Easpa Spáis ar an Diosca
|
||||
Name[gl]=Pouco espazo no disco
|
||||
Name[he]=שטח מועט פנוי בדיסק
|
||||
Name[hi]=डिस्क जगह कम
|
||||
Name[hr]=Malo prostora na disku
|
||||
Name[hu]=Kevés a lemezterület
|
||||
Name[ia]=Spatio de disco basse
|
||||
Name[id]=Ruang Kosong Tinggal Sedikit
|
||||
Name[is]=Lítið diskpláss
|
||||
Name[it]=Poco spazio su disco
|
||||
Name[ja]=ディスクの空き領域が少ないです
|
||||
Name[kk]=Дискіде орын тапшылығы
|
||||
Name[km]=ទំហំថាសទាប
|
||||
Name[kn]=ಕಡಿಮೆ ಡಿಸ್ಕ್ ಜಾಗ
|
||||
Name[ko]=디스크 공간 부족
|
||||
Name[lt]=Mažai vietos diske
|
||||
Name[lv]=Maz diska vietas
|
||||
Name[mai]=कम डिस्क स्थान
|
||||
Name[ml]=ഡിസ്കില് സഥലം കുറവാണു്
|
||||
Name[mr]=डिस्कवर कमी जागा शिल्लक आहे
|
||||
Name[nb]=Lite diskplass
|
||||
Name[nds]=To minn free Ruum op de Fastplaat
|
||||
Name[nl]=Schijf bijna vol
|
||||
Name[nn]=Lite diskplass
|
||||
Name[pa]=ਘੱਟ ਡਿਸਕ ਥਾਂ
|
||||
Name[pl]=Mało miejsca na dysku
|
||||
Name[pt]=Pouco Espaço em Disco
|
||||
Name[pt_BR]=Pouco espaço em disco
|
||||
Name[ro]=Spațiu pe disc scăzut
|
||||
Name[ru]=Недостаточно места на диске
|
||||
Name[si]=පහත් තැටි ඉඩ
|
||||
Name[sk]=Nedostatok miesta na disku
|
||||
Name[sl]=Prostora na disku je malo
|
||||
Name[sr]=Мало простора на диску
|
||||
Name[sr@ijekavian]=Мало простора на диску
|
||||
Name[sr@ijekavianlatin]=Malo prostora na disku
|
||||
Name[sr@latin]=Malo prostora na disku
|
||||
Name[sv]=Ont om diskutrymme
|
||||
Name[th]=พื้นที่ดิสก์เหลือน้อย
|
||||
Name[tr]=Düşük Disk Alanı
|
||||
Name[ug]=دىسكىدىكى بوشلۇق ئاز
|
||||
Name[uk]=Замало місця на диску
|
||||
Name[vi]=Dung lượng đĩa trống thấp
|
||||
Name[wa]=Pus bråmint d' plaece sol plake
|
||||
Name[x-test]=xxLow Disk Spacexx
|
||||
Name[zh_CN]=低磁盘空间
|
||||
Name[zh_TW]=磁碟空間過低
|
||||
|
||||
[Context/warningnot]
|
||||
Name=Warning
|
||||
Name[af]=Waarskuwing
|
||||
Name[ar]=إنذار
|
||||
Name[as]=সতৰ্কবাণী
|
||||
Name[ast]=Avisu
|
||||
Name[be]=Папярэджанне
|
||||
Name[be@latin]=Uvaha
|
||||
Name[bg]=Предупреждение
|
||||
Name[bn]=সতর্কবার্তা
|
||||
Name[bn_IN]=সতর্কবার্তা
|
||||
Name[bs]=Upozorenje
|
||||
Name[ca]=Avís
|
||||
Name[ca@valencia]=Avís
|
||||
Name[cs]=Varování
|
||||
Name[csb]=Bôczënk
|
||||
Name[da]=Advarsel
|
||||
Name[de]=Warnung
|
||||
Name[el]=Προειδοποίηση
|
||||
Name[en_GB]=Warning
|
||||
Name[eo]=Averto
|
||||
Name[es]=Aviso
|
||||
Name[et]=Hoiatus
|
||||
Name[eu]=Abisua
|
||||
Name[fi]=Varoitus
|
||||
Name[fr]=Avertissement
|
||||
Name[fy]=Warskôging
|
||||
Name[ga]=Rabhadh
|
||||
Name[gl]=Aviso
|
||||
Name[gu]=ચેતવણી
|
||||
Name[he]=אזהרה
|
||||
Name[hi]=चेतावनी
|
||||
Name[hne]=चेतावनी
|
||||
Name[hr]=Upozorenje
|
||||
Name[hsb]=Kedźbu
|
||||
Name[hu]=Figyelmeztetés
|
||||
Name[ia]=Aviso
|
||||
Name[id]=Peringatan
|
||||
Name[is]=Aðvörun
|
||||
Name[it]=Avviso
|
||||
Name[ja]=警告
|
||||
Name[kk]=Ескерту
|
||||
Name[km]=ការព្រមាន
|
||||
Name[kn]=ಎಚ್ಚರಿಕೆ
|
||||
Name[ko]=경고
|
||||
Name[ku]=Hişyarî
|
||||
Name[lt]=Dėmesio
|
||||
Name[lv]=Brīdinājums
|
||||
Name[mai]=चेतावनी
|
||||
Name[mk]=Предупредување
|
||||
Name[ml]=മുന്നറിയിപ്പു്
|
||||
Name[mr]=इशारा
|
||||
Name[nb]=Advarsel
|
||||
Name[nds]=Wohrschoen
|
||||
Name[ne]=चेतावनी
|
||||
Name[nl]=Waarschuwing
|
||||
Name[nn]=Åtvaring
|
||||
Name[oc]=Alèrta
|
||||
Name[or]=ଚେତାବନୀ
|
||||
Name[pa]=ਚੇਤਾਵਨੀ
|
||||
Name[pl]=Ostrzeżenie
|
||||
Name[pt]=Aviso
|
||||
Name[pt_BR]=Aviso
|
||||
Name[ro]=Atenționare
|
||||
Name[ru]=Предупреждение
|
||||
Name[se]=Várrehus
|
||||
Name[si]=අවවාදය
|
||||
Name[sk]=Varovanie
|
||||
Name[sl]=Opozorilo
|
||||
Name[sr]=Упозорење
|
||||
Name[sr@ijekavian]=Упозорење
|
||||
Name[sr@ijekavianlatin]=Upozorenje
|
||||
Name[sr@latin]=Upozorenje
|
||||
Name[sv]=Varning
|
||||
Name[ta]=எச்சரிக்கை
|
||||
Name[te]=హెచ్చరిక
|
||||
Name[tg]=Огоҳинома
|
||||
Name[th]=คำเตือน
|
||||
Name[tr]=Uyarı
|
||||
Name[ug]=ئاگاھلاندۇرۇش
|
||||
Name[uk]=Попередження
|
||||
Name[uz]=Ogohnoma
|
||||
Name[uz@cyrillic]=Огоҳнома
|
||||
Name[vi]=Cảnh báo
|
||||
Name[wa]=Adviertixhmint
|
||||
Name[x-test]=xxWarningxx
|
||||
Name[zh_CN]=警告
|
||||
Name[zh_TW]=警告
|
||||
Comment=Used for warning notifications
|
||||
Comment[ar]=يُستخدم للتنبيهات التحذيرية
|
||||
Comment[ast]=Usáu pa notificaciones d'avisu
|
||||
Comment[be@latin]=Dla aścierahalnych paviedamleńniaŭ
|
||||
Comment[bg]=Използва се за предупреждения
|
||||
Comment[bn]=সতর্কীকরণ বিজ্ঞপ্তির জন্য ব্যবহৃত হয়
|
||||
Comment[bs]=Koristi se za obavještenja o upozorenjima
|
||||
Comment[ca]=S'usa per a les notificacions d'avís
|
||||
Comment[ca@valencia]=S'usa per a les notificacions d'avís
|
||||
Comment[cs]=Použito pro varování a upozornění
|
||||
Comment[da]=Bruges til advarselsbekendtgørelser
|
||||
Comment[de]=Verwendet für Warnmeldungen
|
||||
Comment[el]=Χρησιμοποιείται για τις προειδοποιήσεις
|
||||
Comment[en_GB]=Used for warning notifications
|
||||
Comment[eo]=Uzita por avertmesaĝoj
|
||||
Comment[es]=Usado para notificaciones de advertencia
|
||||
Comment[et]=Hoiatuste jaoks
|
||||
Comment[eu]=Abisu-jakinarazpenetarako erabiltzen da
|
||||
Comment[fi]=Käytetään varoitusilmoituksiin
|
||||
Comment[fr]=Utilisé pour les notifications d'avertissements
|
||||
Comment[fy]=Brûkt faor warskôging notifikaasjes
|
||||
Comment[ga]=Úsáidte do rabhaidh
|
||||
Comment[gl]=Emprégase para as notificacións de aviso
|
||||
Comment[gu]=ચેતવણી નોંધણીઓ આપવા માટે વપરાય છે
|
||||
Comment[he]=משמש להתרעות אזהרה
|
||||
Comment[hi]=चेतावनियाँ देने के लिए उपयोग में लिया जाता है
|
||||
Comment[hne]=चेतावनी सूचना बर उपयोग होथे
|
||||
Comment[hr]=Korišten za upozoravajuće obavijesti
|
||||
Comment[hu]=Kezelőprogram figyelmeztető üzenetekhez
|
||||
Comment[ia]=Usate pro notificationes de avisos
|
||||
Comment[id]=Digunakan untuk notifikasi peringatan
|
||||
Comment[is]=Notað fyrir aðvaranir
|
||||
Comment[it]=Usato per notifiche di avviso
|
||||
Comment[ja]=警告の通知に使用
|
||||
Comment[kk]=Ескерту хабарларға қолданылады
|
||||
Comment[km]=បានប្រើសម្រាប់ការជូនព្រមាន
|
||||
Comment[kn]=ಎಚ್ಚರಿಕೆ ಸೂಚನೆಗಳಿಗೆ ಬಳಸಲಾಗುತ್ತದೆ
|
||||
Comment[ko]=경고 알림에 사용됨
|
||||
Comment[lt]=Naudojama perspėjimams
|
||||
Comment[lv]=Izmanto brīdinājumu paziņojumiem
|
||||
Comment[ml]=താക്കീത് അറിയിപ്പുകള്ക്കായി ഉപയോഗിക്കുന്നു
|
||||
Comment[mr]=इशारा सूचना करिता वापरले जाते
|
||||
Comment[nb]=Brukt til varselsmeldinger
|
||||
Comment[nds]=Bi Wohrschoen bruukt
|
||||
Comment[nl]=Wordt gebruikt voor waarschuwingsmeldingen
|
||||
Comment[nn]=Er brukt til åtvaringsvarsel
|
||||
Comment[or]=ଚେତାବନୀ ବିଜ୍ଞପ୍ତିଗୁଡ଼ିକ ପାଇଁ ବ୍ୟବହୃତ ହୋଇଥାଏ
|
||||
Comment[pa]=ਚੇਤਾਵਨੀ ਨੋਟੀਫਿਕੇਸ਼ਨ ਲਈ ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ
|
||||
Comment[pl]=Używane do ostrzeżeń
|
||||
Comment[pt]=Usado para as notificações de aviso
|
||||
Comment[pt_BR]=Usado para as notificações de aviso
|
||||
Comment[ro]=Utilizat pentru notificări de avertizare
|
||||
Comment[ru]=Используется для системных уведомлений
|
||||
Comment[si]=අවවාද පණිවුඩ සඳහා යොදාගනී
|
||||
Comment[sk]=Používa sa pre varovné upozornenia
|
||||
Comment[sl]=Uporabljeno za obvestila z opozorili
|
||||
Comment[sr]=Користи се за позорна обавештења
|
||||
Comment[sr@ijekavian]=Користи се за позорна обавјештења
|
||||
Comment[sr@ijekavianlatin]=Koristi se za pozorna obavještenja
|
||||
Comment[sr@latin]=Koristi se za pozorna obaveštenja
|
||||
Comment[sv]=Används för varningsmeddelanden
|
||||
Comment[ta]=Used for warning notifications
|
||||
Comment[te]=హెచ్చరిక నోటీసుల కొరకు వుపయోగించబడింది
|
||||
Comment[tg]=Используется для надписей под значками на рабочем столе.
|
||||
Comment[th]=ใช้สำหรับการแจ้งเตือนให้ทราบ
|
||||
Comment[tr]=Uyarı bildirimleri için kullanılır
|
||||
Comment[ug]=ئاگاھلاندۇرۇش ئۇقتۇرۇشلىرى ئۈچۈن ئىشلىتىلىدۇ.
|
||||
Comment[uk]=Використовується для попереджень
|
||||
Comment[vi]=Sử dụng cho thông tin cảnh báo
|
||||
Comment[wa]=Eployî po des notifiaedjes d' adviertixhmint
|
||||
Comment[x-test]=xxUsed for warning notificationsxx
|
||||
Comment[zh_CN]=用于发出警告通知
|
||||
Comment[zh_TW]=用於警告通知
|
||||
|
||||
[Event/freespacenotif]
|
||||
Name=Running low on disk space
|
||||
Name[ar]=قارب القرص على الامتلاء
|
||||
Name[ast]=Queda poco espaciu en discu
|
||||
Name[bg]=Дисковото пространство е твърде малко
|
||||
Name[bn]=ডিস্ক-এ বেশী জায়গা বাকি নেই
|
||||
Name[bs]=Ponestaje prostora na disku
|
||||
Name[ca]=S'està exhaurint l'espai del disc
|
||||
Name[ca@valencia]=S'està exhaurint l'espai del disc
|
||||
Name[cs]=Dochází místo na disku
|
||||
Name[da]=Ved at løbe tør for diskplads
|
||||
Name[de]=Speicherplatz wird knapp
|
||||
Name[el]=Τρέχον χωρητικότητα δίσκου χαμηλή
|
||||
Name[en_GB]=Running low on disk space
|
||||
Name[es]=Queda poco espacio en disco
|
||||
Name[et]=Kettaruumi napib
|
||||
Name[eu]=Leku gutxi gelditzen da diskoan
|
||||
Name[fi]=Levytila alkaa olla lopussa
|
||||
Name[fr]=L'espace disque commence à manquer
|
||||
Name[ga]=Tá an diosca ag éirí lán
|
||||
Name[gl]=Esgotando o espazo no disco
|
||||
Name[he]=השטח הפנוי בדיסק מועט
|
||||
Name[hi]=डिस्क में जगह कम हो गया है
|
||||
Name[hr]=Ponestajanje diskovnog prostora
|
||||
Name[hu]=Kezd fogyni a lemezterület
|
||||
Name[ia]=Exhauriente le spatio de disco
|
||||
Name[id]=Berjalan pada ruang kosong yang tinggal sedikit
|
||||
Name[is]=Lítið pláss eftir á diski
|
||||
Name[it]=Lo spazio su disco si sta esaurendo
|
||||
Name[ja]=ディスクの空き領域が少ないです
|
||||
Name[kk]=Диск орын тапшылығы
|
||||
Name[km]=ដំណើរការទាបលើទំហំថាស
|
||||
Name[kn]=ಮುದ್ರಿಕೆಯಲ್ಲಿ (ಡಿಸ್ಕ್) ಜಾಗ ಕಮ್ಮಿಯಾಗುತ್ತಿದೆ.
|
||||
Name[ko]=디스크 공간 거의 없음
|
||||
Name[lt]=Diske liko mažai vietos
|
||||
Name[lv]=Ir palicis maz brīvas vietas
|
||||
Name[mr]=डिस्कवर कमी जागा शिल्लक आहे
|
||||
Name[nb]=Det er nå lite diskplass
|
||||
Name[nds]=De free Ruum op de Fastplaat geiht op de Neeg.
|
||||
Name[nl]=Bijna geen vrije schijfruimte meer
|
||||
Name[nn]=Det er lite diskplass att
|
||||
Name[pa]=ਡਿਸਕ ਥਾਂ ਖਤਮ ਹੋ ਰਹੀ ਹੈ
|
||||
Name[pl]=Zaczyna brakować miejsca na dysku
|
||||
Name[pt]=Pouco espaço livre em disco
|
||||
Name[pt_BR]=Pouco espaço livre em disco
|
||||
Name[ro]=Spațiu pe disc este scăzut
|
||||
Name[ru]=Недостаточно места на диске
|
||||
Name[si]=පහත් තැටි ඉඩෙන් ධාවනය කරමි
|
||||
Name[sk]=Dochádza voľné miesto na disku
|
||||
Name[sl]=Razpoložljivega prostora na disku je malo
|
||||
Name[sr]=Понестаје простора на диску
|
||||
Name[sr@ijekavian]=Понестаје простора на диску
|
||||
Name[sr@ijekavianlatin]=Ponestaje prostora na disku
|
||||
Name[sr@latin]=Ponestaje prostora na disku
|
||||
Name[sv]=Diskutrymmet håller på att ta slut
|
||||
Name[th]=พื้นที่ดิสก์กำลังเหลือน้อย
|
||||
Name[tr]=Düşük disk alanı üzerinde çalışıyor
|
||||
Name[ug]=دىسكىدىكى بوشلۇق ئاز ھالەتتە ئىجرا قىلىۋاتىدۇ
|
||||
Name[uk]=Замало місця на диску
|
||||
Name[vi]=Không gian đĩa trống sắp hết
|
||||
Name[wa]=Gn a pus bråmint d' plaece sol plake
|
||||
Name[x-test]=xxRunning low on disk spacexx
|
||||
Name[zh_CN]=磁盘空间过低
|
||||
Name[zh_TW]=磁碟空間快用完了
|
||||
Comment=You are running low on disk space
|
||||
Comment[ar]=إن مساحة التخزين المتوفرة على القرص توشك على النفاذ
|
||||
Comment[ast]=Tas quedando ensin espaciu en discu
|
||||
Comment[bg]=Дисковото Ви пространство е твърде малко
|
||||
Comment[bn]=আপনার ডিস্ক-এ বেশী জায়গা বাকি নেই
|
||||
Comment[bs]=Ponestaje vam prostora na disku
|
||||
Comment[ca]=L'espai del disc s'està exhaurint
|
||||
Comment[ca@valencia]=L'espai del disc s'està exhaurint
|
||||
Comment[cs]=Dochází vám místo na disku
|
||||
Comment[da]=Du er ved at løbe tør for diskplads
|
||||
Comment[de]=Ihr freier Speicherplatz wird knapp
|
||||
Comment[el]=Η τρέχουσα χωρητικότητα του δίσκου σας είναι χαμηλή
|
||||
Comment[en_GB]=You are running low on disk space
|
||||
Comment[es]=Se está quedando sin espacio en disco
|
||||
Comment[et]=Kettaruumi on vähe järele jäänud
|
||||
Comment[eu]=Diskoan lekurik gabe gelditzen ari zara
|
||||
Comment[fi]=Levytilasi alkaa loppua
|
||||
Comment[fr]=Vous manquez d'espace disque
|
||||
Comment[ga]=Tá an diosca ag éirí lán
|
||||
Comment[gl]=Está a quedar sen espazo no disco
|
||||
Comment[he]=השטח הפנוי בדיסק מועט
|
||||
Comment[hi]=आप कम डिस्क जगह पर चल रहे हैं
|
||||
Comment[hr]=Ponestaje vam diskovnog prostora
|
||||
Comment[hu]=A lemezterület kezd elfogyni
|
||||
Comment[ia]=Tu es exhauriente le spatio de disco
|
||||
Comment[id]=Anda berjalan pada ruang kosong yang tinggal sedikit
|
||||
Comment[is]=Þú ert að verða uppiskroppa með diskpláss
|
||||
Comment[it]=Stai esaurendo lo spazio su disco
|
||||
Comment[ja]=ディスクの空き領域が少なくなりました
|
||||
Comment[kk]=Диск орын тапшылықтасыз
|
||||
Comment[km]=អ្នកកំពុងដំណើរការទាបលើទំហំថាស
|
||||
Comment[kn]=ನಿಮ್ಮಲ್ಲಿ ಕಡಿಮೆ ಡಿಸ್ಕ್ ಸ್ಥಳವಿದೆ
|
||||
Comment[ko]=디스크 공간이 거의 없습니다
|
||||
Comment[lt]=Jūsų diske liko mažai vietos
|
||||
Comment[lv]=Uz diska ir maz brīvas vietas
|
||||
Comment[mr]=तुमच्या डिस्कवर कमी जागा शिल्लक आहे
|
||||
Comment[nb]=Du har lite diskplass igjen
|
||||
Comment[nds]=De free Ruum op Dien Fastplaat geiht op de Neeg.
|
||||
Comment[nl]=U hebt bijna geen vrije schijfruimte meer
|
||||
Comment[nn]=Du har lite diskplass att
|
||||
Comment[pa]=ਤੁਹਾਡੇ ਕੋਲ ਡਿਸਕ ਖਾਲੀ ਥਾਂ ਘੱਟ ਰਹੀ ਹੈ
|
||||
Comment[pl]=Zaczyna brakować miejsca na dysku
|
||||
Comment[pt]=Está a ficar com pouco espaço livre em disco
|
||||
Comment[pt_BR]=Você tem pouco espaço livre em disco
|
||||
Comment[ro]=Spațiul dumneavoastră de stocare este pe cale să se termine
|
||||
Comment[ru]=На диске осталось мало свободного места
|
||||
Comment[si]=ඔබගේ තැටි ඉඩ අඩු වෙමින් පවතී
|
||||
Comment[sk]=Dochádza vám voľné miesto na disku
|
||||
Comment[sl]=Na disku imate malo razpoložljivega prostora
|
||||
Comment[sr]=Понестаје вам простора на диску
|
||||
Comment[sr@ijekavian]=Понестаје вам простора на диску
|
||||
Comment[sr@ijekavianlatin]=Ponestaje vam prostora na disku
|
||||
Comment[sr@latin]=Ponestaje vam prostora na disku
|
||||
Comment[sv]=Diskutrymmet håller på att ta slut
|
||||
Comment[th]=คุณกำลังทำงานด้วยพื้นที่ดิสก์ที่เหลือน้อย
|
||||
Comment[tr]=Düşük disk alanı üzerinde çalışıyorsunuz
|
||||
Comment[ug]=دىسكىدىكى بوشلۇق ئاز ھالەتتە ئىجرا قىلىۋاتىسىز
|
||||
Comment[uk]=На вашому диску залишилося замало місця
|
||||
Comment[vi]=Bạn đang dùng sắp hết không gian đĩa
|
||||
Comment[wa]=Vos estoz k' n' a pus bråmint d' plaece sol plake
|
||||
Comment[x-test]=xxYou are running low on disk spacexx
|
||||
Comment[zh_CN]=您现在的磁盘空间过低
|
||||
Comment[zh_TW]=您的磁碟空間快用完了
|
||||
Contexts=warningnot
|
||||
Action=Popup
|
|
@ -1,90 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>freespacenotifier_prefs_base</class>
|
||||
<widget class="QWidget" name="freespacenotifier_prefs_base">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>217</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="kcfg_enableNotification">
|
||||
<property name="text">
|
||||
<string>Enable low disk space warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_minimumSpace">
|
||||
<property name="text">
|
||||
<string>Warn when free space is below:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="kcfg_minimumSpace">
|
||||
<property name="suffix">
|
||||
<string> MiB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>kcfg_enableNotification</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>kcfg_minimumSpace</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>114</x>
|
||||
<y>15</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>272</x>
|
||||
<y>44</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>kcfg_enableNotification</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label_minimumSpace</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>114</x>
|
||||
<y>15</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>114</x>
|
||||
<y>44</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,36 +0,0 @@
|
|||
/* This file is part of the KDE Project
|
||||
Copyright (c) 2006 Lukas Tinkl <ltinkl@suse.cz>
|
||||
Copyright (c) 2008 Lubos Lunak <l.lunak@suse.cz>
|
||||
Copyright (c) 2009 Ivo Anjo <knuckles@gmail.com>
|
||||
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
|
||||
K_PLUGIN_FACTORY(FreeSpaceNotifierModuleFactory,
|
||||
registerPlugin<FreeSpaceNotifierModule>();
|
||||
)
|
||||
K_EXPORT_PLUGIN(FreeSpaceNotifierModuleFactory("freespacenotifier"))
|
||||
|
||||
|
||||
FreeSpaceNotifierModule::FreeSpaceNotifierModule(QObject* parent, const QList<QVariant>&)
|
||||
: KDEDModule(parent)
|
||||
{
|
||||
}
|
||||
|
||||
#include "moc_module.cpp"
|
|
@ -1,39 +0,0 @@
|
|||
/* This file is part of the KDE Project
|
||||
Copyright (c) 2006 Lukas Tinkl <ltinkl@suse.cz>
|
||||
Copyright (c) 2008 Lubos Lunak <l.lunak@suse.cz>
|
||||
Copyright (c) 2009 Ivo Anjo <knuckles@gmail.com>
|
||||
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MODULE_H
|
||||
#define MODULE_H
|
||||
|
||||
#include <KDEDModule>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include "freespacenotifier.h"
|
||||
|
||||
class FreeSpaceNotifierModule
|
||||
: public KDEDModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FreeSpaceNotifierModule(QObject* parent, const QList<QVariant>&);
|
||||
private:
|
||||
FreeSpaceNotifier notifier;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,6 +0,0 @@
|
|||
# Code generation options for kconfig_compiler
|
||||
File=freespacenotifier.kcfg
|
||||
ClassName=FreeSpaceNotifierSettings
|
||||
Singleton=true
|
||||
Mutators=minimumSpace,enableNotification
|
||||
# will create the necessary code for setting those variables
|
15
kfreespace/CMakeLists.txt
Normal file
15
kfreespace/CMakeLists.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
project(kfreespace)
|
||||
|
||||
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1604)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_subdirectory(kcm)
|
||||
add_subdirectory(kded)
|
||||
|
||||
install(
|
||||
FILES kfreespace.notifyrc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kfreespace
|
||||
)
|
23
kfreespace/kcm/CMakeLists.txt
Normal file
23
kfreespace/kcm/CMakeLists.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
########### next target ###############
|
||||
|
||||
set(kfreespaceconfig_SRCS
|
||||
kfreespaceconfig.cpp
|
||||
)
|
||||
|
||||
kde4_add_plugin(kcm_kfreespaceconfig ${kfreespaceconfig_SRCS})
|
||||
|
||||
target_link_libraries(kcm_kfreespaceconfig
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KCMUTILS_LIBS}
|
||||
${KDE4_SOLID_LIBS}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS kcm_kfreespaceconfig
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES kcm_kfreespaceconfig.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||
)
|
16
kfreespace/kcm/kcm_kfreespaceconfig.desktop
Normal file
16
kfreespace/kcm/kcm_kfreespaceconfig.desktop
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Desktop Entry]
|
||||
Exec=kcmshell4 kfreespaceconfig
|
||||
Icon=drive-harddisk
|
||||
Type=Service
|
||||
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
X-KDE-Library=kcm_kfreespaceconfig
|
||||
X-KDE-ParentApp=kcontrol
|
||||
X-KDE-System-Settings-Parent-Category=hardware
|
||||
X-KDE-System-Settings-Parent-Category-V2=hardware
|
||||
X-DocPath=kcontrol/kfreespaceconfig/index.html
|
||||
Categories=Qt;KDE;X-KDE-settings-hardware;
|
||||
|
||||
Name=Free Space Notifier
|
||||
Comment=Change free space notifier options
|
||||
X-KDE-Keywords=Free,Disk,Notify
|
270
kfreespace/kcm/kfreespaceconfig.cpp
Normal file
270
kfreespace/kcm/kfreespaceconfig.cpp
Normal file
|
@ -0,0 +1,270 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kfreespaceconfig.h"
|
||||
#include "kfreespace.h"
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <knuminput.h>
|
||||
#include <klocale.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <solid/device.h>
|
||||
#include <solid/storagevolume.h>
|
||||
#include <solid/storageaccess.h>
|
||||
|
||||
class KFreeSpaceBox : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KFreeSpaceBox(QWidget *parent,
|
||||
const QString &udi, const QString &title,
|
||||
bool watch, qulonglong checktime, qulonglong freespace);
|
||||
|
||||
|
||||
public:
|
||||
QString udi() const;
|
||||
bool watch() const;
|
||||
qulonglong checkTime() const;
|
||||
qulonglong freeSpace() const;
|
||||
|
||||
void setDefault();
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotWatch();
|
||||
void slotCheckTime();
|
||||
void slotFreeSpace();
|
||||
|
||||
private:
|
||||
QString m_udi;
|
||||
QCheckBox* m_watchbox;
|
||||
KIntNumInput* m_checktimeinput;
|
||||
KIntNumInput* m_freespaceinput;
|
||||
};
|
||||
|
||||
KFreeSpaceBox::KFreeSpaceBox(QWidget *parent,
|
||||
const QString &udi, const QString &title,
|
||||
bool watch, qulonglong checktime, qulonglong freespace)
|
||||
: QGroupBox(parent),
|
||||
m_udi(udi),
|
||||
m_watchbox(nullptr),
|
||||
m_checktimeinput(nullptr),
|
||||
m_freespaceinput(nullptr)
|
||||
{
|
||||
setTitle(title);
|
||||
QGridLayout* devicelayout = new QGridLayout(this);
|
||||
|
||||
m_watchbox = new QCheckBox(i18n("Notify when the device free space is low"), this);
|
||||
m_watchbox->setChecked(watch);
|
||||
m_watchbox->setToolTip(i18n("Whether or not to periodically check the device free space"));
|
||||
connect(m_watchbox, SIGNAL(stateChanged(int)), this, SLOT(slotWatch()));
|
||||
devicelayout->addWidget(m_watchbox, 0, 0, 1, 2);
|
||||
|
||||
QLabel* checktimelabel = new QLabel(i18n("Check time:"), this);
|
||||
devicelayout->addWidget(checktimelabel, 1, 0);
|
||||
m_checktimeinput = new KIntNumInput(this);
|
||||
m_checktimeinput->setRange(s_kfreespacechecktimemin, s_kfreespacechecktimemax);
|
||||
m_checktimeinput->setValue(checktime);
|
||||
m_checktimeinput->setSuffix(ki18np(" second", " seconds"));
|
||||
m_checktimeinput->setSliderEnabled(true);
|
||||
m_checktimeinput->setToolTip(i18n("When the time has elapsed the device free space will be checked"));
|
||||
connect(m_checktimeinput, SIGNAL(valueChanged(int)), this, SLOT(slotCheckTime()));
|
||||
devicelayout->addWidget(m_checktimeinput, 1, 1);
|
||||
|
||||
QLabel* freespacelabel = new QLabel(i18n("Free space:"), this);
|
||||
devicelayout->addWidget(freespacelabel, 2, 0);
|
||||
m_freespaceinput = new KIntNumInput(this);
|
||||
m_freespaceinput->setRange(s_kfreespacefreespacemin, s_kfreespacefreespacemax);
|
||||
m_freespaceinput->setValue(freespace);
|
||||
m_freespaceinput->setSliderEnabled(true);
|
||||
m_freespaceinput->setToolTip(i18n("When the free space on the devices is equal to or less than that a notification will be shown"));
|
||||
// NOTE: the i18n() bellow is using translation from:
|
||||
// kdelibs/kdecore/localization/klocale_kde.cpp
|
||||
m_freespaceinput->setSuffix(i18n("%1 MB", QLatin1String("")));
|
||||
m_freespaceinput->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
connect(m_freespaceinput, SIGNAL(valueChanged(int)), this, SLOT(slotFreeSpace()));
|
||||
devicelayout->addWidget(m_freespaceinput, 2, 1);
|
||||
|
||||
m_checktimeinput->setEnabled(watch);
|
||||
m_freespaceinput->setEnabled(watch);
|
||||
}
|
||||
|
||||
QString KFreeSpaceBox::udi() const
|
||||
{
|
||||
return m_udi;
|
||||
}
|
||||
|
||||
bool KFreeSpaceBox::watch() const
|
||||
{
|
||||
return m_watchbox->isChecked();
|
||||
}
|
||||
|
||||
qulonglong KFreeSpaceBox::checkTime() const
|
||||
{
|
||||
return m_checktimeinput->value();
|
||||
}
|
||||
|
||||
qulonglong KFreeSpaceBox::freeSpace() const
|
||||
{
|
||||
return m_freespaceinput->value();
|
||||
}
|
||||
|
||||
void KFreeSpaceBox::setDefault()
|
||||
{
|
||||
m_watchbox->setChecked(s_kfreespacewatch);
|
||||
m_checktimeinput->setValue(s_kfreespacechecktime);
|
||||
m_freespaceinput->setValue(s_kfreespacefreespace);
|
||||
}
|
||||
|
||||
void KFreeSpaceBox::slotWatch()
|
||||
{
|
||||
const bool watch = m_watchbox->isChecked();
|
||||
m_checktimeinput->setEnabled(watch);
|
||||
m_freespaceinput->setEnabled(watch);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KFreeSpaceBox::slotCheckTime()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KFreeSpaceBox::slotFreeSpace()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
K_PLUGIN_FACTORY(KCMFreeSpaceFactory, registerPlugin<KCMFreeSpace>();)
|
||||
K_EXPORT_PLUGIN(KCMFreeSpaceFactory("kcmfreespaceconfig", "kcm_freespaceconfig"))
|
||||
|
||||
KCMFreeSpace::KCMFreeSpace(QWidget *parent, const QVariantList &args)
|
||||
: KCModule(KCMFreeSpaceFactory::componentData(), parent),
|
||||
m_layout(nullptr),
|
||||
m_spacer(nullptr)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
|
||||
setButtons(KCModule::Default | KCModule::Apply);
|
||||
setQuickHelp(i18n("<h1>Free Space Notifier</h1> This module allows you to change KDE free space notifier options."));
|
||||
|
||||
KAboutData *about = new KAboutData(
|
||||
I18N_NOOP("kcmkgreeter"), 0,
|
||||
ki18n("KDE Free Space Notifier Module"),
|
||||
0, KLocalizedString(), KAboutData::License_GPL,
|
||||
ki18n("Copyright 2023, Ivailo Monev <email>xakepa10@gmail.com</email>")
|
||||
);
|
||||
about->addAuthor(ki18n("Ivailo Monev"), KLocalizedString(), "xakepa10@gmail.com");
|
||||
setAboutData(about);
|
||||
|
||||
m_layout = new QVBoxLayout(this);
|
||||
setLayout(m_layout);
|
||||
}
|
||||
|
||||
KCMFreeSpace::~KCMFreeSpace()
|
||||
{
|
||||
}
|
||||
|
||||
void KCMFreeSpace::load()
|
||||
{
|
||||
qDeleteAll(m_deviceboxes);
|
||||
m_deviceboxes.clear();
|
||||
for (int i = 0; i < m_layout->count(); i++) {
|
||||
const QLayoutItem* layoutitem = m_layout->itemAt(i);
|
||||
if (layoutitem == m_spacer) {
|
||||
delete m_layout->takeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_spacer = nullptr;
|
||||
|
||||
KConfig kfreespaceconfig("kfreespacerc", KConfig::SimpleConfig);
|
||||
foreach (const Solid::Device soliddevice, Solid::Device::allDevices()) {
|
||||
const Solid::StorageVolume* solidstorage = soliddevice.as<Solid::StorageVolume>();
|
||||
if (!solidstorage) {
|
||||
continue;
|
||||
}
|
||||
const Solid::StorageAccess* solidaccess = soliddevice.as<Solid::StorageAccess>();
|
||||
if (!solidaccess) {
|
||||
continue;
|
||||
} else if (solidaccess->isIgnored()) {
|
||||
kDebug() << "Ignored" << soliddevice.udi();
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString kfreespacedirpath = solidaccess->filePath();
|
||||
if (kfreespacedirpath.isEmpty()) {
|
||||
kDebug() << "Not accessible" << soliddevice.udi();
|
||||
continue;
|
||||
}
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << soliddevice.udi();
|
||||
KConfigGroup kfreespacegroup = kfreespaceconfig.group(soliddevice.udi());
|
||||
const bool kfreespacewatch = kfreespacegroup.readEntry("watch", s_kfreespacewatch);
|
||||
const qulonglong kfreespacechecktime = kfreespacegroup.readEntry("checktime", qlonglong(s_kfreespacechecktime));
|
||||
const qulonglong kfreespacefreespace = kfreespacegroup.readEntry("freespace", qlonglong(s_kfreespacefreespace));
|
||||
|
||||
KFreeSpaceBox* devicebox = new KFreeSpaceBox(
|
||||
this,
|
||||
soliddevice.udi(), soliddevice.description(),
|
||||
kfreespacewatch, kfreespacechecktime, kfreespacefreespace
|
||||
);
|
||||
m_deviceboxes.append(devicebox);
|
||||
connect(devicebox, SIGNAL(changed()), this, SLOT(slotDeviceChanged()));
|
||||
m_layout->addWidget(devicebox);
|
||||
}
|
||||
m_spacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_layout->addSpacerItem(m_spacer);
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void KCMFreeSpace::save()
|
||||
{
|
||||
KConfig kfreespaceconfig("kfreespacerc", KConfig::SimpleConfig);
|
||||
foreach (const KFreeSpaceBox* devicebox, m_deviceboxes) {
|
||||
KConfigGroup kfreespacegroup = kfreespaceconfig.group(devicebox->udi());
|
||||
kfreespacegroup.writeEntry("watch", devicebox->watch());
|
||||
kfreespacegroup.writeEntry("checktime", devicebox->checkTime());
|
||||
kfreespacegroup.writeEntry("freespace", devicebox->freeSpace());
|
||||
}
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void KCMFreeSpace::defaults()
|
||||
{
|
||||
foreach (KFreeSpaceBox* devicebox, m_deviceboxes) {
|
||||
devicebox->setDefault();
|
||||
}
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
void KCMFreeSpace::slotDeviceChanged()
|
||||
{
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
#include "moc_kfreespaceconfig.cpp"
|
||||
#include "kfreespaceconfig.moc"
|
56
kfreespace/kcm/kfreespaceconfig.h
Normal file
56
kfreespace/kcm/kfreespaceconfig.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KFREESPACECONFIG_H
|
||||
#define KFREESPACECONFIG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QList>
|
||||
#include <kcmodule.h>
|
||||
|
||||
class KFreeSpaceBox;
|
||||
|
||||
/**
|
||||
* Control look of KDE greeter
|
||||
*
|
||||
* @author Ivailo Monev (xakepa10@gmail.com)
|
||||
*/
|
||||
class KCMFreeSpace : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// KCModule reimplementations
|
||||
KCMFreeSpace(QWidget *parent, const QVariantList &args);
|
||||
~KCMFreeSpace();
|
||||
|
||||
public Q_SLOTS:
|
||||
void load() final;
|
||||
void save() final;
|
||||
void defaults() final;
|
||||
|
||||
void slotDeviceChanged();
|
||||
|
||||
private:
|
||||
QVBoxLayout* m_layout;
|
||||
QSpacerItem* m_spacer;
|
||||
QList<KFreeSpaceBox*> m_deviceboxes;
|
||||
};
|
||||
|
||||
#endif // KFREESPACECONFIG_H
|
34
kfreespace/kded/CMakeLists.txt
Normal file
34
kfreespace/kded/CMakeLists.txt
Normal file
|
@ -0,0 +1,34 @@
|
|||
########### next target ###############
|
||||
|
||||
set(kded_kfreespace_SRCS
|
||||
kded_kfreespace.cpp
|
||||
kfreespaceimpl.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/org.kde.kfreespace.xml
|
||||
)
|
||||
|
||||
qt4_generate_dbus_interface(kded_kfreespace.h org.kde.kfreespace.xml )
|
||||
|
||||
kde4_add_plugin(kded_kfreespace ${kded_kfreespace_SRCS})
|
||||
target_link_libraries(kded_kfreespace PRIVATE
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${KDE4_SOLID_LIBS}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS kded_kfreespace
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES kfreespace.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded
|
||||
)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kfreespace.xml
|
||||
DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR}
|
||||
)
|
||||
|
||||
|
115
kfreespace/kded/kded_kfreespace.cpp
Normal file
115
kfreespace/kded/kded_kfreespace.cpp
Normal file
|
@ -0,0 +1,115 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kded_kfreespace.h"
|
||||
#include "kfreespace.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <klocale.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <knotification.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kdebug.h>
|
||||
#include <solid/device.h>
|
||||
#include <solid/storagevolume.h>
|
||||
#include <solid/storageaccess.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KFreeSpaceModuleFactory, registerPlugin<KFreeSpaceModule>();)
|
||||
K_EXPORT_PLUGIN(KFreeSpaceModuleFactory("kfreespace"))
|
||||
|
||||
KFreeSpaceModule::KFreeSpaceModule(QObject *parent, const QList<QVariant> &args)
|
||||
: KDEDModule(parent),
|
||||
m_dirwatch(nullptr)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
|
||||
slotInit();
|
||||
|
||||
m_dirwatch = new KDirWatch(this);
|
||||
const QString kfreespacercfile = KStandardDirs::locateLocal("config", "kfreespacerc");
|
||||
m_dirwatch->addFile(kfreespacercfile);
|
||||
connect(m_dirwatch, SIGNAL(dirty(QString)), this, SLOT(slotInit()));
|
||||
|
||||
// TODO: watch storage devices to reinit
|
||||
}
|
||||
|
||||
KFreeSpaceModule::~KFreeSpaceModule()
|
||||
{
|
||||
qDeleteAll(m_freespaces);
|
||||
m_freespaces.clear();
|
||||
}
|
||||
|
||||
void KFreeSpaceModule::slotInit()
|
||||
{
|
||||
kDebug() << "Initializing";
|
||||
|
||||
qDeleteAll(m_freespaces);
|
||||
m_freespaces.clear();
|
||||
|
||||
KConfig kfreespaceconfig("kfreespacerc", KConfig::SimpleConfig);
|
||||
bool watcherror = false;
|
||||
foreach (const Solid::Device soliddevice, Solid::Device::allDevices()) {
|
||||
const Solid::StorageVolume* solidstorage = soliddevice.as<Solid::StorageVolume>();
|
||||
if (!solidstorage) {
|
||||
continue;
|
||||
}
|
||||
const Solid::StorageAccess* solidaccess = soliddevice.as<Solid::StorageAccess>();
|
||||
if (!solidaccess) {
|
||||
continue;
|
||||
} else if (solidaccess->isIgnored()) {
|
||||
kDebug() << "Ignored" << soliddevice.udi();
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString kfreespacedirpath = solidaccess->filePath();
|
||||
if (kfreespacedirpath.isEmpty()) {
|
||||
kDebug() << "Not accessible" << soliddevice.udi();
|
||||
continue;
|
||||
}
|
||||
|
||||
// qDebug() << Q_FUNC_INFO << soliddevice.udi();
|
||||
KConfigGroup kfreespacegroup = kfreespaceconfig.group(soliddevice.udi());
|
||||
const bool kfreespacewatch = kfreespacegroup.readEntry("watch", s_kfreespacewatch);
|
||||
if (!kfreespacewatch) {
|
||||
kDebug() << "Not watching" << soliddevice.udi();
|
||||
continue;
|
||||
}
|
||||
|
||||
const qulonglong kfreespacechecktime = kfreespacegroup.readEntry("checktime", qulonglong(s_kfreespacechecktime));
|
||||
const qulonglong kfreespacefreespace = kfreespacegroup.readEntry("freespace", qulonglong(s_kfreespacefreespace));
|
||||
KFreeSpaceImpl* kfreespaceimpl = new KFreeSpaceImpl(this);
|
||||
const bool kfreespacestatus = kfreespaceimpl->watch(
|
||||
kfreespacedirpath,
|
||||
kfreespacechecktime, kfreespacefreespace
|
||||
);
|
||||
if (!kfreespacestatus) {
|
||||
delete kfreespaceimpl;
|
||||
watcherror = true;
|
||||
} else {
|
||||
m_freespaces.append(kfreespaceimpl);
|
||||
}
|
||||
}
|
||||
if (watcherror) {
|
||||
KNotification *knotification = new KNotification("WatchError");
|
||||
knotification->setComponentData(KComponentData("kfreespace"));
|
||||
knotification->setTitle(i18n("Disk space watch"));
|
||||
knotification->setText(i18n("Unable to watch one or more devices"));
|
||||
knotification->sendEvent();
|
||||
}
|
||||
}
|
47
kfreespace/kded/kded_kfreespace.h
Normal file
47
kfreespace/kded/kded_kfreespace.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KFREESPACE_KDED_H
|
||||
#define KFREESPACE_KDED_H
|
||||
|
||||
#include "kfreespaceimpl.h"
|
||||
|
||||
#include <QList>
|
||||
#include <kdedmodule.h>
|
||||
#include <kdirwatch.h>
|
||||
|
||||
class KFreeSpaceImpl;
|
||||
|
||||
class KFreeSpaceModule: public KDEDModule
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kfreespace")
|
||||
|
||||
public:
|
||||
KFreeSpaceModule(QObject *parent, const QList<QVariant> &args);
|
||||
~KFreeSpaceModule();
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotInit();
|
||||
|
||||
private:
|
||||
KDirWatch* m_dirwatch;
|
||||
QList<KFreeSpaceImpl*> m_freespaces;
|
||||
};
|
||||
|
||||
#endif // KFREESPACE_KDED_H
|
134
kfreespace/kded/kfreespace.desktop
Normal file
134
kfreespace/kded/kfreespace.desktop
Normal file
|
@ -0,0 +1,134 @@
|
|||
[Desktop Entry]
|
||||
Icon=drive-harddisk
|
||||
Name=Free Space Notifier
|
||||
Name[ar]=منبه المساحة الحرة
|
||||
Name[ast]=Notificador d'espaciu llibre
|
||||
Name[bg]=Уведомяване за свободно пространство
|
||||
Name[bs]=Izvještač o slobodnom prostoru
|
||||
Name[ca]=Notificador d'espai lliure
|
||||
Name[ca@valencia]=Notificador d'espai lliure
|
||||
Name[cs]=Oznamování volného místa
|
||||
Name[da]=Bekendtgørelse om ledig plads
|
||||
Name[de]=Speicherplatzbenachrichtigung
|
||||
Name[el]=Ειδοποίηση ελεύθερου χώρου
|
||||
Name[en_GB]=Free Space Notifier
|
||||
Name[es]=Notificador de espacio libre
|
||||
Name[et]=Vaba ruumi teavitaja
|
||||
Name[eu]=Leku askearen jakinarazlea
|
||||
Name[fi]=Vapaan tilan ilmoitin
|
||||
Name[fr]=Notification d'espace libre
|
||||
Name[ga]=Fógróir Spáis Shaoir
|
||||
Name[gl]=Notificador de espazo libre
|
||||
Name[he]=Free Space Notifier
|
||||
Name[hi]=खाली स्थान सूचक
|
||||
Name[hr]=Glasnik slobodnog prostora
|
||||
Name[hu]=Szabad hely értesítő
|
||||
Name[ia]=Notificator de spatio libere
|
||||
Name[id]=Notifikasi Ruang Kosong
|
||||
Name[is]=Tilkynningar um laust pláss
|
||||
Name[it]=Notificatore dello spazio libero
|
||||
Name[ja]=空き領域の通知
|
||||
Name[kk]=KDE-нің бос орын туралы құлақтандыруы
|
||||
Name[km]=កម្មវិធីជូនដំណឹងទំហំទំនេរ
|
||||
Name[kn]=ಖಾಲಿ ಜಾಗ ಸೂಚಕ
|
||||
Name[ko]=남은 공간 알림이
|
||||
Name[lt]=Laisvos vietos pranešėjas
|
||||
Name[lv]=Brīvās vietas ziņotājs
|
||||
Name[ml]=ലഭ്യമായ സ്ഥലം അറിയിക്കുന്നതിനുള്ള സംവിധാനം
|
||||
Name[mr]=मोकळी जागा निदर्शक
|
||||
Name[nb]=Ledig plass-varsler
|
||||
Name[nds]=Freeruumbescheden
|
||||
Name[nl]=Vrije ruimte-melder
|
||||
Name[nn]=Varsel om lite ledig plass
|
||||
Name[pa]=ਖਾਲੀ ਥਾਂ ਨੋਟੀਫਾਇਰ
|
||||
Name[pl]=Powiadomienie o wolnym miejscu
|
||||
Name[pt]=Notificação de Espaço Livre
|
||||
Name[pt_BR]=Notificação de espaço livre
|
||||
Name[ro]=Notificare spațiu liber
|
||||
Name[ru]=Слежение за свободным местом на диске
|
||||
Name[si]=හිස් ඉඩ දැනුම් දෙන්නා
|
||||
Name[sk]=Monitor voľného miesta
|
||||
Name[sl]=Obvestilnik o neporabljenem prostoru
|
||||
Name[sr]=Извештавач о слободном простору
|
||||
Name[sr@ijekavian]=Извјештавач о слободном простору
|
||||
Name[sr@ijekavianlatin]=Izvještavač o slobodnom prostoru
|
||||
Name[sr@latin]=Izveštavač o slobodnom prostoru
|
||||
Name[sv]=Information om ledigt utrymme
|
||||
Name[th]=ตัวแจ้งพื้นที่ว่าง
|
||||
Name[tr]=Boş Alan Bildirici
|
||||
Name[ug]=بىكار بوشلۇق خەۋەرچىسى
|
||||
Name[uk]=Сповіщення про вільне місце
|
||||
Name[vi]=Trình thông báo không gian trống
|
||||
Name[wa]=Notifieu del plaece di libe
|
||||
Name[x-test]=xxFree Space Notifierxx
|
||||
Name[zh_CN]=空闲空间通知器
|
||||
Name[zh_TW]=剩餘空間通知
|
||||
Comment=Warns when running out of space on your home folder
|
||||
Comment[ar]=يحذر عندما توشك مساحة مجلد المنزل على النفاد
|
||||
Comment[ast]=Avisa cuando te quedes ensin espaciu na carpeta personal
|
||||
Comment[bg]=Предупреждение при твърде малко пространство в домашната директория
|
||||
Comment[bn]=ব্যক্তিগত ফোল্ডারে জায়গা কমে গেলে সতর্ক করে
|
||||
Comment[bs]=Upozorava kada vam ponestaje prostora u ličnom direktoriju
|
||||
Comment[ca]=Avisa quan s'exhaureix l'espai de la carpeta personal
|
||||
Comment[ca@valencia]=Avisa quan s'exhaureix l'espai de la carpeta personal
|
||||
Comment[cs]=Varování při blížícím se nedostatku místa v domácí složce
|
||||
Comment[da]=Advarer når du er ved at løbe tør for plads i din hjemmemappe
|
||||
Comment[de]=Gibt eine Warnung aus, wenn der freie Speicherplatz in Ihrem Persönlichen Ordner knapp wird
|
||||
Comment[el]=Προειδοποιεί όταν τελειώνει ο ελεύθερος χώρος στον 'Προσωπικό φάκελό' σας
|
||||
Comment[en_GB]=Warns when running out of space on your home folder
|
||||
Comment[es]=Le avisa cuando se está quedando sin espacio en su carpeta personal
|
||||
Comment[et]=Hoiatus, kui kodukataloogis hakkab ruumi nappima
|
||||
Comment[eu]=Abisua ematen du etxeko karpetan lekurik gabe gelditzen ari zarenean
|
||||
Comment[fi]=Varoittaa kun kotikansiosta on tila loppumassa
|
||||
Comment[fr]=Avertit lorsque l'espace vient à manquer dans votre dossier utilisateur
|
||||
Comment[ga]=Tugann sé rabhadh duit nuair atá d'fhillteán baile ag éirí lán
|
||||
Comment[gl]=Avisa cando se está a quedar sen espazo no cartafol persoal
|
||||
Comment[he]=משמש לאזהרה כאשר המקום הפנוי בתיקיית הבית מועט
|
||||
Comment[hr]=Upozori kada nestaje prostora u mojoj korisničkoj mapi
|
||||
Comment[hu]=Figyelmeztet, ha kezd elfogyni a szabad lemezterület a saját könyvtárában
|
||||
Comment[ia]=Il avisa quando il termina le spatio sur tu dossier domo
|
||||
Comment[id]=Memperingatkan jika kehabisan ruang kosong di folder rumah anda
|
||||
Comment[is]=Varar við þegar lítið pláss er eftir í heimamöppunni þinni
|
||||
Comment[it]=Avvisa quando si sta finendo lo spazio nella tua cartella Home
|
||||
Comment[ja]=ホームフォルダの空き領域が少なくなったとき警告します
|
||||
Comment[kk]=Мекен қапшығыңызда орын тапшылығы туралы ескерту
|
||||
Comment[km]=ព្រមាន នៅពេលដំណើរការអស់ទំហំនៅលើក្នុងផ្ទះរបស់អ្នក
|
||||
Comment[kn]=ನೆಲೆ ಕೋಶದಲ್ಲಿ ಖಾಲಿ ಸ್ಥಳವು ಇದಕ್ಕಿಂತ ಕಡಿಮೆಯಾದರೆ ಎಚ್ಚರಿಸುತ್ತದೆ
|
||||
Comment[ko]=홈 폴더에 공간이 없을 때 알려 줍니다
|
||||
Comment[lt]=Įspėja, kai namų aplanke baigiasi laisva vieta
|
||||
Comment[lv]=Brīdina, kad mājas mapē beidzas brīvā vieta
|
||||
Comment[mr]=तुमच्या मुख्य संचयीकेतील जागा संपत आल्याची सूचना देतो
|
||||
Comment[nb]=Varsler når det er lite plass igjen i hjemmemappa
|
||||
Comment[nds]=Wohrschoen bi to minn free Ruum binnen Dien Tohuusorner
|
||||
Comment[nl]=Geeft een waarschuwing bij een lage stand van de vrije ruimte voor uw persoonlijke map
|
||||
Comment[nn]=Varslar når det er lite plass i heimemappa
|
||||
Comment[pa]=ਚੇਤਾਵਨੀ ਦਿਉ, ਜਦੋਂ ਤੁਹਾਡੇ ਘਰ ਫੋਲਡਰ ਉੱਤੇ ਥਾਂ ਖਤਮ ਹੋ ਰਹੀ ਹੋਵੇ
|
||||
Comment[pl]=Ostrzega, kiedy zaczyna brakować miejsca w katalogu domowym
|
||||
Comment[pt]=Avisa de estiver com falta de espaço na sua pasta pessoal
|
||||
Comment[pt_BR]=Avisa quando ficar sem espaço na sua pasta pessoal
|
||||
Comment[ro]=Atenționează cînd spațiul de stocare din dosarul acasă este pe cale să se termine
|
||||
Comment[ru]=Предупреждает о нехватке дискового пространства в домашней папке
|
||||
Comment[si]=ඔබගේ නිවාස බහාලුමේ ඉඩ අඩුවෙන් ධාවනය වෙන විට ඇනතුරු අඟවයි
|
||||
Comment[sk]=Upozorňuje, keď dochádza voľné miesto v domovskom priečinku
|
||||
Comment[sl]=Opozori, ko v domači mapi primanjkuje prostora
|
||||
Comment[sr]=Упозорава када вам понестаје простора у домаћој фасцикли
|
||||
Comment[sr@ijekavian]=Упозорава када вам понестаје простора у домаћој фасцикли
|
||||
Comment[sr@ijekavianlatin]=Upozorava kada vam ponestaje prostora u domaćoj fascikli
|
||||
Comment[sr@latin]=Upozorava kada vam ponestaje prostora u domaćoj fascikli
|
||||
Comment[sv]=Varnar när utrymmet i hemkatalogen håller på att ta slut
|
||||
Comment[th]=เตือนเมื่อพื้นที่ในโฟลเดอร์บ้านเหลือน้อย
|
||||
Comment[tr]=Ev dizininizde boş alan azaldığı zaman uyarır
|
||||
Comment[ug]=ماكان قىسقۇچىڭىزدىكى دىسكا بوشلۇقى ئاز قالغاندا ئەسكەرتىدۇ
|
||||
Comment[uk]=Попереджає, якщо у домашній теці залишається мало місця
|
||||
Comment[vi]=Cảnh báo khi sắp hết không gian cho thư mục chính của bạn
|
||||
Comment[wa]=Advierti cwand i gn a cåzu pupont d' plaece dins vosse ridant måjhon
|
||||
Comment[x-test]=xxWarns when running out of space on your home folderxx
|
||||
Comment[zh_CN]=在您主目录磁盘空间过低时发出警告
|
||||
Comment[zh_TW]=當您的家目錄剩餘空間快不足時警告您
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KDEDModule
|
||||
X-KDE-Library=kfreespace
|
||||
X-KDE-DBus-ModuleName=kfreespace
|
||||
X-KDE-Kded-autoload=true
|
||||
X-KDE-Kded-load-on-demand=true
|
||||
OnlyShowIn=KDE;
|
93
kfreespace/kded/kfreespaceimpl.cpp
Normal file
93
kfreespace/kded/kfreespaceimpl.cpp
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kfreespaceimpl.h"
|
||||
#include "kfreespace.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <klocale.h>
|
||||
#include <kdiskfreespaceinfo.h>
|
||||
#include <knotification.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
KFreeSpaceImpl::KFreeSpaceImpl(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_directory(QDir::homePath()),
|
||||
m_checktime(s_kfreespacechecktime),
|
||||
m_freespace(s_kfreespacefreespace),
|
||||
m_timerid(0)
|
||||
{
|
||||
}
|
||||
|
||||
KFreeSpaceImpl::~KFreeSpaceImpl()
|
||||
{
|
||||
if (m_timerid > 0) {
|
||||
killTimer(m_timerid);
|
||||
m_timerid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool KFreeSpaceImpl::watch(const QString &dirpath,
|
||||
const qulonglong checktime, const qulonglong freespace)
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << dirpath << checktime << freespace;
|
||||
m_directory = dirpath;
|
||||
// NOTE: time from config is in seconds, has to be in ms here
|
||||
m_checktime = (qBound(s_kfreespacechecktimemin, checktime, s_kfreespacechecktimemax) * 1000);
|
||||
// NOTE: size from config is in MB, has to be in bytes here
|
||||
m_freespace = (qBound(s_kfreespacefreespacemin, freespace, s_kfreespacefreespacemax) * 1024 * 1024);
|
||||
if (!QDir(m_directory).exists()) {
|
||||
kWarning() << "Directory does not exist" << m_directory;
|
||||
return false;
|
||||
}
|
||||
m_timerid = startTimer(m_checktime);
|
||||
kDebug() << "Checking" << m_directory
|
||||
<< "every" << (m_checktime / 1000)
|
||||
<< "if space is less or equal to" << KGlobal::locale()->formatByteSize(m_freespace);
|
||||
return true;
|
||||
}
|
||||
|
||||
void KFreeSpaceImpl::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == m_timerid) {
|
||||
event->accept();
|
||||
|
||||
const KDiskFreeSpaceInfo kdiskinfo = KDiskFreeSpaceInfo::freeSpaceInfo(m_directory);
|
||||
if (!kdiskinfo.isValid()) {
|
||||
kWarning() << "Disk info is not valid for" << m_directory;
|
||||
killTimer(m_timerid);
|
||||
m_timerid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const qulonglong freespace = kdiskinfo.available();
|
||||
kDebug() << "Current" << m_directory
|
||||
<< "space is" << KGlobal::locale()->formatByteSize(freespace);
|
||||
if (freespace <= m_freespace) {
|
||||
KNotification *knotification = new KNotification("WatchLow");
|
||||
knotification->setComponentData(KComponentData("kfreespace"));
|
||||
knotification->setTitle(i18n("Disk space watch"));
|
||||
knotification->setText(i18n("Low Disk Space"));
|
||||
knotification->sendEvent();
|
||||
}
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_kfreespaceimpl.cpp"
|
46
kfreespace/kded/kfreespaceimpl.h
Normal file
46
kfreespace/kded/kfreespaceimpl.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KFREESPACEIMPL_H
|
||||
#define KFREESPACEIMPL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimerEvent>
|
||||
|
||||
class KFreeSpaceImpl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KFreeSpaceImpl(QObject *parent = nullptr);
|
||||
~KFreeSpaceImpl();
|
||||
|
||||
bool watch(const QString &dirpath,
|
||||
const qulonglong checktime, const qulonglong freespace);
|
||||
|
||||
protected:
|
||||
// reimplementation
|
||||
void timerEvent(QTimerEvent *event);
|
||||
|
||||
private:
|
||||
QString m_directory;
|
||||
qulonglong m_checktime;
|
||||
qulonglong m_freespace;
|
||||
int m_timerid;
|
||||
};
|
||||
|
||||
#endif // KFREESPACEIMPL_H
|
30
kfreespace/kfreespace.h
Normal file
30
kfreespace/kfreespace.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2, as published by the Free Software Foundation.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KFREESPACE_H
|
||||
#define KFREESPACE_H
|
||||
|
||||
static const bool s_kfreespacewatch = true;
|
||||
static const qulonglong s_kfreespacechecktime = 60;
|
||||
static const qulonglong s_kfreespacechecktimemin = 1;
|
||||
static const qulonglong s_kfreespacechecktimemax = 60; // 1 minute
|
||||
static const qulonglong s_kfreespacefreespace = 1024; // 1 GB
|
||||
static const qulonglong s_kfreespacefreespacemin = 10;
|
||||
static const qulonglong s_kfreespacefreespacemax = 1024;
|
||||
|
||||
#endif // KFREESPACE_H
|
16
kfreespace/kfreespace.notifyrc
Normal file
16
kfreespace/kfreespace.notifyrc
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Global]
|
||||
Name=kfreespace
|
||||
Comment=Free Space Notifier
|
||||
IconName=drive-harddisk
|
||||
|
||||
[Event/WatchError]
|
||||
Name=Unable to watch one or more devices
|
||||
Action=Sound|Popup
|
||||
Sound=KDE-Sys-App-Error-Serious.ogg
|
||||
IconName=dialog-error
|
||||
|
||||
[Event/WatchLow]
|
||||
Name=Low Disk Space
|
||||
Action=Sound|Popup
|
||||
Sound=KDE-Sys-App-Error-Serious.ogg
|
||||
IconName=dialog-warning
|
Loading…
Add table
Reference in a new issue