From: Ivailo Monev Date: Wed, 20 Sep 2023 12:01:41 +0000 (+0300) Subject: ktimer: drop it X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=949b3ad5833fb2f35459d04df2f596e07ccd3021;p=kde%2Fkde-extraapps.git ktimer: drop it there is plasma applet that does the same, bye! Signed-off-by: Ivailo Monev --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 198fead5..09fc880b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,6 @@ kde4_optional_add_subdirectory(kmix) kde4_optional_add_subdirectory(krdc) kde4_optional_add_subdirectory(krfb) kde4_optional_add_subdirectory(ksnapshot) -kde4_optional_add_subdirectory(ktimer) kde4_optional_add_subdirectory(kvkbd) kde4_optional_add_subdirectory(okular) kde4_optional_add_subdirectory(partitionmanager) diff --git a/ktimer/CMakeLists.txt b/ktimer/CMakeLists.txt deleted file mode 100644 index 92507fb9..00000000 --- a/ktimer/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -project(ktimer) - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - include(FeatureSummary) - - find_package(KDELibs4 4.23.0 REQUIRED) - - include_directories(${KDE4_INCLUDES}) - add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -endif() - -set(ktimer_SRCS main.cpp ktimer.cpp prefwidget.ui) - -add_executable(ktimer ${ktimer_SRCS}) -target_link_libraries(ktimer KDE4::kio) - -install( - TARGETS ktimer - DESTINATION ${KDE4_BIN_INSTALL_DIR} -) - -########### install files ############### - -install( - PROGRAMS ktimer.desktop - DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR} -) - -kde4_install_icons(${KDE4_ICON_INSTALL_DIR}) - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) -endif() diff --git a/ktimer/COPYING b/ktimer/COPYING deleted file mode 100644 index 5185fd3f..00000000 --- a/ktimer/COPYING +++ /dev/null @@ -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. - - - Copyright (C) 19yy - - 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. - - , 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. diff --git a/ktimer/Messages.sh b/ktimer/Messages.sh deleted file mode 100644 index 4d43fe5d..00000000 --- a/ktimer/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -$EXTRACTRC *.ui >> rc.cpp -$XGETTEXT *.cpp -o $podir/ktimer.pot diff --git a/ktimer/hi128-app-ktimer.png b/ktimer/hi128-app-ktimer.png deleted file mode 100644 index 1720645e..00000000 Binary files a/ktimer/hi128-app-ktimer.png and /dev/null differ diff --git a/ktimer/hi16-app-ktimer.png b/ktimer/hi16-app-ktimer.png deleted file mode 100644 index cfbc8290..00000000 Binary files a/ktimer/hi16-app-ktimer.png and /dev/null differ diff --git a/ktimer/hi32-app-ktimer.png b/ktimer/hi32-app-ktimer.png deleted file mode 100644 index fb488455..00000000 Binary files a/ktimer/hi32-app-ktimer.png and /dev/null differ diff --git a/ktimer/hi48-app-ktimer.png b/ktimer/hi48-app-ktimer.png deleted file mode 100644 index a7e9458f..00000000 Binary files a/ktimer/hi48-app-ktimer.png and /dev/null differ diff --git a/ktimer/ktimer.cpp b/ktimer/ktimer.cpp deleted file mode 100644 index e74fe933..00000000 --- a/ktimer/ktimer.cpp +++ /dev/null @@ -1,624 +0,0 @@ -/* - * Copyright 2001 Stefan Schimanski <1Stein@gmx.de> - * - * 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. - */ - -#include "ktimer.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "kstatusnotifieritem.h" - -class KTimerJobItem : public QTreeWidgetItem { -public: - KTimerJobItem( KTimerJob *job, QTreeWidget *parent ) - : QTreeWidgetItem() { - parent->addTopLevelItem(this); - m_job = job; - m_error = false; - update(); - } - - KTimerJobItem( KTimerJob *job, QTreeWidget * parent, QTreeWidgetItem *after ) - : QTreeWidgetItem() { - int otherItemIndex = parent->indexOfTopLevelItem(after); - parent->insertTopLevelItem(otherItemIndex + 1, this); - m_job = job; - m_error = false; - update(); - } - - virtual ~KTimerJobItem() { - delete m_job; - } - - KTimerJob *job() { return m_job; } - - void setStatus( bool error ) { - m_error = error; - update(); - } - - void update() { - setText( 0, m_job->formatTime(m_job->value()) ); - - if( m_error ) - setIcon( 0, KIcon( QLatin1String( "process-stop" )) ); - else - setIcon( 0, QPixmap() ); - - setText( 1, m_job->formatTime(m_job->delay()) ); - - switch( m_job->state() ) { - case KTimerJob::Stopped: setIcon( 2, KIcon( QLatin1String( "media-playback-stop" )) ); break; - case KTimerJob::Paused: setIcon( 2, KIcon( QLatin1String( "media-playback-pause" )) ); break; - case KTimerJob::Started: setIcon( 2, KIcon( QLatin1String( "arrow-right" )) ); break; - } - - setText( 3, m_job->command() ); - } - -private: - bool m_error; - KTimerJob *m_job; -}; - - -/***************************************************************/ - - -struct KTimerPrefPrivate -{ - QList jobs; -}; - -KTimerPref::KTimerPref( QWidget *parent) - : QDialog( parent ) -{ - d = new KTimerPrefPrivate; - - setupUi(this); - - // set icons - m_stop->setIcon( KIcon( QLatin1String( "media-playback-stop" )) ); - m_pause->setIcon( KIcon( QLatin1String( "media-playback-pause" )) ); - m_start->setIcon( KIcon( QLatin1String( "arrow-right" )) ); - - // create tray icon - KStatusNotifierItem *tray = new KStatusNotifierItem(this); - tray->setIconByName(QLatin1String( "ktimer" )); - tray->setCategory(KStatusNotifierItem::ApplicationStatus); - tray->setStatus(KStatusNotifierItem::Active); - // set help button gui item - m_help->setGuiItem(KStandardGuiItem::help()); - - // Exit - KAction *exit = KStandardAction::quit(this, SLOT(exit()), this); - addAction(exit); - - // connect - connect( m_add, SIGNAL(clicked()), SLOT(add()) ); - connect( m_remove, SIGNAL(clicked()), SLOT(remove()) ); - connect( m_help, SIGNAL(clicked()), SLOT(help()) ); - connect( m_list, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), - SLOT(currentChanged(QTreeWidgetItem*,QTreeWidgetItem*)) ); - loadJobs( KGlobal::config().data() ); - - show(); -} - - -KTimerPref::~KTimerPref() -{ - delete d; -} - -void KTimerPref::saveAllJobs() { - saveJobs( KGlobal::config().data() ); -} - - -void KTimerPref::add() -{ - KTimerJob *job = new KTimerJob; - KTimerJobItem *item = new KTimerJobItem( job, m_list ); - - connect( job, SIGNAL(delayChanged(KTimerJob*,uint)), - SLOT(jobChanged(KTimerJob*)) ); - connect( job, SIGNAL(valueChanged(KTimerJob*,uint)), - SLOT(jobChanged(KTimerJob*)) ); - connect( job, SIGNAL(stateChanged(KTimerJob*,States)), - SLOT(jobChanged(KTimerJob*)) ); - connect( job, SIGNAL(commandChanged(KTimerJob*,QString)), - SLOT(jobChanged(KTimerJob*)) ); - connect( job, SIGNAL(finished(KTimerJob*,bool)), - SLOT(jobFinished(KTimerJob*,bool)) ); - - job->setUser( item ); - - // Qt drops currentChanged signals on first item (bug?) - if( m_list->topLevelItemCount()==1 ) - currentChanged( item , NULL); - - m_list->setCurrentItem( item ); - m_list->update(); -} - - -void KTimerPref::remove() -{ - delete m_list->currentItem(); - m_list->update(); -} - -void KTimerPref::help() -{ - KToolInvocation::invokeHelp(); -} - -// note, don't use old, but added it so we can connect to the new one -void KTimerPref::currentChanged( QTreeWidgetItem *i , QTreeWidgetItem * /* old */) -{ - KTimerJobItem *item = static_cast(i); - if( item ) { - KTimerJob *job = item->job(); - - m_state->setEnabled( true ); - m_settings->setEnabled( true ); - m_remove->setEnabled( true ); - m_delayH->disconnect(); - m_delayM->disconnect(); - m_delay->disconnect(); - m_loop->disconnect(); - m_one->disconnect(); - m_start->disconnect(); - m_pause->disconnect(); - m_stop->disconnect(); - m_counter->disconnect(); - m_slider->disconnect(); - m_commandLine->disconnect(); - m_commandLine->lineEdit()->disconnect(); - - // Set hour, minute and second QSpinBoxes before we connect to signals. - int h, m, s; - job->secondsToHMS( job->delay(), &h, &m, &s ); - m_delayH->setValue( h ); - m_delayM->setValue( m ); - m_delay->setValue( s ); - - connect( m_commandLine->lineEdit(), SIGNAL(textChanged(QString)), - job, SLOT(setCommand(QString)) ); - connect( m_delayH, SIGNAL(valueChanged(int)), - SLOT(delayChanged()) ); - connect( m_delayM, SIGNAL(valueChanged(int)), - SLOT(delayChanged()) ); - connect( m_delay, SIGNAL(valueChanged(int)), - SLOT(delayChanged()) ); - connect( m_loop, SIGNAL(toggled(bool)), - job, SLOT(setLoop(bool)) ); - connect( m_one, SIGNAL(toggled(bool)), - job, SLOT(setOneInstance(bool)) ); - connect( m_stop, SIGNAL(clicked()), - job, SLOT(stop()) ); - connect( m_pause, SIGNAL(clicked()), - job, SLOT(pause()) ); - connect( m_start, SIGNAL(clicked()), - job, SLOT(start()) ); - connect( m_slider, SIGNAL(valueChanged(int)), - job, SLOT(setValue(int)) ); - - m_commandLine->lineEdit()->setText( job->command() ); - m_loop->setChecked( job->loop() ); - m_one->setChecked( job->oneInstance() ); - m_counter->display( (int)job->value() ); - m_slider->setMaximum( job->delay() ); - m_slider->setValue( job->value() ); - - } else { - m_state->setEnabled( false ); - m_settings->setEnabled( false ); - m_remove->setEnabled( false ); - } -} - - -void KTimerPref::jobChanged( KTimerJob *job ) -{ - KTimerJobItem *item = static_cast(job->user()); - if( item ) { - item->update(); - m_list->update(); - - if( item==m_list->currentItem() ) { - - // XXX optimize - m_slider->setMaximum( job->delay() ); - m_slider->setValue( job->value() ); - m_counter->display( (int)job->value() ); - } - } -} - - -void KTimerPref::jobFinished( KTimerJob *job, bool error ) -{ - KTimerJobItem *item = static_cast(job->user()); - item->setStatus( error ); - m_list->update(); -} - -/* Hour/Minute/Second was changed. This slot calculates the seconds until we start - the job and inform the current job */ -void KTimerPref::delayChanged() -{ - KTimerJobItem *item = static_cast(m_list->currentItem()); - if ( item ) { - KTimerJob *job = item->job(); - int time_sec = job->timeToSeconds( m_delayH->value(), m_delayM->value(), m_delay->value() ); - job->setDelay( time_sec ); - } -} - -// Really quits the application -void KTimerPref::exit() { - done(0); - qApp->quit(); -} - -void KTimerPref::done(int result) { - saveAllJobs(); - QDialog::done(result); -} - -void KTimerPref::saveJobs( KConfig *cfg ) -{ - const int nbList=m_list->topLevelItemCount(); - for (int num = 0; num < nbList; ++num) - { - KTimerJobItem *item = static_cast(m_list->topLevelItem(num)); - item->job()->save( cfg, QString(QLatin1String( "Job%1" )).arg( num ) ); - - } - - KConfigGroup jobscfg = cfg->group("Jobs"); - jobscfg.writeEntry( "Number", m_list->topLevelItemCount()); - - jobscfg.sync(); -} - - -void KTimerPref::loadJobs( KConfig *cfg ) -{ - const int num = cfg->group("Jobs").readEntry( "Number", 0 ); - for( int n=0; nload( cfg, QString( QLatin1String( "Job%1" ) ).arg(n) ); - - job->setUser( item ); - jobChanged ( job); - } - - m_list->update(); -} - - -/*********************************************************************/ - - -struct KTimerJobPrivate { - unsigned delay; - QString command; - bool loop; - bool oneInstance; - unsigned value; - KTimerJob::States state; - QList processes; - void *user; - - QTimer *timer; -}; - - -KTimerJob::KTimerJob( QObject *parent) - : QObject( parent ) -{ - d = new KTimerJobPrivate; - - d->delay = 100; - d->loop = false; - d->oneInstance = true; - d->value = 100; - d->state = Stopped; - d->user = 0; - - d->timer = new QTimer( this ); - connect( d->timer, SIGNAL(timeout()), SLOT(timeout()) ); -} - - -KTimerJob::~KTimerJob() -{ - delete d; -} - - -void KTimerJob::save( KConfig *cfg, const QString& grp ) -{ - KConfigGroup groupcfg = cfg->group(grp); - groupcfg.writeEntry( "Delay", d->delay ); - groupcfg.writePathEntry( "Command", d->command ); - groupcfg.writeEntry( "Loop", d->loop ); - groupcfg.writeEntry( "OneInstance", d->oneInstance ); - groupcfg.writeEntry( "State", (int)d->state ); -} - - -void KTimerJob::load( KConfig *cfg, const QString& grp ) -{ - KConfigGroup groupcfg = cfg->group(grp); - setDelay( groupcfg.readEntry( "Delay", 100 ) ); - setCommand( groupcfg.readPathEntry( "Command", QString() ) ); - setLoop( groupcfg.readEntry( "Loop", false ) ); - setOneInstance( groupcfg.readEntry( "OneInstance", d->oneInstance ) ); - setState( (States)groupcfg.readEntry( "State", (int)Stopped ) ); -} - - -// Format given seconds to hour:minute:seconds and return QString -QString KTimerJob::formatTime( int seconds ) const -{ - int h, m, s; - secondsToHMS( seconds, &h, &m, &s ); - return QString( QLatin1String( "%1:%2:%3" ) ).arg( h ).arg( m, 2, 10, QLatin1Char( '0' ) ).arg( s,2, 10, QLatin1Char( '0' ) ); -} - - -// calculate seconds from hour, minute and seconds, returns seconds -int KTimerJob::timeToSeconds( int hours, int minutes, int seconds ) const -{ - return hours * 3600 + minutes * 60 + seconds; -} - - -// calculates hours, minutes and seconds from given secs. -void KTimerJob::secondsToHMS( int secs, int *hours, int *minutes, int *seconds ) const -{ - int s = secs; - (*hours) = s / 3600; - s = s % 3600; - (*minutes) = s / 60; - (*seconds) = s % 60; -} - -void *KTimerJob::user() -{ - return d->user; -} - - -void KTimerJob::setUser( void *user ) -{ - d->user = user; -} - - -unsigned KTimerJob::delay() const -{ - return d->delay; -} - - -void KTimerJob::pause() -{ - setState( Paused ); -} - -void KTimerJob::stop() -{ - setState( Stopped ); -} - -void KTimerJob::start() -{ - setState( Started ); -} - -void KTimerJob::setDelay( int sec ) -{ - setDelay( (unsigned)sec ); -} - -void KTimerJob::setValue( int value ) -{ - setValue( (unsigned)value ); -} - -void KTimerJob::setDelay( unsigned sec ) -{ - if( d->delay!=sec ) { - d->delay = sec; - - if( d->state==Stopped ) - setValue( sec ); - - emit delayChanged( this, sec ); - emit changed( this ); - } -} - - -QString KTimerJob::command() const -{ - return d->command; -} - - -void KTimerJob::setCommand( const QString &cmd ) -{ - if( d->command!=cmd ) { - d->command = cmd; - emit commandChanged( this, cmd ); - emit changed( this ); - } -} - - -bool KTimerJob::loop() const -{ - return d->loop; -} - - -void KTimerJob::setLoop( bool loop ) -{ - if( d->loop!=loop ) { - d->loop = loop; - emit loopChanged( this, loop ); - emit changed( this ); - } -} - - -bool KTimerJob::oneInstance() const -{ - return d->oneInstance; -} - - -void KTimerJob::setOneInstance( bool one ) -{ - if( d->oneInstance!=one ) { - d->oneInstance = one; - emit oneInstanceChanged( this, one ); - emit changed( this ); - } -} - - -unsigned KTimerJob::value() const -{ - return d->value; -} - - -void KTimerJob::setValue( unsigned value ) -{ - if( d->value!=value ) { - d->value = value; - emit valueChanged( this, value ); - emit changed( this ); - } -} - - -KTimerJob::States KTimerJob::state() const -{ - return d->state; -} - - -void KTimerJob::setState( KTimerJob::States state ) -{ - if( d->state!=state ) { - if( state==Started ) - d->timer->start( 1000 ); - else - d->timer->stop(); - - if( state==Stopped ) - setValue( d->delay ); - - d->state = state; - emit stateChanged( this, state ); - emit changed( this ); - } -} - - -void KTimerJob::timeout() -{ - if( d->state==Started && d->value!=0 ) { - setValue( d->value-1 ); - if( d->value==0 ) { - fire(); - if( d->loop ) - setValue( d->delay ); - else - stop(); - } - } -} - - -void KTimerJob::processExited(int, QProcess::ExitStatus status) -{ - QProcess * proc = static_cast(sender()); - const bool ok = status==0; - const int i = d->processes.indexOf( proc); - if (i != -1) - delete d->processes.takeAt(i); - - if( !ok ) emit error( this ); - emit finished( this, !ok ); -} - - - - -void KTimerJob::fire() -{ - if( !d->oneInstance || d->processes.isEmpty() ) { - QProcess *proc = new QProcess; - d->processes.append( proc ); - connect( proc, SIGNAL(finished(int,QProcess::ExitStatus)), - SLOT(processExited(int,QProcess::ExitStatus)) ); - if (!d->command.simplified ().isEmpty()) { - proc->start(d->command); - emit fired( this ); - } - if(proc->state() == QProcess::NotRunning) { - const int i = d->processes.indexOf( proc); - if (i != -1) - delete d->processes.takeAt(i); - emit error( this ); - emit finished( this, true ); - } - } -} -#include "moc_ktimer.cpp" diff --git a/ktimer/ktimer.desktop b/ktimer/ktimer.desktop deleted file mode 100755 index c4d551bf..00000000 --- a/ktimer/ktimer.desktop +++ /dev/null @@ -1,144 +0,0 @@ -[Desktop Entry] -GenericName=Countdown Launcher -GenericName[ar]=مطلق العدّ التنازلى -GenericName[ast]=Llanzador de cuenta atrás -GenericName[bg]=Хронометър -GenericName[bs]=Pokretač odbrojavanja -GenericName[ca]=Llançador amb compte enrere -GenericName[ca@valencia]=Llançador amb compte arrere -GenericName[cs]=Stopky -GenericName[cy]=Cychwynydd Cyfrif yn Ôl -GenericName[da]=Nedtællingsstarter -GenericName[de]=Startet den Zähler -GenericName[el]=Αντίστροφη μέτρηση για την ενεργοποίηση λογισμικού -GenericName[en_GB]=Countdown Launcher -GenericName[es]=Lanzador de cuenta atrás -GenericName[et]=Ajaarvestuse käivitaja -GenericName[eu]=Atzekoz aurrerako zenbaketaren jaurtitzailea -GenericName[fa]=راه‌انداز شمارش معکوس -GenericName[fi]=Lähtölaskenta -GenericName[fr]=Lanceur de compte à rebours -GenericName[ga]=Tosaitheoir Comhairimh Síos -GenericName[gl]=Iniciador en conta-atrás -GenericName[hne]=उलटी गिनती चालू करइया -GenericName[hr]=Pokretač odbrojavanja -GenericName[hu]=Visszaszámláló -GenericName[ia]=Lanceator de computo a retro -GenericName[id]=Peluncur dengan Hitungan Waktu -GenericName[is]=Niðurteljari -GenericName[it]=Conto alla rovescia -GenericName[ja]=タイマー -GenericName[kk]=Кері санақ -GenericName[km]=កម្មវិធី​ចាប់ផ្ដើម​កា​ររាប់​ថយក្រោយ -GenericName[ko]=카운트다운 실행기 -GenericName[lt]=Laiko skaičiuoklė -GenericName[lv]=Laika atskaites palaidējs -GenericName[mr]=काउंटडाउन प्रक्षेपक -GenericName[nb]=Nedtellingstarter -GenericName[nds]=Teller starten -GenericName[ne]=काउन्टडाउन सुरुआतकर्ता -GenericName[nl]=Afteller -GenericName[nn]=Nedteljing -GenericName[pa]=ਪੁੱਠੀ ਗਿਣਤੀ ਸ਼ੁਰੂਆਤੀ ਲਾਂਚਰ -GenericName[pl]=Odliczanie -GenericName[pt]=Contagem Decrescente -GenericName[pt_BR]=Lançador de contagem regressiva -GenericName[ro]=Cronometru -GenericName[ru]=Обратный отсчёт -GenericName[sk]=Odpočítavané spúšťanie -GenericName[sl]=Zaganjalnik odštevanja -GenericName[sq]=Nisës i Numërimit Mbrapsht -GenericName[sr]=Покретач одбројавања -GenericName[sr@ijekavian]=Покретач одбројавања -GenericName[sr@ijekavianlatin]=Pokretač odbrojavanja -GenericName[sr@latin]=Pokretač odbrojavanja -GenericName[sv]=Nerräknande startprogram -GenericName[ta]= குறிப்பு எடுப்பான் நேரக்குறைப்பான் -GenericName[th]=ตัวเรียกใช้งานแบบนับถอยหลัง -GenericName[tr]=Gerisayım Çalıştırıcı -GenericName[ug]=تەتۈر سانىغۇچنى ئجرا قىلغۇچ -GenericName[uk]=Таймер -GenericName[wa]=Usteye di munutreye -GenericName[x-test]=xxCountdown Launcherxx -GenericName[zh_CN]=倒计时执行器 -GenericName[zh_TW]=倒數發射計時 -Exec=ktimer --icon '%i' --caption '%c' -Icon=ktimer -Type=Application -Terminal=false -Name=KTimer -Name[af]=Ktimer -Name[ar]=KTimer -Name[ast]=KTimer -Name[bg]=KTimer -Name[br]=KTimer -Name[bs]=KTimer -Name[ca]=KTimer -Name[ca@valencia]=KTimer -Name[cs]=KTimer -Name[cy]=KTimer -Name[da]=KTimer -Name[de]=KTimer -Name[el]=KTimer -Name[en_GB]=KTimer -Name[eo]=KTimer -Name[es]=KTimer -Name[et]=KTimer -Name[eu]=KTimer -Name[fi]=KTimer -Name[fr]=KTimer -Name[ga]=KTimer -Name[gl]=KTimer -Name[he]=KTimer -Name[hne]=के-टाइमर -Name[hr]=KTimer -Name[hu]=KTimer -Name[ia]=KTimer -Name[id]=KTimer -Name[is]=KTimer -Name[it]=KTimer -Name[ja]=KTimer -Name[kk]=KTimer -Name[km]=KTimer -Name[ko]=KTimer -Name[lt]=KTimer -Name[lv]=KTimer -Name[mk]=KTimer -Name[mr]=के-टाइमर -Name[ms]=KTimer -Name[nb]=KTimer -Name[nds]=KTimer -Name[ne]=केडीई समय सूचक -Name[nl]=KTimer -Name[nn]=KTimer -Name[pa]=KTimer -Name[pl]=Czasomierz -Name[pt]=KTimer -Name[pt_BR]=KTimer -Name[ro]=KTimer -Name[ru]=KTimer -Name[sk]=KTimer -Name[sl]=KTimer -Name[sq]=KTimer -Name[sr]=К‑одбројавач -Name[sr@ijekavian]=К‑одбројавач -Name[sr@ijekavianlatin]=K‑odbrojavač -Name[sr@latin]=K‑odbrojavač -Name[sv]=Ktimer -Name[ta]= Kநேரம் காட்டி -Name[tg]=KВақтсанҷ -Name[th]=ตั้งเวลาทำงาน-K -Name[tr]=KTimer -Name[ug]=KTimer -Name[uk]=KTimer -Name[uz]=KTimer -Name[uz@cyrillic]=KTimer -Name[vi]=KTimer -Name[wa]=KTimer -Name[xh]=Umjongi Wexesha -Name[x-test]=xxKTimerxx -Name[zh_CN]=KTimer -Name[zh_TW]=KDE 計時器 -StartupNotify=true -Categories=Qt;KDE;Utility; -X-DocPath=ktimer/index.html diff --git a/ktimer/ktimer.h b/ktimer/ktimer.h deleted file mode 100644 index e78e204a..00000000 --- a/ktimer/ktimer.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2001 Stefan Schimanski <1Stein@gmx.de> - * - * 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. - */ - -#ifndef KTIMER_H_INCLUDED -#define KTIMER_H_INCLUDED - -#include -#include -#include -#include "ui_prefwidget.h" - -#include -class KConfig; - -class KTimerJob : public QObject { - Q_OBJECT - - public: - KTimerJob( QObject *parent=0); - virtual ~KTimerJob(); - - enum States { Stopped, Paused, Started }; - - unsigned delay() const; - QString command() const; - bool loop() const; - bool oneInstance() const; - unsigned value() const; - States state() const; - void *user(); - void setUser( void *user ); - - void load( KConfig *cfg, const QString& grp ); - void save( KConfig *cfg, const QString& grp ); - QString formatTime( int seconds ) const; - int timeToSeconds( int hours, int minutes, int seconds ) const; - void secondsToHMS( int secs, int *hours, int *minutes, int *seconds ) const; - - - public slots: - void setDelay( unsigned int sec ); - void setDelay( int sec ); - void setCommand( const QString &cmd ); - void setLoop( bool loop ); - void setOneInstance( bool one ); - void setValue( unsigned int value ); - void setValue( int value ); - void setState( States state ); - - void pause(); - void stop(); - void start(); - - signals: - void stateChanged( KTimerJob *job, States state ); - void delayChanged( KTimerJob *job, unsigned int sec ); - void commandChanged( KTimerJob *job, const QString &cmd ); - void loopChanged( KTimerJob *job, bool loop ); - void oneInstanceChanged( KTimerJob *job, bool one ); - void valueChanged( KTimerJob *job, unsigned int value ); - - void changed( KTimerJob *job ); - void fired( KTimerJob *job ); - void finished( KTimerJob *job, bool error ); - void error( KTimerJob *job ); - - protected slots: - virtual void fire(); - - private slots: - void timeout(); - void processExited(int, QProcess::ExitStatus); - - private: - struct KTimerJobPrivate *d; -}; - - -class KTimerPref : public QDialog, public Ui::PrefWidget -{ - Q_OBJECT - public: - KTimerPref( QWidget *parent=0); - virtual ~KTimerPref(); - - public slots: - void exit(); - void done(int result); - - protected slots: - void add(); - void remove(); - void help(); - void currentChanged( QTreeWidgetItem * , QTreeWidgetItem *); - - void saveJobs( KConfig *cfg ); - void loadJobs( KConfig *cfg ); - void saveAllJobs(); - - private slots: - void jobChanged( KTimerJob *job ); - void jobFinished( KTimerJob *job, bool error ); - void delayChanged(); - - private: - struct KTimerPrefPrivate *d; -}; - -#endif diff --git a/ktimer/main.cpp b/ktimer/main.cpp deleted file mode 100644 index ed21e28a..00000000 --- a/ktimer/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2001 Stefan Schimanski - * - * 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. - */ - -#include -#include -#include -#include - -#include "ktimer.h" - -static const char description[] = - I18N_NOOP("KDE Timer"); - -static const char version[] = "v0.10"; - -int main( int argc, char **argv ) -{ - KAboutData aboutData( "ktimer", 0, ki18n("KTimer"), - version, ki18n(description), KAboutData::License_GPL, - ki18n("(c) 2001, Stefan Schimanski")); - aboutData.addAuthor(ki18n("Stefan Schimanski"),KLocalizedString(), "schimmi@kde.org"); - KCmdLineArgs::init( argc, argv, &aboutData ); - - KApplication app; - app.setQuitOnLastWindowClosed( false ); - - KTimerPref *timer = new KTimerPref; - app.setTopWidget( timer ); - - return app.exec(); -} diff --git a/ktimer/prefwidget.ui b/ktimer/prefwidget.ui deleted file mode 100644 index 96becd48..00000000 --- a/ktimer/prefwidget.ui +++ /dev/null @@ -1,385 +0,0 @@ - - - PrefWidget - - - - 0 - 0 - 563 - 352 - - - - Timer Settings - - - - 11 - - - 6 - - - - - List of countdowns you have set - - - New countdowns are put here. You can add and remove them, and stop and start them. - - - true - - - - Counter - - - - - Delay - - - - - State - - - - - Command - - - - - - - - Add a new task - - - Add a new task to the list. - - - &New - - - - - - - Remove a task - - - Remove a task from the list. - - - &Remove - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - false - - - State - - - - 11 - - - 6 - - - - - Speed up or slow down your countdown - - - You can use this slider to adjust the time. - - - Qt::Horizontal - - - - - - - Time in seconds until command is executed - - - This number is how many seconds are left for the selected countdown. - - - 6 - - - - - - - Pause a countdown - - - Use this to pause a timer countdown. - - - || - - - - - - - Start a countdown - - - Use this to start or restart a countdown. - - - > - - - - - - - Stop a countdown - - - Use this to stop the countdown for a task. - - - = - - - - - - - - - - Detailed help documentation - - - Click here to open the help documentation viewer. - - - - - - - false - - - Settings - - - - 11 - - - 6 - - - - - Check this box if you want your countdown to start over after it finishes - - - Check this box if you want your countdown to start over after it finishes - - - &Loop - - - - - - - Delay: - - - - - - - Enter the seconds here - - - You can change the amount of time in the countdown here. - - - 59 - - - - - - - Check this box if you only want to open one copy of your program - - - Check this box if you only want one instance to open - - - Start only &one instance - - - - - - - seconds - - - - - - - - 0 - 0 - - - - false - - - Command line: - - - - - - - Enter the hours here - - - - - - - Enter the minutes here - - - 59 - - - - - - - hours - - - - - - - minutes - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - 1 - 0 - - - - - 1 - 0 - - - - command you would like to run when time is up - - - Enter a program you would like to run when the countdown is zero - - - true - - - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
- 1 -
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- - m_list - m_add - m_remove - m_commandLine - m_delayH - m_delayM - m_delay - m_loop - m_one - m_start - m_pause - m_stop - m_slider - m_help - - - kseparator.h - - -