Added abandoned KDE3 version of kdirstat

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdirstat@1088039 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
commit b6e09a3a8e

@ -0,0 +1 @@
Stefan Hundhammer <sh@suse.de>

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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

@ -0,0 +1,482 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 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.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, 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 library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, 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 companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Library 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; 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.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

@ -0,0 +1,18 @@
We would like to thank the following people:
- Alexander Rawass <alexannika@users.sourceforge.net> for implementing the
first version of treemaps for KDirStat (this version has been completely
replaced beginning May 2002).
- Ben Shneiderman for his ingenious idea of treemaps as an alternative and
truly intuitive way of visualizing trees.
- All the people at the TU Eindhoven who worked on SequoiaView that gave us the
inspiration for including treemaps in KDirStat and numerous papers describing
the algorithms behind it.
- Harald Fernengel (harry1701@users.sourceforge.net) for continued support for
integrating KDirStat with new Qt versions.
- Toyohiro Asukai <toyohiro@ksmplus.com> for Asian support patches.

@ -0,0 +1,684 @@
2005-01-07 Stefan Hundhammer <sh@suse.de>
* Improved handling of sparse files:
Now adding up only allocated size
* Improved handling of regular files with multiple links:
Now adding up size / no_links per occurence.
This is much closer to what "du" reports.
* Extended "own size" column context menu to show sparse files
and regular files with multiple links
* Reordered "own size" column context menu for consistency: xxx MB (yyy Bytes)
* Removed currently read path from status line while reading:
Much less flicker, no more constant window resizing, improved performance
* Added explanations for sparse files and multiple links to online help
* Bumped version to 2.4.4
2004-12-06 Stefan Hundhammer <sh@suse.de>
* Added "Open with" cleanup upon request by Jarl Friis <jarl@softace.dk>
* Bumped version to 2.4.3
2004-11-23 Stefan Hundhammer <sh@suse.de>
* Migration to KIO slave trash:/ for "move to trash" cleanup
(querying KDE version >= 3.4 at runtime)
* Added configuration update for safer transition from old-style
fixed "*/Trash" paths to "%t" placeholder
* Fixed lots of KDE libs "deprecated" warnings
* Reimported admin/ subdir from a recent KDE version (3.3.0)
* Bumped version to 2.4.2
2004-03-30 Stefan Hundhammer <sh@suse.de>
* Fixed KPacMan rendering in toolbar (thanks to Coolo)
2004-03-01 Stefan Hundhammer <sh@suse.de>
* Updated German translation
2003-11-13 Stefan Hundhammer <sh@suse.de>
* Added Italian translation by Giuliano Colla <colla@copeca.it>
2003-10-29 Stefan Hundhammer <sh@suse.de>
* Applied i18n patch by Toyohiro Asukai <toyohiro@ksmplus.com>
* Updated Japanese translation by Toyohiro Asukai <toyohiro@ksmplus.com>
2003-10-20 Stefan Hundhammer <sh@suse.de>
* Fixed some SuSE-internal Autobuild complaints
* Fixed treemap context menu popup location
* Bumped version to 2.4.1
2003-09-15 Stefan Hundhammer <sh@suse.de>
* Added Hungarian translation contributed by
Marcel Hilzinger <hili@suselinux.hu>
2003-08-26 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.4.0
* Fixed crash on program end while reading directories
* Fixed crash on open dir while still reading another directory
* Added "stop reading" action
* Added German translation contributed by
Christoph Eckert <fmchristoph.eckert@t-online.de>
2003-05-25 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.3.7
* Performance boost: Directory reading is now 16-20 times faster
because much fewer KDirTreeViewItems are cloned during reading
* Using QListViewItem::compare() instead of QListViewItem::key()
for better performance: less string operations / numeric formatting
2003-04-28 Stefan Hundhammer <sh@suse.de>
* Added French translation by Michel Grentzinger <mic.grentz@online.fr>
* Don't add up special files (char/block devices, sockets, FIFOs)
2003-02-03 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.3.6
* Fixed crash on startup when no config file present
2003-02-02 Stefan Hundhammer <sh@suse.de>
* Fixed crash in treemap when deleting subtree with cleanup
* Improved treemap action enabled/disabled state update
2003-01-30 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.3.5
* Colorize treemap tiles (by fixed rules, not customizable yet)
* Added new '%t' cleanup placeholder for the KDE trash directory
* Read jobs are now displayed in the percentage bar column
2003-01-28 Stefan Hundhammer <sh@suse.de>
* User cleanups now have an applicaton-wide keyboard shortcut
(Ctrl-0, Ctrl-1, Ctrl-2, ...)
* Prevent some treemap segfaults when re-reading directories
2003-01-14 Stefan Hundhammer <sh@suse.de>
* Synchronize treemap selection with dir tree after treemap rebuild
2003-01-08 Stefan Hundhammer <sh@suse.de>
* Changed activity point handling: The user was prompted far to
early to send feedback mail.
* Changed treemap double click handling:
Now double clicking the middle button zooms out,
double clicking the right button does nothing
(it pops up the context menu before receiving the second click
anyway)
* Changed help file accordingly
2003-01-07 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.3.4
* Updated admin subdir to latest KDE autoconf / automake stuff
* Gcc 3.x fixes
2003-01-06 Stefan Hundhammer <sh@suse.de>
* Tweaked treemap cushion ridges:
Squarified layout row now gets its own ridge,
no more double /triple ridges for directories
* Changed treemap cushion light source direction from bottom right
to top left
* Moved min/max/default for treemap settings to central header file
* Changed max/default treemap setting values
* Reduced settings dialogs outer borders:
No more accumulated borders
2003-01-04 Stefan Hundhammer <sh@suse.de>
* Added "general" settings page; now user configurable:
- cross file system boundaries
- use local dir read methods
- PacMan animation in toolbar
- PacMan animation ("PacMan armada") in dir tree
* Added "treemap" settings page: now user configurable:
- plain vs. cushion treemap
- squarified vs. simple treemap
- ambient light
- height scale factor
- force grid
- draw lines upon low contrast
- plain (non-cushioned) treemap colors
- highlight rectangle color
- minimum tile size
- auto-resize treemap
* Added "open URL" in "file" menu for easier access to remote URLs
* Bumped version to 2.3.3
2003-01-01 Stefan Hundhammer <sh@suse.de>
* Added treemap actions
* Added treemap menu
* Added treemap context menu
* Improved treemap integration into main application
* Added online help for treemaps
2002-12-31 Stefan Hundhammer <sh@suse.de>
* Lots of small fiddling with treemaps
2002-12-28 Stefan Hundhammer <sh@suse.de>
* Implemented cushion treemaps
* Bumped version to 2.3.2-devel
* Changed treemap selection mechanism:
Now using a transparent separate rectangle so even the outline
of entire directories can clearly be seen.
2002-12-27 Stefan Hundhammer <sh@suse.de>
* Added treemap mouse operations:
- select item in tree view (single click left)
- zoom in (double-click left)
- zoom out (double-click right)
- rebuild treemap in visible area (double-click middle)
* Added visible selection in treemap
* Select treemap tile when tree item is selected
2002-12-26 Stefan Hundhammer <sh@suse.de>
* Implemented squarified treemaps.
Now there are no longer lots of elongated, thin rectangles that
are hard to compare against each other and hard to point at.
2002-12-23 Stefan Hundhammer <sh@suse.de>
* Changed treemap handling completely: Now using QCanvas.
* Bumped version to 2.3.1-devel
2002-05-12 Stefan Hundhammer <sh@suse.de>
* Initial version of new treemaps
* Communication between treemap view and tree view
* Bumped version to 2.3.0-devel
2002-05-10 Stefan Hundhammer <sh@suse.de>
* Removed support for old treemaps
* Updated build-howto.html
2002-05-09 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.2.0
The KDE3 port proved stable enough to warrant a new stable
version.
2002-04-23 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.1.1-beta
* Added Japanese translation by
Toyohiro Asukai <toyohiro@ksmplus.com>
* Applied another Asian lang support patch by
Toyohiro Asukai <toyohiro@ksmplus.com>:
QString::sprintf() -> QString::arg()
2002-04-22 Stefan Hundhammer <sh@suse.de>
* Applied Asian language support patch by
Toyohiro Asukai <toyohiro@ksmplus.com>:
Somme missing QString::fromLocal8Bit() issues
2002-04-18 Stefan Hundhammer <sh@suse.de>
* KDE-3 migration:
- Replaced admin/ subdirectory completely
* Bumped version to 2.1.0-beta
2002-03-01 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.0.1
* Added large file (>2GB) support
2002-02-24 Stefan Hundhammer <sh@suse.de>
* Bumped version to 2.0.0 - the real release version
* Completed help texts
* Added "Help" button to feedback dialog
* Added "Help" button to settings dialog
* Drastically reduced logging to stdout
2002-02-11 Stefan Hundhammer <sh@suse.de>
* Prevent crash: Disable cleanups that modify the subtree while it
is still being read
2002-02-10 Stefan Hundhammer <sh@suse.de>
* Fixed double slashes in URLs when opening with file selection box
* Bumped version to 1.8.7-rc2
2002-02-09 Stefan Hundhammer <sh@suse.de>
* Fixed huge numbers overflow in details context popup
* Fixed huge numbers sorting
* Added new action "continue reading at mount point".
This is essentially the same as "refreshing selected branch",
but it's more intuitive to use.
2002-02-02 Stefan Hundhammer <sh@suse.de>
* Initial help documentation
* Bumped version to 1.8.6-rc1
This is the first release candidate.
The final version will be released as 2.0
2002-01-27 Stefan Hundhammer <sh@suse.de>
* Fixed update bug upon "refresh branch" and executing cleanups
* Embed cleanup %p / %n parameters in double quotes
* Added keyboard accelerators for standard cleanups
* (Partial) fix for PacMan animation display error on some KDE themes
* Bumped version to 1.8.5-beta
2002-01-19 Stefan Hundhammer <sh@suse.de>
* Added feedback mail facility
* Bumped version to 1.8.4-beta
2002-01-10 Stefan Hundhammer <sh@suse.de>
* Fixed repaint error in percentage bar column when scrolling
* Fixed repaint error when resizing percentage bar column
2002-01-04 Stefan Hundhammer <sh@suse.de>
* Bumped version to 1.8.3-beta
The new KDirStat is now as complete as the old one ever was!
* Added simple 'mail to owner' report
* Implemented cleanup configuration
* Added 'ask for confirmation' flag to cleanups
* Added 'works for local files only' flag to cleanups
* Fixed URL handling: Always strip off trailing slash
* Fixed app icon
* Fixed .desktop file - KDirStat is now in 'Utilities'
2002-01-03 Stefan Hundhammer <sh@suse.de>
* Implemented save/read configuration
* Updated TODO list - gosh, was this thing outdated!
* kdDebug() operator << for KCleanup
* kdDebug() operator << for KDirTreeViewItem
2002-01-02 Stefan Hundhammer <sh@suse.de>
* Implemented 'settings' dialog
* Implemented 'tree colors' settings
2002-01-01 Stefan Hundhammer <sh@suse.de>
* Implemented / completed KCleanupCollection
* Fixed some core dumps (oops)
2001-12-31 Stefan Hundhammer <sh@suse.de>
* kdDebug() operator<< for KFileInfo
2001-12-30 Stefan Hundhammer <sh@suse.de>
* Bumped version to 1.8.2-beta
* Cleanups are back!
2001-12-26 Stefan Hundhammer <sh@suse.de>
* Mount point remains marked as mount point even after
"refresh selected branch"
* KFileInfo / KDirInfo now have direct access to their
KDirTree (i.e. they now have their own pointer)
=> transparent access from outside easier
2001-12-08 Stefan Hundhammer <sh@suse.de>
* Tree colors are back again
* Transparently handle selections in the KDirTree;
all kinds of views should benefit from that.
2001-11-25 Stefan Hundhammer <sh@suse.de>
* Bumped version to 1.8.0-beta
* Added "Refresh selected" to main + context menu
* Implemented refreshing a single branch
* Many internal changes to enable deleting subtrees
(this is a requirement for cleanups)
* Internal cleanup: Got rid of that statRoot() mess,
clean ??::stat() implementation for all directory readers
2001-11-18 Stefan Hundhammer <sh@suse.de>
* Bumped version to 1.7.11-devel
* Improved mount point handling:
* Different icon,
* New read status KDirOnRequestOnly
* Prepared for explicit reading of mounted file systems
* Created infrastructure for context menu in tree view
* Simple context menu (cleanup actions will follow)
2001-11-17 Stefan Hundhammer <sh@suse.de>
* Moved treemap sources to separate subdirectory to prevent that
too-clever admin/am_edit script from breaking things: It always
uses all available sources rather than just those in
Makefile.am.
* Changed default from --enable-treemaps to --disable-treemaps
since treemaps don't compile and link for more than 6 weeks now.
* Updated build-howto.html
2001-10-22 Harald Fernengel (harry1701@users.sourceforge.net)
* make it work with Qt 3 / KDE 3
2001-09-26 Alexander Rawass <alexannika@users.sourceforge.net>
* committed Makefile.am from kdirstat-1-7-10-devel
2001-09-26 Alexander Rawass <alexannika@users.sourceforge.net>
* debugging output in kparts
2001-09-25 Alexander Rawass <alexannika@users.sourceforge.net>
* added files kdirstat_{part,factory}.{cpp,h,rc}
* trying to make a kpart of kdirstat
* libtool does not work for me yet
2001-08-20 Alexander Rawass <alexannika@users.sourceforge.net>
* modified configure.in.in to test for libqtreemap
test may not work on some/most systems
2001-08-18 Alexander Rawass <alexannika@users.sourceforge.net>
* V1.7.8-devel
* added kdirstat.spec (to build rpms)
* released kdirstat-1.7.8-1.i386.rpm
2001-08-17 Alexander Rawass <alexannika@users.sourceforge.net>
* removed files q*{cpp,h} from cvs
* removed doc/treemaps from cvs
* modified configure.in and kdirstat/Makefile.am
* QTreeMap is now in it's own cvs qtreemap.sourceforge.net
2001-08-11 Alexander Rawass <alexannika@users.sourceforge.net>
* QTreeMap can write data files for 'HypView',
a hyperbolic tree browser
2001-08-09 Alexander Rawass <alexannika@users.sourceforge.net>
* changed all size-functions from int to asize/float
* qxmltreemap: if a node has got an empty attribute 'size',
the size is calculated recursively
* new files & classes
qlistviewtreemapwindow.cpp
qlistviewtreemapwindow.h
qlistviewtreemaparea.cpp
qlistviewtreemap.h
qxmltreemapviewer.cpp
* files q*treemap* are built as a library libqtreemap
* new qxmltreemapviewer binary:
stand-alone QT/Xml Treemap Viewer
* QTreeMap/QListViewTreeMapArea works fine with KProf
2001-08-09 Stefan Hundhammer <sh@suse.de>
* Added "credits" section in about box
2001-08-08 Stefan Hundhammer <sh@suse.de>
* Implemented iterator classes: KFileInfoIterator and
KFileInfoSortedIterator
* Added CREDITS file
2001-08-06 Stefan Hundhammer <sh@suse.de>
* Fixed segfaults due to bad dot entry cleanup (huh? ;-) ) that
had caused core dumps after finishing reading small trees
2001-08-05 Alexander Rawass <alexannika@users.sourceforge.net>
* compiler warnings removed
* using List of Objects (instead List of KDirInfo)
* Bug: regexps not working in xml-window
selection not working in xml-window
* removed dependencies to KDirStat from QTreeMap
2001-07-29 Alexander Rawass <alexannika@users.sourceforge.net>
* load XML working (with memory hole)
2001-07-28 Alexander Rawass <alexannika@users.sourceforge.net>
* new sort of treemap/drawing mode: piemap
added file qtreemaparea_piemap.cpp
will not get checked in until legal problems solved
* checkmarks work also for paintmode
* new options for piemap mode
* bitmap can be saved to a file
* tree can be saved as xml file
* new files & classes
qxmltreemapwindow.cpp
qxmltreemapwindow.h
qxmltreemaparea.cpp
qxmltreemap.h
(don't work yet)
* new defines for compilation:
HAVE_PIEMAP if you have the piemap source
EXPERIMENTAL if you want to see more options
2001-07-17 Alexander Rawass <alexannika@users.sourceforge.net>
* user can use keywords instead of numbers for options
* checkmarks start working
* yet only with drawmode
2001-07-16 Alexander Rawass <alexannika@users.sourceforge.net>
* user can now use regexps or wildcards in config
* regexps are now compiled only once at startup
* wildcards are working correctly
* regexps need 3 /// backslashes in kdirstatrc
* Feature: the color list is parsed in alphabetic sort
2001-07-14 Alexander Rawass <alexannika@users.sourceforge.net>
* KDirTreeMapWindow reads out configuration with KConfig
* Bug: regexps are not working correctly
2001-07-13 Alexander Rawass <alexannika@users.sourceforge.net>
* user can click on rectangles and select/deselect them
* those rectangles are stored in a list and appear
at the bottom of the right-button popupmenu
2001-07-12 Alexander Rawass <alexannika@users.sourceforge.net>
* user can search for regexp, matches get highlighted
* current_dir_display working again
2001-07-11 Alexander Rawass <alexannika@users.sourceforge.net>
* new shading: image (sensible only with squarify)
displays pictures, can be used as picture browser
* removed most warnings
2001-07-11 Alexander Rawass <alexannika@users.sourceforge.net>
* various bugs fixed in squarified treemaps:
correct end of recursion
using floats rather than ints to prevent miscalc.
should work now????
* new hierarchical shadings
2001-07-10 Alexander Rawass <alexannika@users.sourceforge.net>
* implemented squarified treemaps (experimental, buggy)
* new file added: qtreemaparea_squarify.cpp
* Bug: when zooming in too much, the paintarea takes up too much
memory -> X swaps till death
2001-07-05 Alexander Rawass <alexannika@users.sourceforge.net>
* more options and exp. shadings
* experimental dynamic shading (not working)
* user can watch treemap build up
* paintEntry moved to qtreemaparea_paint.cpp
* drawTreeMap,drawDuTree,CTM moved to qtreemaparea_recursion.cpp
* renamed some of the shadings and
* wrote some Documentation how to use Shadings and Options
2001-07-03 Alexander Rawass <alexannika@users.sourceforge.net>
* QTreeMapWindow is now an abstract class
* KDirTreeMapWindow implements makeTreeMapWidget()
* experimental hierach. cushion
* new menu options (experimental & debugging)
* new way to make a border (border_step)
* CTM (Cushion Treemap) test routine added (not working yet)
* new Bug: I'm getting warnings about wrong RGB parameters,
even in flat mode
2001-07-01 Alexander Rawass <alexannika@users.sourceforge.net>
* QTreeMapArea is now a general abstract class to display hierarchies of any kind (not connected to KDirStat anymore)
* KDirTreeMapArea is the implementation for KDirStat
* new Bug: signals/slot not working correctly
* Bug fixed: crashed when telling kdirstat to display a directory which does not exist
2001-06-29 Stefan Hundhammer <sh@suse.de>
* Moved CVS to SourceForge
2001-06-24 Alexander Rawass <alexannika@users.sourceforge.net>
* V1.7.6-Devel
* Removed Zoom Bug
* Removed DM_FILES Bug
* Faster shading (dirs are always drawn flat)
* New directory coloring (shades of grey)
* Options for start direction, border width, draw text
* Removed most compiler warnings
2001-06-18 Stefan Hundhammer <sh@suse.de>
* V1.7.3-Devel
* Applied first treemap patch from
Alexander Rawass <alexannika@users.sourceforge.net>
* Added Alexander Rawass to authors list
* Improved treemap repaint behaviour (not perfect yet)
2001-06-17 Stefan Hundhammer <sh@suse.de>
* V1.7.2-Alpha
* Implemented support for all of KDE's IO protocols (ftp, smb, ...)
* Fixed PacMan warnings on premature exit

@ -0,0 +1,167 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

@ -0,0 +1,48 @@
# Toplevel Makefile.am for KDirStat
#
# Originally generated by KDevelop, modified by sh@suse.de
#
SUBDIRS = kdirstat po doc
EXTRA_DIST = \
AUTHORS \
COPYING \
COPYING.LIB \
CREDITS \
ChangeLog \
INSTALL \
README \
TODO \
admin \
build-howto.html \
kdirstat.kdevprj \
kdirstat.lsm
# This is not a GNU package. You can remove this line
# if have all needed files a GNU package needs.
AUTOMAKE_OPTIONS = foreign
CLEANFILES = $(wildcard autom4te.cache/*)
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
$(top_srcdir)/subdirs:
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
package-messages:
$(MAKE) -f admin/Makefile.common package-messages
$(MAKE) -C po merge
dist-hook:
cd $(top_distdir) && perl admin/am_edit -padmin
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs

@ -0,0 +1,14 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
@if test ! -d admin; then \
echo "Please recheckout this module!" ;\
echo "for cvs: use checkout once and after that update again" ;\
echo "for cvsup: checkout kde-common from cvsup and" ;\
echo " link kde-common/admin to ./admin" ;\
exit 1 ;\
fi
$(MAKE) -f admin/Makefile.common cvs
.SILENT:

@ -0,0 +1,14 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
@if test ! -d admin; then \
echo "Please recheckout this module!" ;\
echo "for cvs: use checkout once and after that update again" ;\
echo "for cvsup: checkout kde-common from cvsup and" ;\
echo " link kde-common/admin to ./admin" ;\
exit 1 ;\
fi
$(MAKE) -f admin/Makefile.common cvs
.SILENT:

@ -0,0 +1,20 @@
This is a graphical "du" (disk usage) display.
What you see here is a 90% rewrite - GUI, engine, everything. The one thing it
can do a whole lot better than the old version is stay on one file system - the
single most most requested feature. Plus, it's way faster for large directory
trees - scanning an entire Linux file system no longer takes 30+
minutes. Rather, it's about 2-3 minutes: The old version seemed to have
problems with system buffer thrashing due to too many directories open for
reading at one time - the new version uses an internal queue and keeps only one
directory open.
For more details, see the KDirStat home page at
http://kdirstat.sourceforge.net/
Stefan Hundhammer <sh@suse.de>
2002-05-10

52
TODO

@ -0,0 +1,52 @@
TODO list for KDirStat
========================
Updated: 2005-01-07
- help text for "treemap" settings
- help text for "general" settings
- update screen shots in online help (no treemaps yet)
- make KDirStat a KPart
Maybe:
======
- German help file
- Animation other than pacman (optional?)
- configure mail report texts (the user gets an editor in the mailer anyway)
- 'kdf' like 'disk free' display for file system of current tree - pie, bar graph?
Steal that thing from the SuSE YaST2 package manager UI I wrote?
(which, in turn, I stole in large parts from KDirStat)
- Filter on tree view: by user, by mtime, by size
- Select items in the tree view as "special interest" for further processing in mail reports
- Manually mark dir subtrees as "static" - e.g., for system directories that
almost never change anyway; scan them just once and save their sizes to file;
only rescan those subtrees on explicit user request
- Automagically mark such subtrees by mtime and/or a hardwired list
Postponed until further notice:
===============================
- write scanned trees to cache file for later reuse;
use this cache file first and then begin scanning the dir tree.
Since the Linux 2.4 kernel is great at caching directory entries,
this isn't really necessary for Linux - and I am a Linux guy...
;-)

File diff suppressed because it is too large Load Diff

1045
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,191 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Building KDirStat for KDE 3.x</title>
</head>
<body bgcolor=#F0F0F0>
<table width=100%>
<tr>
<td width=50% align=left>
Last modified: 23 Nov 2004
</td>
<td width=50% align=right>
Contact: <a href="mailto:sh@suse.de?subject=KDirStat build-howto">Stefan Hundhammer</a>
</td>
</tr>
</table>
<h1 align=center>Building KDirStat for KDE 3.x</h1>
<table width=100% bgcolor=#B0B0F0>
<tr><td><h2>Note:</h2></td></tr>
<tr><td>
If you are using the
latest
<a href="http://www.suse.com/">SuSE Linux</a>
, you may not have to build it at all.
There usually is an RPM package you can use at the
<a href="http://kdirstat.sourceforge.net/download/">download area</a>.
See also the <a href="http://kdirstat.sourceforge.net/">KDirStat home page</a>.
</td></tr>
</table>
<ul>
<li>
Get the latest sources - either the
<a href="http://kdirstat.sourceforge.net/download/">tarball from the download area</a>
or via
<a href="http://sourceforge.net/cvs/?group_id=30290">anonymous CVS from SourceForge.</a>
<p><br></p>
</li>
<li>
Make sure you have a development system up and running.
<p>
You'll need at least:
<ul>
<li>A C++ compiler
<li>Header files for the system libs
<li>X11 development environment (libs and header files)
<li>Qt 3.0 (or later) development environment
<li>KDE 3.x development environment
</ul>
<p>
- maybe more. If you are unsure and you are running SuSE Linux, it might be
a good idea to install the <em>development system</em> selection.
</p>
<p>
Please understand that I cannot and will not fix everybody's broken development
systems any more - this had taken me quite some time with KDirStat 0.8x. Please
make sure you can compile simple KDE programs like <em>kless</em> or
<em>kexample</em> before contacting me about build problems.
</p>
</li>
<br>
<li>Unpack the sources:
<br>
<pre>
tar xjvf kdirstat-2.4.2.tar.bz2
</pre>
<p>
(or whatever version you downloaded)
</p>
<p><br></p>
</li>
<li>
Go to this directory:
<br>
<pre>
cd kdirstat-2.4.2
</pre>
</li>
<li>
Make sure I didn't accidentially include a <em>config.cache</em> file in the
tarball - remove it to make sure. This is a neverending cause of trouble.
<br>
<pre>
rm -f config.cache
</pre>
</li>
<li>
Let the <em>configure</em> script figure out where everything required is on
your system.
<p>
Watch out for error messages and <b>fix them</b> before reporting
errors!
</p>
<p>On SuSE Linux systems, KDE 3.x is installed to <em>/opt/kde3</em> which is a
good idea if you want to keep some KDE 1.x/2.x programs around. So use that
<em>/opt/kde3</em> prefix for KDirStat, too - otherwise it will be installed to
<em>/opt/kde</em> and clutter up a working KDE 1.x/2.x environment.
<br>
<pre>
./configure --prefix=/opt/kde3
</pre>
<p>
If you don't care about that or if you set up KDE 3.x in <em>/opt/kde</em>
anyway, simply type
</p>
<pre>
./configure
</pre>
</li>
<li>
Compile everything:
<br>
<pre>
make
</pre>
<p>
Again, watch out for error messages.
</p>
<p>
<br>
</p>
</li>
<li>
If everything worked out allright, become <em>root</em> and install the program
and everything it needs:
<br>
<pre>
su
make install
</pre>
<p>
<b>Don't do this if the previous step reported errors!</b>
</p>
</li>
</ul>
<p>
That's it.
</p>
</body>
</html>
<!-- --- Emacs Customization --- -->
<!-- -->
<!-- Local Variables: -->
<!-- time-stamp-format: "%02d %3b %04y" -->
<!-- time-stamp-start: "Last modified:[ \t]+" -->
<!-- time-stamp-end: "$" -->
<!-- End: -->

@ -0,0 +1,243 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if you have the CoreAudio API */
#undef HAVE_COREAUDIO
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
/* Defines if your system has the crypt function */
#undef HAVE_CRYPT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have libjpeg */
#undef HAVE_LIBJPEG
/* Define if you have libpng */
#undef HAVE_LIBPNG
/* Define if you have a working libpthread (will enable threaded code) */
#undef HAVE_LIBPTHREAD
/* Define if you have libz */
#undef HAVE_LIBZ
/* Define if you have long long as datatype */
#undef HAVE_LONG_LONG
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if your system needs _NSGetEnviron to set up the environment */
#undef HAVE_NSGETENVIRON
/* Define if you have res_init */
#undef HAVE_RES_INIT
/* Define if you have the res_init prototype */
#undef HAVE_RES_INIT_PROTO
/* Define if you have a STL implementation by SGI */
#undef HAVE_SGI_STL
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have strlcat */
#undef HAVE_STRLCAT
/* Define if you have the strlcat prototype */
#undef HAVE_STRLCAT_PROTO
/* Define if you have strlcpy */
#undef HAVE_STRLCPY
/* Define if you have the strlcpy prototype */
#undef HAVE_STRLCPY_PROTO
/* Define to 1 if you have the <sys/bitypes.h> header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Suffix for lib directories */
#undef KDELIBSUFF
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of a `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* The size of a `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Defined if compiling without arts */
#undef WITHOUT_ARTS
/*
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
* headers and I'm too lazy to write a configure test as long as only
* unixware is related
*/
#ifdef _UNIXWARE
#define HAVE_BOOLEAN
#endif
/*
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
* that defines bzero.
*/
#if defined(_AIX)
#include <strings.h>
#endif
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
# include <sys/time.h>
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
#if !defined(HAVE_RES_INIT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int res_init(void);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcat(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCPY_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcpy(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/*
* On HP-UX, the declaration of vsnprintf() is needed every time !
*/
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
#if __STDC__
#include <stdarg.h>
#include <stdlib.h>
#else
#include <varargs.h>
#endif
#ifdef __cplusplus
extern "C"
#endif
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
#ifdef __cplusplus
extern "C"
#endif
int snprintf(char *str, size_t n, char const *fmt, ...);
#endif
#if defined(__SVR4) && !defined(__svr4__)
#define __svr4__ 1
#endif
/* type to use in place of socklen_t if not defined */
#undef kde_socklen_t
/* type to use in place of socklen_t if not defined (deprecated, use
kde_socklen_t) */
#undef ksize_t

@ -0,0 +1,2 @@
./admin/configure.in.min
configure.in.in

@ -0,0 +1,109 @@
dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================
dnl This file is part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(kdirstat, 2.4.4) dnl searches for some needed programs
KDE_SET_PREFIX
dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL
dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS
dnl KDE_USE_QT
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================
#MIN_CONFIG
dnl PACKAGE set before
AC_SYS_LARGEFILE
KDE_CHECK_LONG_LONG
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ kdirstat/Makefile ])
AC_CONFIG_FILES([ kdirstat/pics/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_OUTPUT
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
# And if so, warn when they don't match
if test "$kde_libs_prefix" != "$given_prefix"; then
# And if kde doesn't know about the prefix yet
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
if test $? -ne 0; then
echo ""
echo "Warning: you chose to install this package in $given_prefix,"
echo "but KDE was found in $kde_libs_prefix."
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
echo "Then restart KDE."
echo ""
fi
fi
fi
if test "$all_tests" = "bad"; then
if test ! "$cache_file" = "/dev/null"; then
echo ""
echo "Please remove the file $cache_file after changing your setup"
echo "so that configure will find the changes next time."
echo ""
fi
else
echo ""
echo "Good - your configure finished. Start make now"
echo ""
fi

@ -0,0 +1,6 @@
#MIN_CONFIG
AM_INIT_AUTOMAKE(kdirstat,2.4.4)
AC_SYS_LARGEFILE
KDE_CHECK_LONG_LONG

@ -0,0 +1,2 @@
SUBDIRS = en

@ -0,0 +1,11 @@
EXTRA_DIST = \
index.docbook \
kdirstat-main.png \
kdirstat-config-cleanups.png \
kdirstat-config-tree-colors.png \
feedback-mail.png
KDE_LANG = en
KDE_DOCS = kdirstat

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,153 @@
[AUTHORS]
dist=true
install=false
install_location=
type=DATA
[COPYING]
dist=true
install=false
install_location=
type=DATA
[ChangeLog]
dist=true
install=false
install_location=
type=DATA
[Config for BinMakefileAm]
bin_program=kdirstat
cxxflags=-O0 -g3 -Wall
ldadd=$(LIB_KFILE) -lkdeui -lkdecore $(LIB_QT)
ldflags=
[General]
AMChanged=false
author=Stefan Hundhammer
configure_args=--with-qt-dir=/usr/lib/qt2 --prefix=/opt/kde2
email=sh@suse.de
kdevprj_version=1.3
lfv_open_groups=
makefiles=Makefile.am,kdirstat/Makefile.am,doc/Makefile.am,doc/en/Makefile.am,po/Makefile.am
project_name=KDirStat
project_type=normal_kde2
sgml_file=/work/home/sh/kde2/kdirstat/doc/en/index.docbook
sub_dir=kdirstat/
version=1.1
version_control=None
workspace=1
[INSTALL]
dist=true
install=false
install_location=
type=DATA
[LFV Groups]
GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS
Headers=*.h,*.hh,*.hxx,*.hpp,*.H
Others=*
Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l
Translations=*.po
B_KFILEUser Interface=*.kdevdlg,*.ui,*.rc
groups=Headers,Sources,User Interface,Translations,GNU,Others
[Makefile.am]
files=kdirstat.kdevprj,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,kdirstat.lsm
sub_dirs=kdirstat,po,doc
type=normal
[README]
dist=true
install=false
install_location=
type=DATA
[TODO]
dist=true
install=false
install_location=
type=DATA
[Workspace_1]
browser_file=file:/opt/kde2/share/doc/HTML/default/kdevelop/kde_libref/index.html
cpp_file=/work/home/sh/kde2/kdirstat/kdirstat/kdirstat.cpp
header_file=/work/home/sh/kde2/kdirstat/AUTHORS
openfiles=Untitled.h,Untitled.cpp,/work/home/sh/kde2/kdirstat/kdirstat/kdirstat.h,/work/home/sh/kde2/kdirstat/COPYING,/work/home/sh/kde2/kdirstat/COPYING.LIB,/work/home/sh/kde2/kdirstat/AUTHORS,/work/home/sh/kde2/kdirstat/kdirstat/kdirstat.cpp,/work/home/sh/kde2/kdirstat/kdirstat/kdirtree.cpp
show_outputview=true
show_treeview=true
[doc/Makefile.am]
sub_dirs=en
type=normal
[doc/en/Makefile.am]
files=doc/en/index.docbook
sub_dirs=
type=normal
[doc/en/index.docbook]
dist=true
install=false
install_location=$$(kde_icondir)/locolor/16x16/apps/kdirstat.png
type=DATA
[kdirstat.kdevprj]
dist=true
install=false
install_location=
type=DATA
[kdirstat.lsm]
dist=true
install=false
install_location=
type=DATA
[kdirstat/Makefile.am]
files=kdirstat/main.cpp,kdirstat/kdirstat.cpp,kdirstat/kdirstat.h,kdirstat/kdirstatdoc.cpp,kdirstat/kdirstatdoc.h,kdirstat/kdirstatview.cpp,kdirstat/kdirstatview.h,kdirstat/kdirstatui.rc,kdirstat/kdirstat.desktop,kdirstat/lo32-app-kdirstat.png,kdirstat/lo16-app-kdirstat.png
sub_dirs=
type=prog_main
[kdirstat/kdirstat.cpp]
dist=true
install=false
install_location=
type=SOURCE
[kdirstat/kdirstat.desktop]
dist=true
install=true
install_location=$$(kde_appsdir)/Applications/kdirstat.desktop
type=DATA
[kdirstat/kdirstat.h]
dist=true
install=false
install_location=
type=HEADER
[kdirstat/kdirstatdoc.cpp]
dist=true
install=false
install_location=
type=SOURCE
[kdirstat/kdirstatdoc.h]
dist=true
install=false
install_location=
type=HEADER
[kdirstat/kdirstatui.rc]
dist=true
install=false
install_location=
type=DATA
[kdirstat/kdirstatview.cpp]
dist=true
install=false
install_location=
type=SOURCE
[kdirstat/kdirstatview.h]
dist=true
install=false
install_location=
type=HEADER
[kdirstat/lo16-app-kdirstat.png]
dist=true
install=true
install_location=$$(kde_icondir)/locolor/16x16/apps/kdirstat.png
type=DATA
[kdirstat/lo32-app-kdirstat.png]
dist=true
install=true
install_location=$$(kde_icondir)/locolor/32x32/apps/kdirstat.png
type=DATA
[kdirstat/main.cpp]
dist=true
install=false
install_location=
type=SOURCE
[po/Makefile.am]
sub_dirs=
type=po

@ -0,0 +1,14 @@
Begin3
Title: KDirStat
Version: 1.8.6-rc1
Entered-date: 2001-06-29
Description: Grapical 'du' (disk usage) utility for KDE 2.x
Keywords: disk usage, file system, cleanup
Author: Stefan Hundhammer <sh@suse.de>
Maintained-by: Stefan Hundhammer <sh@suse.de>
Primary-site: http://kdirstat.sourceforge.net/
Home-page: http://kdirstat.sourceforge.net/
Original-site: http://kdirstat.sourceforge.net/
Platforms: Linux and other Unices
Copying-policy: GNU Public License
End

@ -0,0 +1,70 @@
#
# spec file for package kdirstat (Version 2.4.4)
#
# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#
# norootforbuild
# neededforbuild kde3-devel-packages
BuildRequires: aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cracklib cvs cyrus-sasl db devs diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv klogd less libacl libattr libgcc libnscd libselinux libstdc++ libxcrypt libzio m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-modules patch permissions popt procinfo procps psmisc pwdutils rcs readline sed strace syslogd sysvinit tar tcpd texinfo timezone unzip util-linux vim zlib zlib-devel arts arts-devel autoconf automake binutils expat fam fam-devel fontconfig fontconfig-devel freeglut freeglut-devel freetype2 freetype2-devel gcc gcc-c++ gdbm gettext glib2 glib2-devel gnome-filesystem jack jack-devel kdelibs3 kdelibs3-devel kdelibs3-doc libart_lgpl libart_lgpl-devel libgcrypt libgcrypt-devel libgpg-error libgpg-error-devel libidn libidn-devel libjpeg libjpeg-devel liblcms liblcms-devel libmng libmng-devel libpng libpng-devel libstdc++-devel libtiff libtiff-devel libtool libxml2 libxml2-devel libxslt libxslt-devel openssl-devel pcre pcre-devel perl python qt3 qt3-devel rpm unsermake update-desktop-files xorg-x11-Mesa xorg-x11-Mesa-devel xorg-x11-devel xorg-x11-libs
Name: kdirstat
URL: http://kdirstat.sourceforge.net
License: GPL
Group: Productivity/File utilities
Summary: Graphical Directory Statistics for Used Disk Space
Version: 2.4.4
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: kdirstat-%{version}.tar.bz2
%description
KDirStat (KDE Directory Statistics) is a utility program that sums up
disk usage for directory trees - very much like the Unix 'du' command.
It can also help you clean up used space.
Authors:
--------
Stefan Hundhammer <sh@suse.de>
%prep
%setup -q
. /etc/opt/kde3/common_options
update_admin --no-unsermake
%build
. /etc/opt/kde3/common_options
./configure $configkde --disable-final
make
%install
. /etc/opt/kde3/common_options
make DESTDIR=$RPM_BUILD_ROOT $INSTALL_TARGET
%suse_update_desktop_file %name Filesystem
%find_lang %name
%files -f %name.lang
%defattr(-,root,root)
%doc COPYING AUTHORS ChangeLog TODO README
/opt/kde3/bin/kdirstat
/opt/kde3/share/apps/kdirstat
/opt/kde3/share/appl*/*/kdirstat*
/opt/kde3/share/doc/HTML/*/kdirstat/
%dir /opt/kde3/share/icons/hicolor/16x16
%dir /opt/kde3/share/icons/hicolor/16x16/apps
%dir /opt/kde3/share/icons/hicolor/32x32
%dir /opt/kde3/share/icons/hicolor/32x32/apps
%dir /opt/kde3/share/icons/locolor/16x16/apps
%dir /opt/kde3/share/icons/locolor/32x32/apps
/opt/kde3/share/icons/??color/??x??/*/kdirstat*
%dir /opt/kde3/share/apps/kconf_update
/opt/kde3/share/apps/kconf_update/kdirstat.upd
/opt/kde3/share/apps/kconf_update/fix_move_to_trash_bin.pl

@ -0,0 +1,98 @@
# Makefile.am for kdirstat/kdirstat
#
# Initially generated by KDevelop, cleaned up by <sh@suse.de>
SUBDIRS = pics
bin_PROGRAMS = kdirstat
kdirstat_SOURCES = \
kdirstatmain.cpp \
kdirstatapp.cpp \
kdirstatfeedback.cpp \
kfeedback.cpp \
kdirtreeview.cpp \
kdirtreeiterators.cpp \
kdirtree.cpp \
ktreemapview.cpp \
ktreemaptile.cpp \
kcleanup.cpp \
kstdcleanup.cpp \
kcleanupcollection.cpp \
kdirstatsettings.cpp \
kdirsaver.cpp \
kactivitytracker.cpp \
kpacman.cpp
noinst_HEADERS = \
kdirstatapp.h \
kfeedback.h \
kdirtreeview.h \
kdirtreeiterators.h \
kdirtree.h \
ktreemapview.h \
ktreemaptile.h \
kcleanup.h \
kstdcleanup.h \
kcleanupcollection.h \
kdirstatsettings.h \
kdirsaver.h \
kactivitytracker.h \
kpacman.h
EXTRA_DIST = \
kdirstatui.rc \
kdirstat.desktop \
lo32-app-kdirstat.png \
lo16-app-kdirstat.png \
hi32-app-kdirstat.png \
hi16-app-kdirstat.png
updatedir = $(kde_datadir)/kconf_update
update_DATA = kdirstat.upd
update_SCRIPTS = fix_move_to_trash_bin.pl
kdirstat_LDADD = $(LIB_KFILE)
KDE_ICON = kdirstat
applnkdir = $(kde_appsdir)/Utilities
applnk_DATA = kdirstat.desktop
####### kdevelop will overwrite this part!!! (end)############
# this 10 paths are KDE specific. Use them:
# kde_htmldir Where your docs should go to. (contains lang subdirs)
# kde_appsdir Where your application file (.kdelnk) should go to.
# kde_icondir Where your icon should go to.
# kde_minidir Where your mini icon should go to.
# kde_datadir Where you install application data. (Use a subdir)
# kde_locale Where translation files should go to.(contains lang subdirs)
# kde_cgidir Where cgi-bin executables should go to.
# kde_confdir Where config files should go to.
# kde_mimedir Where mimetypes should go to.
# kde_toolbardir Where general toolbar icons should go to.
# kde_wallpaperdir Where general wallpapers should go to.
# set the include path for X, qt and KDE
INCLUDES= $(all_includes)
METASOURCES = AUTO
# the library search path.
kdirstat_LDFLAGS = $(all_libraries) $(KDE_RPATH)
rcdir = $(kde_datadir)/kdirstat
rc_DATA = kdirstatui.rc
messages: rc.cpp
LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
if test -n "$$LIST"; then \
$(XGETTEXT) $$LIST -o $(podir)/kdirstat.pot; \
fi

@ -0,0 +1,9 @@
#!/usr/bin/perl
#
# Replace ~/KDesktop/Trash to %t
#
while( <> )
{
s:~?\S*/\S*Trash\S*:%t: if ( /^\s*command\s*=\s*kfmclient\s+move/ );
print $_;
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,93 @@
/*
* File name: kactivitytracker.cpp
* Summary: Utility object to track user activity
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#include <kapp.h>
#include <kdebug.h>
#include <kconfig.h>
#include "kactivitytracker.h"
KActivityTracker::KActivityTracker( QObject * parent,
const QString & id,
long initialThreshold )
: QObject( parent )
{
_id = id;
KConfig * config = kapp->config();
config->setGroup( _id );
_sum = config->readNumEntry( "activityPoints", 0 );
_lastSignal = config->readNumEntry( "lastSignal" , 0 );
_threshold = config->readNumEntry( "threshold", initialThreshold );
}
KActivityTracker::~KActivityTracker()
{
// NOP
}
void
KActivityTracker::setThreshold( long threshold )
{
_threshold = threshold;
KConfig * config = kapp->config();
config->setGroup( _id );
config->writeEntry( "threshold", _threshold );
checkThreshold();
}
void
KActivityTracker::trackActivity( int points )
{
_sum += points;
if ( _sum < 0 ) // handle long int overflow
_sum = 0;
#if 0
kdDebug() << "Adding " << points << " activity points."
<< " Total: " << _sum << " threshold: " << _threshold
<< endl;
#endif
KConfig * config = kapp->config();
config->setGroup( _id );
config->writeEntry( "activityPoints", _sum );
checkThreshold();
}
void
KActivityTracker::checkThreshold()
{
if ( _sum > _threshold && _lastSignal < _threshold )
{
// kdDebug() << "Activity threshold reached for " << _id << endl;
_lastSignal = _sum;
KConfig * config = kapp->config();
config->setGroup( _id );
config->writeEntry( "lastSignal", _lastSignal );
emit thresholdReached();
}
}
// EOF

@ -0,0 +1,109 @@
/*
* File name: kactivitytracker.h
* Summary: Utility object to track user activity
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KActivityTracker_h
#define KActivityTracker_h
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qobject.h>
/**
* Helper class to track user activity of any kind: When the user uses an
* application's actions (menu items etc.), those actions notify this object of
* that fact. Each action has an amount of "activity points" assigned
* (i.e. what this action is "worth"). Those points are summed up here, and
* when a certain number of points is reached, a signal is triggered. This
* signal can be used for example to ask the user if he wouldn't like to rate
* this program - or register it if this is a shareware program.
*
* @short User activity tracker
**/
class KActivityTracker: public QObject
{
Q_OBJECT
public:
/**
* Constructor. The ID is a name for the KConfig object to look in for
* accumulated activity points so far. 'initialThreshold' is only used if
* the application's @ref KConfig object doesn't contain a corresponding
* entry yet.
**/
KActivityTracker( QObject * parent,
const QString & id,
long initialThreshold );
/**
* Destructor.
**/
virtual ~KActivityTracker();
/**
* Returns the number of activity points accumulated so far.
**/
long sum() const { return _sum; }
/**
* Sets the activity threshold, i.e. when a signal will be sent.
**/
void setThreshold( long threshold );
/**
* Returns the current threshold.
**/
long threshold() const { return _threshold; }
/**
* Check the sum of activity points accumulated so far against the current
* threshold and emit a signal if appropriate.
**/
void checkThreshold();
public slots:
/**
* Track an activity, i.e. add the specified amount of activity points to
* the accumulated sum.
**/
void trackActivity( int points );
/**
* Set the threshold to its double value.
**/
void doubleThreshold() { setThreshold( 2 * threshold() ); }
signals:
/**
* Emitted when the activity threshold is reached.
*
* You might want to set the threshold to a new value when this signal is
* emitted. You can simply connect it to @ref doubleThreshold().
**/
void thresholdReached( void );
protected:
long _sum;
long _threshold;
long _lastSignal;
QString _id;
};
#endif // KActivityTracker_h
// EOF

@ -0,0 +1,432 @@
/*
* File name: kcleanup.cpp
* Summary: Support classes for KDirStat
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2004-11-23
*/
#include <stdlib.h>
#include <qapplication.h>
#include <qregexp.h>
#include <kapp.h>
#include <kprocess.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>
#include <kglobalsettings.h>
#include "kcleanup.h"
#include "kdirsaver.h"
#define VERBOSE_RUN_COMMAND 1
#define SIMULATE_COMMAND 0
using namespace KDirStat;
KCleanup::KCleanup( QString id,
QString command,
QString title,
KActionCollection * parent )
: KAction( title,
0, // accel
parent,
id )
, _id ( id )
, _command ( command )
, _title ( title )
{
_selection = 0;
_enabled = true;
_worksForDir = true;
_worksForFile = false;
_worksForDotEntry = false;
_worksLocalOnly = true;
_recurse = false;
_askForConfirmation = false;
_refreshPolicy = noRefresh;
KAction::setEnabled( false );
}
KCleanup::KCleanup( const KCleanup &src )
: KAction()
{
copy( src );
}
KCleanup &
KCleanup::operator= ( const KCleanup &src )
{
copy( src );
return *this;
}
void
KCleanup::copy( const KCleanup &src )
{
setTitle( src.title() );
_selection = src.selection();
_id = src.id();
_command = src.command();
_enabled = src.enabled();
_worksForDir = src.worksForDir();
_worksForFile = src.worksForFile();
_worksForDotEntry = src.worksForDotEntry();
_worksLocalOnly = src.worksLocalOnly();
_recurse = src.recurse();
_askForConfirmation = src.askForConfirmation();
_refreshPolicy = src.refreshPolicy();
}
void
KCleanup::setTitle( const QString &title )
{
_title = title;
KAction::setText( _title );
}
bool
KCleanup::worksFor( KFileInfo *item ) const
{
if ( ! _enabled || ! item )
return false;
if ( worksLocalOnly() && ! item->tree()->isFileProtocol() )
return false;
if ( item->isDotEntry() ) return worksForDotEntry();
if ( item->isDir() ) return worksForDir();
return worksForFile();
}
void
KCleanup::selectionChanged( KFileInfo *selection )
{
bool enabled = false;
_selection = selection;
if ( selection )
{
enabled = worksFor( selection );
if ( ! selection->isFinished() )
{
// This subtree isn't finished reading yet
switch ( _refreshPolicy )
{
// Refresh policies that would cause this subtree to be deleted
case refreshThis:
case refreshParent:
case assumeDeleted:
// Prevent premature deletion of this tree - this would
// cause a core dump for sure.
enabled = false;
break;
default:
break;
}
}
}
KAction::setEnabled( enabled );
}
void
KCleanup::executeWithSelection()
{
if ( _selection )
execute( _selection );
}
bool
KCleanup::confirmation( KFileInfo * item )
{
QString msg;
if ( item->isDir() || item->isDotEntry() )
{
msg = i18n( "%1\nin directory %2" ).arg( cleanTitle() ).arg( item->url() );
}
else
{
msg = i18n( "%1\nfor file %2" ).arg( cleanTitle() ).arg( item->url() );
}
if ( KMessageBox::warningContinueCancel( 0, // parentWidget
msg, // message
i18n( "Please Confirm" ), // caption
i18n( "Confirm" ) // confirmButtonLabel
) == KMessageBox::Continue )
return true;
else
return false;
}
void
KCleanup::execute( KFileInfo *item )
{
if ( worksFor( item ) )
{
if ( _askForConfirmation && ! confirmation( item ) )
return;
KDirTree * tree = item->tree();
executeRecursive( item );
switch ( _refreshPolicy )
{
case noRefresh:
// Do nothing.
break;
case refreshThis:
tree->refresh( item );
break;
case refreshParent:
tree->refresh( item->parent() );
break;
case assumeDeleted:
// Assume the cleanup action has deleted the item.
// Modify the KDirTree accordingly.
tree->deleteSubtree( item );
// Don't try to figure out a reasonable next selection - the
// views have to do that while handling the subtree
// deletion. Only the views have any knowledge about a
// reasonable strategy for choosing a next selection. Unlike
// the view items, the KFileInfo items don't have an order that
// makes any sense to the user.
break;
}
}
emit executed();
}
void
KCleanup::executeRecursive( KFileInfo *item )
{
if ( worksFor( item ) )
{
if ( _recurse )
{
// Recurse into all subdirectories.
KFileInfo * subdir = item->firstChild();
while ( subdir )
{
if ( subdir->isDir() )
{
/**
* Recursively execute in this subdirectory, but only if it
* really is a directory: File children might have been
* reparented to the directory (normally, they reside in
* the dot entry) if there are no real subdirectories on
* this directory level.
**/
executeRecursive( subdir );
}
subdir = subdir->next();
}
}
// Perform cleanup for this directory.
runCommand( item, _command );
}
}
const QString
KCleanup::itemDir( const KFileInfo *item ) const
{
QString dir = item->url();
if ( ! item->isDir() && ! item->isDotEntry() )
{
dir.replace ( QRegExp ( "/[^/]*$" ), "" );
}
return dir;
}
QString
KCleanup::cleanTitle() const
{
// Use the cleanup action's title, if possible.
QString title = _title;
if ( title.isEmpty() )
{
title = _id;
}
// Get rid of any "&" characters in the text that denote keyboard
// shortcuts in menus.
title.replace( QRegExp( "&" ), "" );
return title;
}
QString
KCleanup::expandVariables( const KFileInfo * item,
const QString & unexpanded ) const
{
QString expanded = unexpanded;
expanded.replace( QRegExp( "%p" ),
"\"" + QString::fromLocal8Bit( item->url() ) + "\"" );
expanded.replace( QRegExp( "%n" ),
"\"" + QString::fromLocal8Bit( item->name() ) + "\"" );
if ( KDE::versionMajor() >= 3 && KDE::versionMinor() >= 4 )
expanded.replace( QRegExp( "%t" ), "trash:/" );
else
expanded.replace( QRegExp( "%t" ), KGlobalSettings::trashPath() );
return expanded;
}
#include <qtextcodec.h>
void
KCleanup::runCommand ( const KFileInfo * item,
const QString & command ) const
{
KProcess proc;
KDirSaver dir( itemDir( item ) );
QString cmd( expandVariables( item, command ));
#if VERBOSE_RUN_COMMAND
printf( "\ncd " );
fflush( stdout );
system( "pwd" );
QTextCodec * codec = QTextCodec::codecForLocale();
printf( "%s\n", (const char *) codec->fromUnicode( cmd ) );
fflush( stdout );
#endif
#if ! SIMULATE_COMMAND
proc << "sh";
proc << "-c";
proc << cmd;
switch ( _refreshPolicy )
{
case noRefresh:
case assumeDeleted:
// In either case it is no use waiting for the command to
// finish, so we are starting the command as a pure
// background process.
proc.start( KProcess::DontCare );
break;
case refreshThis:
case refreshParent:
// If a display refresh is due after the command, we need to
// wait for the command to be finished in order to avoid
// performing the update prematurely, so we are starting this
// process in blocking mode.
QApplication::setOverrideCursor( waitCursor );
proc.start( KProcess::Block );
QApplication::restoreOverrideCursor();
break;
}
#endif
}
void
KCleanup::readConfig()
{
KConfig *config = kapp->config();
KConfigGroupSaver saver( config, _id );
bool valid = config->readBoolEntry( "valid", false );
// If the config section requested exists, it should contain a
// "valid" field with a true value. If not, there is no such
// section within the config file. In this case, just leave this
// cleanup action undisturbed - we'd rather have a good default
// value (as provided - hopefully - by our application upon
// startup) than a generic empty cleanup action.
if ( valid )
{
_command = config->readEntry ( "command" );
_enabled = config->readBoolEntry ( "enabled" );
_worksForDir = config->readBoolEntry ( "worksForDir" );
_worksForFile = config->readBoolEntry ( "worksForFile" );
_worksForDotEntry = config->readBoolEntry ( "worksForDotEntry" );
_worksLocalOnly = config->readBoolEntry ( "worksLocalOnly" );
_recurse = config->readBoolEntry ( "recurse" , false );
_askForConfirmation = config->readBoolEntry ( "askForConfirmation" , false );
_refreshPolicy = (KCleanup::RefreshPolicy) config->readNumEntry( "refreshPolicy" );
setTitle( config->readEntry( "title" ) );
}
}
void
KCleanup::saveConfig() const
{
KConfig *config = kapp->config();
KConfigGroupSaver saver( config, _id );
config->writeEntry( "valid", true );
config->writeEntry( "command", _command );
config->writeEntry( "title", _title );
config->writeEntry( "enabled", _enabled );
config->writeEntry( "worksForDir", _worksForDir );
config->writeEntry( "worksForFile", _worksForFile );
config->writeEntry( "worksForDotEntry", _worksForDotEntry );
config->writeEntry( "worksLocalOnly", _worksLocalOnly );
config->writeEntry( "recurse", _recurse );
config->writeEntry( "askForConfirmation", _askForConfirmation );
config->writeEntry( "refreshPolicy", (int) _refreshPolicy );
}
// EOF

@ -0,0 +1,360 @@
/*
* File name: kcleanup.h
* Summary: Support classes for KDirStat
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KCleanup_h
#define KCleanup_h
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <qdict.h>
#include <qptrlist.h>
#include <qintdict.h>
#include <kaction.h>
#include <kdebug.h>
#include "kdirtree.h"
namespace KDirStat
{
/**
* Cleanup action to be performed for @ref KDirTree items.
*
* @short KDirStat cleanup action
**/
class KCleanup: public KAction
{
Q_OBJECT
public:
enum RefreshPolicy { noRefresh, refreshThis, refreshParent, assumeDeleted };
/**
* Constructor.
*
* 'id' is the name of this cleanup action as used in the XML UI file
* and config files, 'title' is the human readable menu title.
* 'command' is the shell command to execute.
*
* Most applications will want to pass KMainWindow::actionCollection()
* for 'parent' so the menus and toolbars can be created using the XML
* UI description ('kdirstatui.rc' for KDirStat).
**/
KCleanup( QString id = "",
QString command = "",
QString title = "",
KActionCollection * parent = 0 );
/**
* Copy Constructor.
*
* Notice that this is a not quite complete copy constructor: Since
* there is no KAction copy constructor, the inherited KAction members
* will be constructed with the KAction default constructor. Thus, an
* object created with this copy constructor can rely only on its
* KCleanup members. This is intended for save/restore operations only,
* not for general use. In particular, DO NOT connect an object thus
* constructed with signals. The results will be undefined (at best).
**/
KCleanup( const KCleanup &src );
/**
* Assignment operator.
*
* This will not modify the KAction members, just the KCleanup
* members. Just like the copy constructor, this is intended for
* save/restore operations, not for general use.
**/
KCleanup & operator= ( const KCleanup &src );
/**
* Return the ID (name) of this cleanup action as used for setup files
* and the XML UI description. This ID should be unique within the
* application.
**/
const QString & id() const { return _id; }
/**
* Return the command line that will be executed upon calling @ref
* KCleanup::execute(). This command line may contain %p for the
* complete path of the directory or file concerned or %n for the pure
* file or directory name without path.
**/
const QString & command() const { return _command; }
/**
* Return the user title of this command as displayed in menus.
* This may include '&' characters for keyboard shortcuts.
* See also @ref cleanTitle() .
**/
const QString & title() const { return _title; }
/**
* Returns the cleanup action's title without '&' keyboard shortcuts.
* Uses the ID as fallback if the name is empty.
**/
QString cleanTitle() const;
/**
* Return whether or not this cleanup action is generally enabled.
**/
bool enabled() const { return _enabled; }
/**
* Return this cleanup's internally stored @ref KDirTree
* selection. Important only for copy constructor etc.
**/
KFileInfo * selection() const { return _selection; }
/**
* Return whether or not this cleanup action works for this particular
* KFileInfo. Checks all the other conditions (enabled(),
* worksForDir(), worksForFile(), ...) accordingly.
**/
bool worksFor( KFileInfo *item ) const;
/**
* Return whether or not this cleanup action works for directories,
* i.e. whether or not @ref KCleanup::execute() will be successful if
* the object passed is a directory.
**/
bool worksForDir() const { return _worksForDir; }
/**
* Return whether or not this cleanup action works for plain files.
**/
bool worksForFile() const { return _worksForFile; }
/**
* Return whether or not this cleanup action works for KDirStat's
* special 'Dot Entry' items, i.e. the pseudo nodes created in most
* directories that hold the plain files.
**/
bool worksForDotEntry() const { return _worksForDotEntry; }
/**
* Return whether or not this cleanup action works for simple local
* files and directories only ('file:/' protocol) or network
* transparent, i.e. all protocols KDE supports ('ftp', 'smb' - but
* even 'tar', even though it is - strictly spoken - local).
**/
bool worksLocalOnly() const { return _worksLocalOnly; }
/**
* Return whether or not the cleanup action should be performed
* recursively in subdirectories of the initial KFileInfo.
**/
bool recurse() const { return _recurse; }
/**
* Return whether or not this cleanup should ask the user for
* confirmation when it is executed.
*
* The default is 'false'. Use with caution - not only can this become
* very annoying, people also tend to automatically click on 'OK' when
* too many confirmation dialogs pop up!
**/
bool askForConfirmation() const { return _askForConfirmation; }
/**
* Return the refresh policy of this cleanup action - i.e. the action
* to perform after each call to KCleanup::execute(). This is supposed
* to bring the corresponding KDirTree back into sync after the cleanup
* action - the underlying file tree might have changed due to that
* cleanup action.
*
* noRefresh: Don't refresh anything. Assume nothing has changed.
* This is the default.
*
* refreshThis: Refresh the KDirTree from the item on that was passed
* to KCleanup::execute().
*
* refreshParent: Refresh the KDirTree from the parent of the item on
* that was passed to KCleanup::execute(). If there is no such parent,
* refresh the entire tree.
*
* assumeDeleted: Do not actually refresh the KDirTree. Instead,
* blindly assume the cleanup action has deleted the item that was
* passed to KCleanup::execute() and delete the corresponding subtree
* in the KDirTree accordingly. This will work well for most deleting
* actions as long as they can be performed without problems. If there
* are any problems, however, the KDirTree might easily run out of sync
* with the directory tree: The KDirTree will show the subtree as
* deleted (i.e. it will not show it any more), but it still exists on
* disk. This is the tradeoff to a very quick response. On the other
* hand, the user can easily at any time hit one of the explicit
* refresh buttons and everything will be back into sync again.
**/
enum RefreshPolicy refreshPolicy() const { return _refreshPolicy; }
void setTitle ( const QString &title );
void setId ( const QString &id ) { _id = id; }
void setCommand ( const QString &command) { _command = command; }
void setEnabled ( bool enabled ) { _enabled = enabled; }
void setWorksForDir ( bool canDo ) { _worksForDir = canDo; }
void setWorksForFile ( bool canDo ) { _worksForFile = canDo; }
void setWorksForDotEntry ( bool canDo ) { _worksForDotEntry = canDo; }
void setWorksLocalOnly ( bool canDo ) { _worksLocalOnly = canDo; }
void setRecurse ( bool recurse ) { _recurse = recurse; }
void setAskForConfirmation ( bool ask ) { _askForConfirmation = ask; }
void setRefreshPolicy ( enum RefreshPolicy refreshPolicy ) { _refreshPolicy = refreshPolicy; }
public slots:
/**
* The heart of the matter: Perform the cleanup with the KFileInfo
* specified.
**/
void execute( KFileInfo *item );
/**
* Perform the cleanup with the current KDirTree selection if there is
* any.
**/
void executeWithSelection();
/**
* Set enabled/disabled status according to 'selection' and internally
* store 'selection' - this will also be used upon calling
* @ref executeWithSelection() . '0' means "nothing selected".
**/
void selectionChanged( KFileInfo *selection );
/**
* Read configuration.
**/
void readConfig();
/**
* Save configuration.
**/
void saveConfig() const;
signals:
/**
* Emitted after the action is executed.
*
* Please note that there intentionally is no reference as to which
* object the action was executed upon since this object very likely
* doesn't exist any more.
**/
void executed();
protected slots:
/**
* Inherited from @ref KAction : Perform the action.
* In this case, execute the cleanup with the current selection.
**/
virtual void slotActivated() { executeWithSelection(); }
protected:
/**
* Recursively perform the cleanup.
**/
void executeRecursive( KFileInfo *item );
/**
* Ask user for confirmation to execute this cleanup action for
* 'item'. Returns 'true' if user accepts, 'false' otherwise.
**/
bool confirmation( KFileInfo *item );
/**
* Retrieve the directory part of a KFileInfo's path.
**/
const QString itemDir( const KFileInfo *item ) const;
/**
* Expand some variables in string 'unexpanded' to information from
* within 'item'. Multiple expansion is performed as needed, i.e. the
* string may contain more than one variable to expand. The resulting
* string is returned.
*
* %p expands to item->path(), i.e. the item's full path name.
*
* /usr/local/bin for that directory
* /usr/local/bin/doit for a file within it
*
* %n expands to item->name(), i.e. the last component of the pathname.
* The examples above would expand to:
*
* bin
* doit
*
* For commands that are to be executed from within the 'Clean up'
* menu, you might specify something like:
*
* "kfmclient openURL %p"
* "tar czvf %{name}.tgz && rm -rf %{name}"
**/
QString expandVariables ( const KFileInfo * item,
const QString & unexpanded ) const;
/**
* Run a command with 'item' as base to expand variables.
**/
void runCommand ( const KFileInfo * item,
const QString & command ) const;
/**
* Internal implementation of the copy constructor and assignment
* operator: Copy all data members from 'src'.
**/
void copy ( const KCleanup &src );
//
// Data members
//
KFileInfo * _selection;
QString _id;
QString _command;
QString _title;
bool _enabled;
bool _worksForDir;
bool _worksForFile;
bool _worksForDotEntry;
bool _worksLocalOnly;
bool _recurse;
bool _askForConfirmation;
enum RefreshPolicy _refreshPolicy;
};
inline kdbgstream & operator<< ( kdbgstream & stream, const KCleanup * cleanup )
{
if ( cleanup )
stream << cleanup->id();
else
stream << "<NULL>";
return stream;
}
} // namespace KDirStat
#endif // ifndef KCleanup_h
// EOF

@ -0,0 +1,283 @@
/*
* File name: kcleanupcollection.cpp
* Summary: Support classes for KDirStat
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2004-11-23
*/
#include <klocale.h>
#include "kcleanup.h"
#include "kstdcleanup.h"
#include "kcleanupcollection.h"
using namespace KDirStat;
KCleanupCollection::KCleanupCollection( KActionCollection * actionCollection )
: QObject()
, _actionCollection( actionCollection )
{
/**
* All cleanups beloningt to this collection are stored in two separate Qt
* collections, a QList and a QDict. Make _one_ of them manage the cleanup
* objects, i.e. have them clear the KCleanup objects upon deleting. The
* QList is the master collection, the QDict the slave.
**/
_cleanupList.setAutoDelete( true );
_cleanupDict.setAutoDelete( false );
_nextUserCleanupNo = 0;
}
KCleanupCollection::KCleanupCollection( const KCleanupCollection &src )
: QObject()
{
deepCopy( src );
// Keep consistent with the KCleanup copy constructor: It explicitly uses a
// zero KActionCollecton to make sure no duplicates of cleanups get into
// the action collection.
_actionCollection = 0;
}
KCleanupCollection::~KCleanupCollection()
{
// No need to delete the cleanups: _cleanupList takes care of that
// (autoDelete!).
}
KCleanupCollection &
KCleanupCollection::operator= ( const KCleanupCollection &src )
{
if ( size() != src.size() )
{
/**
* If the sizes are different, we really need to make a deep copy -
* i.e. discard all the existing cleanups in this collection and create
* new ones with the KCleanup copy constructor.
**/
// kdDebug() << k_funcinfo << "Sizes different - deep copy" << endl;
deepCopy( src );
}
else
{
/**
* If the sizes are the same, we'd rather just use the KCleanup
* assignment operator to individually assign each cleanup in the
* source collection to the corresponding one in this collection.
*
* The background of this seemingly awkward solution are (again) the
* limitations of the KCleanup copy constructor: It doesn't make a
* truly identical copy of the entire KCleanup object. Rather, it
* copies only the KCleanup members and leaves most of the KAction
* members (the parent class) untouched.
*
* The behaviour implemented here comes handy in the most common
* situation where this assignment operator is used:
*
* KCleanupCollection tmpCollection( origCollection );
* ...
* ... // let use change settings in settings dialog
* ...
* origCollection = tmpCollection;
*
* 'tmpCollection' here is an incomplete copy of 'origCollection' -
* which represents what the user really can see in the menus, i.e. all
* the KAction stuff in there really needs to work.
*
* During changing preferences in the 'settings' dialog, the user only
* changes 'tmpCollection' - if he chooses to abandon his changes
* (e.g., he clicks on the 'cancel' button), no harm is done -
* 'tmpCollection' is simply not copied back to
* 'origCollection'. Anyway, since 'tmpCollection' is merely a
* container for the true KCleanup members, the KAction members don't
* matter here: There is no representation of 'tmpCollection' in any
* menu or tool bar.
*
* As soon as the user clicks on 'apply' or 'ok' in the 'settings'
* dialog, however, 'tmpCollection' is copied back to 'origCollection'
* - that is, its KCleanup members. Most of the KAction members (other
* than 'text()' which is explicitly copied back) remain untouched,
* thus maintaining consistency with the user interface is guaranteed.
**/
// kdDebug() << k_funcinfo << "Same sizes - individual assignment" << endl;
KCleanupList srcList = src.cleanupList();
KCleanupListIterator srcIt( srcList );
KCleanupListIterator destIt( _cleanupList );
while ( *srcIt && *destIt )
{
// kdDebug() << "Assigning " << *srcIt << endl;
**destIt = **srcIt;
++srcIt;
++destIt;
}
}
// Intentionally leaving '_actionCollection' untouched!
return *this;
}
void
KCleanupCollection::deepCopy( const KCleanupCollection &src )
{
// Copy simple values
_nextUserCleanupNo = src.nextUserCleanupNo();
// Just to make sure - clear the internal collections
_cleanupList.clear();
_cleanupDict.clear();
// Make a deep copy of all the cleanups in the source collection
KCleanupList srcList = src.cleanupList();
KCleanupListIterator it( srcList );
while ( *it )
{
// kdDebug() << k_funcinfo << "Creating new " << *it << endl;
add( new KCleanup( **it ) );
++it;
}
}
void
KCleanupCollection::add( KCleanup *newCleanup )
{
CHECK_PTR( newCleanup );
if ( _cleanupDict[ newCleanup->id() ] ) // Already there?
{
// Delete any old instance in the list.
//
// The instance in the dict will be deleted automatically by inserting
// the new one.
_cleanupList.first(); // Moves _cleanupList.current() to beginning
while ( _cleanupList.current() )
{
if ( _cleanupList.current()->id() == newCleanup->id() )
{
// Found a cleanup with the same ID -
// remove the current list item, delete it (autoDelete!) and
// move _cleanupList.current() to the next item.
_cleanupList.remove();
}
else
_cleanupList.next();
}
}
_cleanupList.append( newCleanup );
_cleanupDict.insert( newCleanup->id(), newCleanup );
connect( this, SIGNAL( selectionChanged( KFileInfo * ) ),
newCleanup, SLOT ( selectionChanged( KFileInfo * ) ) );
connect( this, SIGNAL( readConfig() ),
newCleanup, SLOT ( readConfig() ) );
connect( this, SIGNAL( saveConfig() ),
newCleanup, SLOT ( saveConfig() ) );
connect( newCleanup, SIGNAL( executed() ),
this, SLOT ( cleanupExecuted() ) );
}
void
KCleanupCollection::addStdCleanups()
{
add( KStdCleanup::openInKonqueror ( _actionCollection ) );
add( KStdCleanup::openInTerminal ( _actionCollection ) );
add( KStdCleanup::compressSubtree ( _actionCollection ) );
add( KStdCleanup::makeClean ( _actionCollection ) );
add( KStdCleanup::deleteTrash ( _actionCollection ) );
add( KStdCleanup::moveToTrashBin ( _actionCollection ) );
add( KStdCleanup::hardDelete ( _actionCollection ) );
}
void
KCleanupCollection::addUserCleanups( int number )
{
for ( int i=0; i < number; i++ )
{
QString id;
id.sprintf( "cleanup_user_defined_%d", _nextUserCleanupNo );
QString title;
if ( _nextUserCleanupNo <= 9 )
// Provide a keyboard shortcut for cleanup #0..#9
title=i18n( "User Defined Cleanup #&%1" ).arg(_nextUserCleanupNo);
else
// No keyboard shortcuts for cleanups #10.. - they would be duplicates
title=i18n( "User Defined Cleanup #%1" ).arg(_nextUserCleanupNo);
_nextUserCleanupNo++;
KCleanup *cleanup = new KCleanup( id, "", title, _actionCollection );
CHECK_PTR( cleanup );
cleanup->setEnabled( false );
if ( i <= 9 )
{
// Provide an application-wide keyboard accelerator for cleanup #0..#9
cleanup->setShortcut( Qt::CTRL + Qt::Key_0 + i );
}
add( cleanup );
}
}
KCleanup *
KCleanupCollection::cleanup( const QString & id )
{
return _cleanupDict[ id ];
}
void
KCleanupCollection::clear()
{
_cleanupList.clear();
_cleanupDict.clear();
_nextUserCleanupNo = 0;
}
void
KCleanupCollection::slotReadConfig()
{
emit readConfig();
}
void
KCleanupCollection::cleanupExecuted()
{
emit userActivity( 10 );
}
// EOF

@ -0,0 +1,225 @@
/*
* File name: kcleanupcollection.h
* Summary: Support classes for KDirStat
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KCleanupCollection_h
#define KCleanupCollection_h
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "kcleanup.h"
// Forward declarations
class KActionCollection;
namespace KDirStat
{
typedef QDict<KCleanup> KCleanupDict;
typedef QDictIterator<KCleanup> KCleanupDictIterator;
typedef QPtrList<KCleanup> KCleanupList;
typedef QPtrListIterator<KCleanup> KCleanupListIterator;
/**
* Set of @ref KCleanup actions to be performed for @ref KDirTree items,
* consisting of a number of predefined and a number of user-defined
* cleanups. The prime purpose of this is to make save/restore operations
* with a number of cleanups easier. Thus, it provides a copy constructor,
* an assignment operator and various methods to directly access individual
* cleanups.
*
* @short KDirStat cleanup action collection
**/
class KCleanupCollection: public QObject
{
Q_OBJECT
public:
/**
* Constructor.
*
* Most applications will want to pass KMainWindow::actionCollection()
* for 'actionCollection' so the menus and toolbars can be created
* using the XML UI description ('kdirstatui.rc' for KDirStat).
*
* All @ref KCleanup actions ever added to this collection will get
* this as their parent.
**/
KCleanupCollection( KActionCollection * actionCollection = 0 );
/**
* Copy Constructor.
*
* Makes a deep copy of this collection with 'actionCollection' set to
* 0 for all copied cleanups. Please note that since there is no
* complete copy constructor for @ref KCleanup, all restrictions to the
* @ref KCleanup copy constructor apply to the KCleanupCollection, too:
* This copy constructor is intended for save/restore operations only,
* not for general use. In particular, DO NOT connect an object thus
* constructed with signals. The results will be undefined (at best).
**/
KCleanupCollection( const KCleanupCollection &src );
/**
* Assignment operator.
*
* This operator has the same restrictions as the copy constructor:
* Just like the copy constructor, this is intended for save/restore
* operations, not for general use.
*
* For details, see the extensive comments in the source file.
**/
KCleanupCollection & operator= ( const KCleanupCollection &src );
/**
* Destructor
**/
virtual ~KCleanupCollection();
/**
* Add the standard cleanups to this collection.
**/
void addStdCleanups();
/**
* Add 'number' user-defined cleanups to this collection.
**/
void addUserCleanups( int number );
/**
* Add one single cleanup to this collection. The collection assumes
* ownerwhip of this cleanup - don't delete it!
**/
void add( KCleanup *cleanup );
/**
* Retrieve a cleanup by its ID (internal name).
* Returns 0 if there is no such cleanup.
**/
KCleanup * cleanup( const QString & id );
/**
* An alias to @ref cleanup() for convenience: Thus, you can use
* collection[ "cleanup_id" ] to access any particular cleanup.
**/
KCleanup * operator[] ( const QString & id )
{ return cleanup( id ); }
/**
* Remove all cleanups from this collection.
**/
void clear();
/**
* Return (a shallow copy of) the internal cleanup list.
*
* Use this and a KCleanupListIterator to iterate over all cleanups in
* this collection. Remember to keep the list until you no longer need
* the iterator!
*
* KCleanupCollection *coll = ...
* KCleanupList cleanup_list = coll->cleanupList();
* KCleanupListIterator it( cleanup_list );
*
* while ( *it )
* {
* kdDebug() << "Found cleanup " << *it << endl;
* ++it;
* }
**/
KCleanupList cleanupList() const { return _cleanupList; }
/**
* Return the number of cleanup actions in this collection.
**/
int size() const { return _cleanupList.count(); }
/**
* For internal use only: Returns the number to be assigned to the next
* user cleanup that may be added.
**/
int nextUserCleanupNo() const { return _nextUserCleanupNo; }
public slots:
/**
* Emit the readConfig() signal for all cleanups.
**/
void slotReadConfig();
signals:
/**
* Emitted when the currently selected item changes.
* 'item' may be 0 when the selection is cleared.
*
* Connect a view's selectionChanged() signal to this
* selectionChanged() signal to have the cleanup collection pass this
* signal to its cleanups.
**/
void selectionChanged( KFileInfo *item );
/**
* Read collection for all cleanups.
**/
void readConfig();
/**
* Save configuration for all cleanups.
**/
void saveConfig();
/**
* Emitted at user activity, i.e. when the user executes a cleanup.
* This is intended for use together with a @ref KActivityTracker.
**/
void userActivity( int points );
protected slots:
/**
* Connected to each cleanup's @ref executed() signal to track user
* activity.
**/
void cleanupExecuted();
protected:
/**
* Internal implementation of copy constructor and assignment operator:
* Make a deep copy of the collection.
**/
void deepCopy( const KCleanupCollection &src );
// Data members
KActionCollection * _actionCollection;
int _nextUserCleanupNo;
KCleanupList _cleanupList;
KCleanupDict _cleanupDict;
};
} // namespace KDirStat
#endif // ifndef KCleanupCollection_h
// EOF

@ -0,0 +1,71 @@
/*
* File name: kdirsaver.cpp
* Summary: Utility object to save current working directory
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#include <unistd.h>
#include <kdebug.h>
#include "kdirsaver.h"
KDirSaver::KDirSaver( const QString & newPath )
{
/*
* No need to actually save the current working directory: This object
* includes a QDir whose default constructor constructs a directory object
* that contains the current working directory. Just what is needed here.
*/
cd( newPath );
}
KDirSaver::KDirSaver( const KURL & url )
{
if ( url.isLocalFile() )
{
cd( url.path() );
}
else
{
kdError() << k_funcinfo << "Can't change dir to remote location " << url.url() << endl;
}
}
KDirSaver::~KDirSaver()
{
restore();
}
void
KDirSaver::cd( const QString & newPath )
{
if ( ! newPath.isEmpty() )
{
chdir( newPath );
}
}
QString
KDirSaver::currentDirPath() const
{
return QDir::currentDirPath();
}
void
KDirSaver::restore()
{
chdir( oldWorkingDir.path() );
}
// EOF

@ -0,0 +1,75 @@
/*
* File name: kdirsaver.h
* Summary: Utility object to save current working directory
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KDirSaver_h
#define KDirSaver_h
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kurl.h>
#include <qdir.h>
/**
* Helper class to change directories without losing the current context.
* Will change back to the old working directory when destroyed.
*
* @short Directory changer with automatic restore
**/
class KDirSaver
{
public:
/**
* Constructor. Will save the current working directory and change to the
* path supplied. The old working directory will be restored when this
* object is destroyed.
**/
KDirSaver( const QString & newPath = "" );
/**
* Constructor from a KURL. Will issue error messages on stdout for
* non-local objects.
**/
KDirSaver( const KURL & url );
/**
* Destructor. Restores the original working directory.
**/
virtual ~KDirSaver();
/**
* Change directory. Unlike @ref QDir::cd(), this method really performs a
* system chdir() so subsequent system calls will have the directory
* specified as the new current working directory.
**/
void cd( const QString & newPath );
/**
* Obtain the current working directory's absolute path.
* This is useful for resolving/simplifying relative paths.
**/
QString currentDirPath() const;
/**
* (Prematurely) restore the working directory. Unnecessary when this
* object will be destroyed anyway since the destructor does exactly that.
**/
void restore();
protected:
QDir oldWorkingDir;
};
#endif // KDirSaver_h
// EOF

@ -0,0 +1,20 @@
# KDE Config File
[Desktop Entry]
Type=Application
Exec=kdirstat -caption "%c" %i %m
Icon=kdirstat.png
MiniIcon=kdirstat.png
DocPath=kdirstat/index.html
Encoding=UTF-8
Comment=Directory statistics and disk usage
Comment[de]=Verzeichnisstatistik und Platzverbrauch
Comment[hu]=Könyvtárstatisztikák és szabad hely
Terminal=0
Name=KDirStat - Directory Statistics
Name[de]=KDirStat - Verzeichnisstatistik
Name[hu]=KDirStat könyvtárstatisztika
MimeType=inode/directory

@ -0,0 +1,6 @@
# Update for KDirStat configuration
Id=kdirstat_2004_11_24_11_36
File=kdirstatrc
Group=cleanup_move_to_trash_bin
Options=overwrite
Script=fix_move_to_trash_bin.pl,perl

@ -0,0 +1,14 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="KDirStatPart" version="1">
<MenuBar>
<Menu name="Edit"><Text>&amp;Edit</Text>
<Action name="selectall"/>
</Menu>
</MenuBar>
<StatusBar/>
</kpartgui>

@ -0,0 +1,847 @@
/*
* File name: kdirstatapp.cpp
* Summary: The KDirStat application - menu bar, tool bar, ...
* License: GPL - See file COPYING for details.
*
* Author: Stefan Hundhammer <sh@suse.de>
* Parts auto-generated by KDevelop
*
* Updated: 2004-12-06
*/
#include <qclipboard.h>
#include <qpopupmenu.h>
#include <qsplitter.h>
#include <kaccel.h>
#include <kaction.h>
#include <kapp.h>
#include <kconfig.h>
#include <kfiledialog.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmenubar.h>
#include <kmessagebox.h>
#include <krun.h>
#include <kstatusbar.h>
#include <kstdaction.h>
#include <kurlrequesterdlg.h>
#include "kdirstatapp.h"
#include "kcleanupcollection.h"
#include "kdirtree.h"
#include "kpacman.h"
#include "ktreemapview.h"
#include "ktreemaptile.h"
#include "kcleanupcollection.h"
#include "kactivitytracker.h"
#include "kdirtreeview.h"
#include "kdirstatsettings.h"
#define USER_CLEANUPS 10 // Number of user cleanup actions
#define ID_STATUS_MSG 1
#define ID_PACMAN 42
#define PACMAN_WIDTH 350
#define PACMAN_INTERVAL 75 // millisec
#define INITIAL_FEEDBACK_REMINDER 2000L
#define FEEDBACK_REMINDER_INTERVAL 1000L
using namespace KDirStat;
KDirStatApp::KDirStatApp( QWidget* , const char* name )
: KMainWindow( 0, name )
{
// Simple inits
_activityTracker = 0; // Might or might not be needed
// Those will be created delayed, only when needed
_settingsDialog = 0;
_feedbackDialog = 0;
_treemapView = 0;
_pacMan = 0;
_pacManDelimiter = 0;
// Set up internal (mainWin -> mainWin) connections
connect( this, SIGNAL( readConfig ( void ) ),
this, SLOT ( readMainWinConfig( void ) ) );
connect( this, SIGNAL( saveConfig ( void ) ),
this, SLOT ( saveMainWinConfig( void ) ) );
// Create main window
_splitter = new QSplitter( QSplitter::Vertical, this );
setCentralWidget( _splitter );
_treeView = new KDirTreeView( _splitter );
connect( _treeView, SIGNAL( progressInfo( const QString & ) ),
this, SLOT ( statusMsg ( const QString & ) ) );
connect( _treeView, SIGNAL( selectionChanged( KFileInfo * ) ),
this, SLOT ( selectionChanged( KFileInfo * ) ) );
connect( _treeView, SIGNAL( contextMenu( KDirTreeViewItem *, const QPoint & ) ),
this, SLOT ( contextMenu( KDirTreeViewItem *, const QPoint & ) ) );
connect( this, SIGNAL( readConfig() ), _treeView, SLOT ( readConfig() ) );
connect( this, SIGNAL( saveConfig() ), _treeView, SLOT ( saveConfig() ) );
connect( _treeView, SIGNAL( finished() ), this, SLOT( createTreemapView() ) );
connect( _treeView, SIGNAL( aborted() ), this, SLOT( createTreemapView() ) );
connect( _treeView, SIGNAL( startingReading() ), this, SLOT( deleteTreemapView() ) );
connect( _treeView, SIGNAL( startingReading() ), this, SLOT( updateActions() ) );
connect( _treeView, SIGNAL( finished() ), this, SLOT( updateActions() ) );
connect( _treeView, SIGNAL( aborted() ), this, SLOT( updateActions() ) );
// Call inits to invoke all other construction parts
initStatusBar();
initActions();
initCleanups();
createGUI();
initActivityTracker();
_treeViewContextMenu = (QPopupMenu *) factory()->container( "treeViewContextMenu", this );
_treemapContextMenu = (QPopupMenu *) factory()->container( "treemapContextMenu", this );
readMainWinConfig();
// Disable certain actions at startup
_editCopy->setEnabled( false );
_reportMailToOwner->setEnabled( false );
_fileRefreshAll->setEnabled( false );
_fileRefreshSelected->setEnabled( false );
updateActions();
}
KDirStatApp::~KDirStatApp()
{
delete _cleanupCollection;
}
void
KDirStatApp::initActions()
{
_fileAskOpenDir = KStdAction::open ( this, SLOT( fileAskOpenDir() ), actionCollection() );
_fileAskOpenUrl = new KAction( i18n( "Open &URL..." ), "konqueror", 0,
this, SLOT( fileAskOpenUrl() ),
actionCollection(), "file_open_url" );
_fileOpenRecent = KStdAction::openRecent ( this, SLOT( fileOpenRecent( const KURL& ) ), actionCollection() );
_fileCloseDir = KStdAction::close ( this, SLOT( fileCloseDir() ), actionCollection() );
_fileRefreshAll = new KAction( i18n( "Refresh &All" ), "reload", 0,
this, SLOT( refreshAll() ),
actionCollection(), "file_refresh_all" );
_fileRefreshSelected = new KAction( i18n( "Refresh &Selected" ), 0,
this, SLOT( refreshSelected() ),
actionCollection(), "file_refresh_selected" );
_fileContinueReadingAtMountPoint = new KAction( i18n( "Continue Reading at &Mount Point" ), "hdd_mount", 0,
this, SLOT( refreshSelected() ), actionCollection(),
"file_continue_reading_at_mount_point" );
_fileStopReading = new KAction( i18n( "Stop Rea&ding" ), "stop", 0,
this, SLOT( stopReading() ), actionCollection(),
"file_stop_reading" );
_fileQuit = KStdAction::quit ( kapp, SLOT( quit() ), actionCollection() );
_editCopy = KStdAction::copy ( this, SLOT( editCopy() ), actionCollection() );
_showToolBar = KStdAction::showToolbar ( this, SLOT( toggleToolBar() ), actionCollection() );
_showStatusBar = KStdAction::showStatusbar ( this, SLOT( toggleStatusBar() ), actionCollection() );
_cleanupOpenWith = new KAction( i18n( "Open With" ), 0,
this, SLOT( cleanupOpenWith() ),
actionCollection(), "cleanup_open_with" );
_treemapZoomIn = new KAction( i18n( "Zoom in" ), "viewmag+", Key_Plus,
this, SLOT( treemapZoomIn() ),
actionCollection(), "treemap_zoom_in" );
_treemapZoomOut = new KAction( i18n( "Zoom out" ), "viewmag-", Key_Minus,
this, SLOT( treemapZoomOut() ),
actionCollection(), "treemap_zoom_out" );
_treemapSelectParent= new KAction( i18n( "Select Parent" ), "up", Key_Asterisk,
this, SLOT( treemapSelectParent() ),
actionCollection(), "treemap_select_parent" );
_treemapRebuild = new KAction( i18n( "Rebuild Treemap" ), 0,
this, SLOT( treemapRebuild() ),
actionCollection(), "treemap_rebuild" );
_showTreemapView = new KToggleAction( i18n( "Show Treemap" ), Key_F9,
this, SLOT( toggleTreemapView() ),
actionCollection(), "options_show_treemap" );
new KAction( i18n( "Help about Treemaps" ), "help", 0,
this, SLOT( treemapHelp() ),
actionCollection(), "treemap_help" );
KAction * pref = KStdAction::preferences( this, SLOT( preferences() ), actionCollection() );
_reportMailToOwner = new KAction( i18n( "Send &Mail to Owner" ), "mail_generic", 0,
_treeView, SLOT( sendMailToOwner() ),
actionCollection(), "report_mail_to_owner" );
_helpSendFeedbackMail = new KAction( i18n( "Send &Feedback Mail..." ), 0,
this, SLOT( sendFeedbackMail() ),
actionCollection(), "help_send_feedback_mail" );
_fileAskOpenDir->setStatusText ( i18n( "Opens a directory" ) );
_fileAskOpenUrl->setStatusText ( i18n( "Opens a (possibly remote) directory" ) );
_fileOpenRecent->setStatusText ( i18n( "Opens a recently used directory" ) );
_fileCloseDir->setStatusText ( i18n( "Closes the current directory" ) );
_fileRefreshAll->setStatusText ( i18n( "Re-reads the entire directory tree" ) );
_fileRefreshSelected->setStatusText ( i18n( "Re-reads the selected subtree" ) );
_fileContinueReadingAtMountPoint->setStatusText( i18n( "Scan mounted file systems" ) );
_fileStopReading->setStatusText ( i18n( "Stops directory reading" ) );
_fileQuit->setStatusText ( i18n( "Quits the application" ) );
_editCopy->setStatusText ( i18n( "Copies the URL of the selected item to the clipboard" ) );
_showToolBar->setStatusText ( i18n( "Enables/disables the toolbar" ) );
_showStatusBar->setStatusText ( i18n( "Enables/disables the statusbar" ) );
_cleanupOpenWith->setStatusText ( i18n( "Open file or directory with arbitrary application" ) );
_showTreemapView->setStatusText ( i18n( "Enables/disables the treemap view" ) );
_treemapZoomIn->setStatusText ( i18n( "Zoom treemap in" ) );
_treemapZoomOut->setStatusText ( i18n( "Zoom treemap out" ) );
_treemapSelectParent->setStatusText ( i18n( "Select parent" ) );
_treemapRebuild->setStatusText ( i18n( "Rebuild treemap to fit into available space" ) );
pref->setStatusText ( i18n( "Opens the preferences dialog" ) );
_reportMailToOwner->setStatusText ( i18n( "Sends a mail to the owner of the selected subtree" ) );
}
void
KDirStatApp::initCleanups()
{
_cleanupCollection = new KCleanupCollection( actionCollection() );
CHECK_PTR( _cleanupCollection );
_cleanupCollection->addStdCleanups();
_cleanupCollection->addUserCleanups( USER_CLEANUPS );
_cleanupCollection->slotReadConfig();
connect( _treeView, SIGNAL( selectionChanged( KFileInfo * ) ),
_cleanupCollection, SIGNAL( selectionChanged( KFileInfo * ) ) );
connect( this, SIGNAL( readConfig( void ) ),
_cleanupCollection, SIGNAL( readConfig( void ) ) );
connect( this, SIGNAL( saveConfig( void ) ),
_cleanupCollection, SIGNAL( saveConfig( void ) ) );
}
void
KDirStatApp::revertCleanupsToDefaults()
{
KCleanupCollection defaultCollection;
defaultCollection.addStdCleanups();
defaultCollection.addUserCleanups( USER_CLEANUPS );
*_cleanupCollection = defaultCollection;
}
void
KDirStatApp::initPacMan( bool enablePacMan )
{
if ( enablePacMan )
{
if ( ! _pacMan )
{
_pacMan = new KPacMan( toolBar(), 16, false, "kde toolbar widget" );
_pacMan->setInterval( PACMAN_INTERVAL ); // millisec
int id = ID_PACMAN;
toolBar()->insertWidget( id, PACMAN_WIDTH, _pacMan );
toolBar()->setItemAutoSized( id, false );
_pacManDelimiter = new QWidget( toolBar() );
toolBar()->insertWidget( ++id, 1, _pacManDelimiter );
connect( _treeView, SIGNAL( startingReading() ), _pacMan, SLOT( start() ) );
connect( _treeView, SIGNAL( finished() ), _pacMan, SLOT( stop () ) );
connect( _treeView, SIGNAL( aborted() ), _pacMan, SLOT( stop () ) );
}
}
else
{
if ( _pacMan )
{
delete _pacMan;
_pacMan = 0;
}
if ( _pacManDelimiter )
{
delete _pacManDelimiter;
_pacManDelimiter = 0;
}
}
}
void
KDirStatApp::initStatusBar()
{
statusBar()->insertItem( i18n( "Ready." ), ID_STATUS_MSG );
}
void
KDirStatApp::initActivityTracker()
{
if ( ! doFeedbackReminder() )
return;
_activityTracker = new KActivityTracker( this, "Feedback",
INITIAL_FEEDBACK_REMINDER );
connect( _activityTracker, SIGNAL( thresholdReached() ),
this, SLOT ( askForFeedback() ) );
connect( _treeView, SIGNAL( userActivity( int ) ),
_activityTracker, SLOT ( trackActivity( int ) ) );
connect( _cleanupCollection, SIGNAL( userActivity( int ) ),
_activityTracker, SLOT ( trackActivity( int ) ) );
}
void
KDirStatApp::openURL( const KURL& url )
{
statusMsg( i18n( "Opening directory..." ) );
_treeView->openURL( url );
_fileOpenRecent->addURL( url );
_fileRefreshAll->setEnabled( true );
setCaption( url.fileName(), false );
statusMsg( i18n( "Ready." ) );
}
void KDirStatApp::readMainWinConfig()
{
KConfig * config = kapp->config();
config->setGroup( "General Options" );
// Status settings of the various bars and views
_showToolBar->setChecked( config->readBoolEntry( "Show Toolbar", true ) );
toggleToolBar();
_showStatusBar->setChecked( config->readBoolEntry( "Show Statusbar", true ) );
toggleStatusBar();
_showTreemapView->setChecked( config->readBoolEntry( "Show Treemap", true ) );
toggleTreemapView();
// Position settings of the various bars
KToolBar::BarPosition toolBarPos;
toolBarPos = ( KToolBar::BarPosition ) config->readNumEntry( "ToolBarPos", KToolBar::Top );
toolBar( "mainToolBar" )->setBarPos( toolBarPos );
_treemapViewHeight = config->readNumEntry( "TreemapViewHeight", 250 );
// initialize the recent file list
_fileOpenRecent->loadEntries( config,"Recent Files" );
QSize size = config->readSizeEntry( "Geometry" );
if( ! size.isEmpty() )
resize( size );
config->setGroup( "Animation" );
initPacMan( config->readBoolEntry( "ToolbarPacMan", true ) );
_treeView->enablePacManAnimation( config->readBoolEntry( "DirTreePacMan", false ) );
}
void
KDirStatApp::saveMainWinConfig()
{
KConfig * config = kapp->config();
config->setGroup( "General Options" );
config->writeEntry( "Geometry", size() );
config->writeEntry( "Show Toolbar", _showToolBar->isChecked() );
config->writeEntry( "Show Statusbar", _showStatusBar->isChecked() );
config->writeEntry( "Show Treemap", _showTreemapView->isChecked() );
config->writeEntry( "ToolBarPos", (int) toolBar( "mainToolBar" )->barPos() );
if ( _treemapView )
config->writeEntry( "TreemapViewHeight", _treemapView->height() );
_fileOpenRecent->saveEntries( config,"Recent Files" );
}
void
KDirStatApp::saveProperties( KConfig *config )
{
(void) config;
// TODO
}
void
KDirStatApp::readProperties( KConfig *config )
{
(void) config;
// TODO
}
bool
KDirStatApp::queryClose()
{
return true;
}
bool
KDirStatApp::queryExit()
{
emit saveConfig();
return true;
}
//============================================================================
// Slots
//============================================================================
void
KDirStatApp::fileAskOpenDir()
{
statusMsg( i18n( "Opening directory..." ) );
KURL url = KFileDialog::getExistingDirectory( QString::null, this, i18n( "Open Directory..." ) );
if( ! url.isEmpty() )
openURL( fixedUrl( url.url() ) );
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::fileAskOpenUrl()
{
statusMsg( i18n( "Opening URL..." ) );
KURL url = KURLRequesterDlg::getURL( QString::null, // startDir
this, i18n( "Open URL..." ) );
if( ! url.isEmpty() )
openURL( fixedUrl( url.url() ) );
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::fileOpenRecent( const KURL& url )
{
statusMsg( i18n( "Opening directory..." ) );
if( ! url.isEmpty() )
openURL( fixedUrl( url.url() ) );
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::fileCloseDir()
{
statusMsg( i18n( "Closing directory..." ) );
_treeView->clear();
_fileRefreshAll->setEnabled( false );
close();
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::refreshAll()
{
statusMsg( i18n( "Refreshing directory tree..." ) );
_treeView->refreshAll();
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::refreshSelected()
{
if ( ! _treeView->selection() )
return;
statusMsg( i18n( "Refreshing selected subtree..." ) );
_treeView->refreshSelected();
statusMsg( i18n( "Ready." ) );
}
void
KDirStatApp::stopReading()
{
_treeView->abortReading();
}
void
KDirStatApp::editCopy()
{
if ( _treeView->selection() )
kapp->clipboard()->setText( QString::fromLocal8Bit(_treeView->selection()->orig()->url()) );
#if 0
#warning debug
if ( _activityTracker )
_activityTracker->trackActivity( 800 );
#endif
}
void
KDirStatApp::cleanupOpenWith()
{
if ( ! _treeView->selection() )
return;
KFileInfo * sel = _treeView->selection()->orig();
if ( sel->isDotEntry() )
return;
KURL::List urlList( KURL( sel->url() ) );
KRun::displayOpenWithDialog( urlList, false );
}
void
KDirStatApp::selectionChanged( KFileInfo *selection )
{
if ( selection )
{
_editCopy->setEnabled( true );
_reportMailToOwner->setEnabled( true );
_fileRefreshSelected->setEnabled( ! selection->isDotEntry() );
_cleanupOpenWith->setEnabled( ! selection->isDotEntry() );
if ( selection->isMountPoint() &&
selection->readState() == KDirOnRequestOnly )
{
_fileContinueReadingAtMountPoint->setEnabled( true );
}
else
_fileContinueReadingAtMountPoint->setEnabled( false );
statusMsg( QString::fromLocal8Bit(selection->url()) );
}
else
{
_editCopy->setEnabled( false );
_reportMailToOwner->setEnabled( false );
_fileRefreshSelected->setEnabled( false );
_fileContinueReadingAtMountPoint->setEnabled( false );
_cleanupOpenWith->setEnabled( false );
statusMsg( "" );
}
updateActions();
}
void
KDirStatApp::updateActions()
{
_treemapZoomIn->setEnabled ( _treemapView && _treemapView->canZoomIn() );
_treemapZoomOut->setEnabled( _treemapView && _treemapView->canZoomOut() );
_treemapRebuild->setEnabled( _treemapView && _treemapView->rootTile() );
_treemapSelectParent->setEnabled( _treemapView && _treemapView->canSelectParent() );
if ( _treeView->tree() && _treeView->tree()->isBusy() )
_fileStopReading->setEnabled( true );
else
_fileStopReading->setEnabled( false );
}
void
KDirStatApp::treemapZoomIn()
{
if ( _treemapView )
{
_treemapView->zoomIn();
updateActions();
}
}
void
KDirStatApp::treemapZoomOut()
{
if ( _treemapView )
{
_treemapView->zoomOut();
updateActions();
}
}
void
KDirStatApp::treemapSelectParent()
{
if ( _treemapView )
{
_treemapView->selectParent();
updateActions();
}
}
void
KDirStatApp::treemapRebuild()
{
if ( _treemapView )
{
_treemapView->rebuildTreemap();
updateActions();
}
}
void
KDirStatApp::treemapHelp()
{
kapp->invokeHelp( "treemap_intro" );
}
void
KDirStatApp::toggleToolBar()
{
if ( _showToolBar->isChecked() ) toolBar( "mainToolBar" )->show();
else toolBar( "mainToolBar" )->hide();
}
void
KDirStatApp::toggleStatusBar()
{
if ( _showStatusBar->isChecked() ) statusBar()->show();
else statusBar()->hide();
}
void
KDirStatApp::toggleTreemapView()
{
if ( _showTreemapView->isChecked() )
{
if ( ! _treemapView )
createTreemapView();
}
else
{
if ( _treemapView )
deleteTreemapView();
}
}
void
KDirStatApp::preferences()
{
if ( ! _settingsDialog )
{
_settingsDialog = new KDirStat::KSettingsDialog( this );
CHECK_PTR( _settingsDialog );
}
if ( ! _settingsDialog->isVisible() )
_settingsDialog->show();
}
void
KDirStatApp::askForFeedback()
{
if ( ! doFeedbackReminder() )
return;
KConfig * config = kapp->config();
switch ( KMessageBox::warningYesNoCancel( this,
i18n( "Now that you know this program for some time,\n"
"wouldn't you like to tell the authors your opinion about it?\n"
"\n"
"Open Source software depends on user feedback.\n"
"Your opinion can help us make the software better." ),
i18n( "Please tell us your opinion!" ), // caption
i18n( "Open &Feedback Form..." ), // yesButton
i18n( "&No, and don't ask again!" ) // noButton
)
)
{
case KMessageBox::Yes:
sendFeedbackMail();
break;
case KMessageBox::No: // ...and don't ask again
config->setGroup( "Feedback" );
config->writeEntry( "dontAsk", true );
config->sync(); // make sure this doesn't get lost even if the app is killed or crashes
break;
case KMessageBox::Cancel:
break;
}
config->setGroup( "Feedback" );
int remindersCount = config->readNumEntry ( "remindersCount", 0 );
config->writeEntry( "remindersCount", ++remindersCount );
if ( _activityTracker )
{
_activityTracker->setThreshold( _activityTracker->threshold()
+ FEEDBACK_REMINDER_INTERVAL );
}
}
void
KDirStatApp::feedbackMailSent()
{
KConfig * config = kapp->config();
config->setGroup( "Feedback" );
config->writeEntry( "mailSent", true );
config->sync();
}
bool
KDirStatApp::doFeedbackReminder()
{
KConfig * config = kapp->config();
config->setGroup( "Feedback" );
bool mailSent = config->readBoolEntry( "mailSent", false );
bool dontAsk = config->readBoolEntry( "dontAsk", false );
int remindersCount = config->readNumEntry ( "remindersCount", 0 );
return !mailSent && !dontAsk && remindersCount < 5;
}
void
KDirStatApp::statusMsg( const QString &text )
{
// Change status message permanently
statusBar()->clear();
statusBar()->changeItem( text, ID_STATUS_MSG );
}
void
KDirStatApp::contextMenu( KDirTreeViewItem * item, const QPoint &pos )
{
NOT_USED( item );
if ( _treeViewContextMenu )
_treeViewContextMenu->popup( pos );
}
void
KDirStatApp::contextMenu( KTreemapTile * tile, const QPoint &pos )
{
NOT_USED( tile );
if ( _treemapContextMenu )
_treemapContextMenu->popup( pos );
}
void
KDirStatApp::createTreemapView()
{
if ( ! _showTreemapView->isChecked() || ! _treeView->tree() )
return;
if ( _treemapView )
delete _treemapView;
_treemapView = new KTreemapView( _treeView->tree(), _splitter,
QSize( _splitter->width(), _treemapViewHeight ) );
CHECK_PTR( _treemapView );
connect( _treemapView, SIGNAL( contextMenu( KTreemapTile *, const QPoint & ) ),
this, SLOT ( contextMenu( KTreemapTile *, const QPoint & ) ) );
connect( _treemapView, SIGNAL( treemapChanged() ),
this, SLOT ( updateActions() ) );
connect( _treemapView, SIGNAL( selectionChanged( KFileInfo * ) ),
this, SLOT ( selectionChanged( KFileInfo * ) ) );
if ( _activityTracker )
{
connect( _treemapView, SIGNAL( userActivity ( int ) ),
_activityTracker, SLOT ( trackActivity( int ) ) );
}
_treemapView->show(); // QSplitter needs explicit show() for new children
updateActions();
}
void
KDirStatApp::deleteTreemapView()
{
if ( _treemapView )
{
_treemapViewHeight = _treemapView->height();
delete _treemapView;
}
_treemapView = 0;
updateActions();
}
// EOF

@ -0,0 +1,421 @@
/*
* File name: kdirstatapp.h
* Summary: The KDirStat application - menu bar, tool bar, ...
* License: GPL - See file COPYING for details.
*
* Author: Stefan Hundhammer <sh@suse.de>
* Parts auto-generated by KDevelop
*
* Updated: 2004-12-06
*/
#ifndef KDirStatApp_h
#define KDirStatApp_h
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <kapp.h>
#include <kmainwindow.h>
#include "kdirtree.h"
// Forward declarations
class QPopupMenu;
class QSplitter;
class KAction;
class KActivityTracker;
class KFeedbackDialog;
class KFeedbackDialog;
class KFeedbackQuestion;
class KPacMan;
class KPacMan;
class KRecentFilesAction;
class KToggleAction;
namespace KDirStat
{
class KCleanupCollection;
class KDirTreeView;
class KDirTreeViewItem;
class KFileInfo;
class KSettingsDialog;
class KTreemapView;
class KTreemapTile;
}
using namespace KDirStat;
/**
* The base class for KDirStat application windows. It sets up the main window
* and reads the config file as well as providing a menubar, toolbar and
* statusbar. An instance of KDirStatView creates your center view, which is
* connected to the window's Doc object. KDirStatApp reimplements the methods
* that KMainWindow provides for main window handling and supports full
* session management as well as using KActions.
*
* @see KMainWindow
* @see KApplication
* @see KConfig
*
* @author Source Framework Automatically Generated by KDevelop,
* (c) The KDevelop Team.
*
* @version KDevelop version 1.2 code generation
**/
class KDirStatApp : public KMainWindow
{
Q_OBJECT
public:
/**
* Construtor of KDirStatApp, calls all init functions to create the
* application.
**/
KDirStatApp( QWidget* parent=0, const char* name=0 );
/**
* Destructor.
**/
virtual ~KDirStatApp();
/**
* Open an URL specified by command line argument.
**/
void openURL( const KURL & url );
/**
* Return the main window's @ref KDirTreeView.
**/
KDirTreeView * treeView() const { return _treeView; }
/**
* Returns the main window's @ref KTreemapView or 0 if there is none.
*
* Caution: Do not try to cache this value. The treemap view is destroyed
* and re-created frequently!
**/
KTreemapView * treemapView() const { return _treemapView; }
public slots:
/**
* Open a directory tree.
**/
void fileAskOpenDir();
/**
* Open a (possibly remote) directory tree.
**/
void fileAskOpenUrl();
/**
* Refresh the entire directory tree, i.e. re-read everything from disk.
**/
void refreshAll();
/**
* Refresh the selected subtree, i.e. re-read it from disk.
**/
void refreshSelected();
/**
* Refresh the entire directory tree, i.e. re-read everything from disk.
**/
void stopReading();
/**
* Open a directory tree from the "recent" menu.
**/
void fileOpenRecent( const KURL& url );
/**
* asks for saving if the file is modified, then closes the current file
* and window
**/
void fileCloseDir();
/**
* put the marked text/object into the clipboard
**/
void editCopy();
/**
* Notification that the view's selection has changed.
* Enable/disable user actions as appropriate.
**/
void selectionChanged( KFileInfo *selection );
/**
* Ask user what application to open a file or directory with
**/
void cleanupOpenWith();
/**
* Toggle tool bar
**/
void toggleToolBar();
/**
* Toggle status bar
**/
void toggleStatusBar();
/**
* Toggle treemap view
**/
void toggleTreemapView();
/**
* Zoom in the treemap at the currently selected tile.
**/
void treemapZoomIn();
/**
* Zoom out the treemap after zooming in.
**/
void treemapZoomOut();
/**
* Select the parent of the currently selected treemap tile.
**/
void treemapSelectParent();
/**
* Rebuild the treemap.
**/
void treemapRebuild();
/**
* Invoke online help about treemaps.
**/
void treemapHelp();
/**
* Open settings dialog
**/
void preferences();
/**
* Changes the statusbar contents for the standard label permanently, used
* to indicate current actions.
*
* @param text the text that is displayed in the statusbar
**/
void statusMsg( const QString &text );
/**
* Opens a context menu for tree view items.
**/
void contextMenu( KDirTreeViewItem * item, const QPoint &pos );
/**
* Opens a context menu for treemap tiles.
**/
void contextMenu( KTreemapTile * tile, const QPoint &pos );
/**
* Create a treemap view. This makes only sense after a directory tree is
* completely read.
**/
void createTreemapView();
/**
* Delete an existing treemap view if there is one.
**/
void deleteTreemapView();
/**
* Sends a user feedback mail.
**/
void sendFeedbackMail();
/**
* Read configuration for the main window.
**/
void readMainWinConfig();
/**
* Save the main window's configuration.
**/
void saveMainWinConfig();
/**
* Revert all cleanups to default values.
**/
void revertCleanupsToDefaults();
/**
* For the settings dialog only: Return the internal cleanup collection.
**/
KCleanupCollection * cleanupCollection() { return _cleanupCollection; }
/**
* Initialize @ref KPacMan animation in the tool bar.
**/
void initPacMan( bool enablePacMan = true );
/**
* Returns true if the pacman animation in the tool bar is enabled, false
* otherwise.
**/
bool pacManEnabled() const { return _pacMan != 0; }
/**
* Ask user if he wouldn't like to rate this program.
**/
void askForFeedback();
/**
* Notification that a feedback mail has been sent, thus don't remind
* the user any more.
**/
void feedbackMailSent();
/**
* Update enabled/disabled state of the user actions.
**/
void updateActions();
signals:
/**
* Emitted when the configuration is to be read - other than at program
* startup / object creation where each object is responsible for reading
* its configuraton at an appropriate time.
**/
void readConfig();
/**
* Emitted when the configuration is to be saved.
**/
void saveConfig();
protected:
/**
* Initialize the KActions of the application.
**/
void initActions();
/**
* Initialize @ref KCleanup actions.
**/
void initCleanups();
/**
* Set up status bar for the main window by initializing a status label.
**/
void initStatusBar();
/**
* Set up the activity tracker.
**/
void initActivityTracker();
/**
* Called when a main window is to be closed.
*
* Returns "true" when closing this window is OK, "false" to abort closing.
**/
virtual bool queryClose();
/**
* Called when the application is to be shut down alltogether, i.e. when
* all windows are to be closed.
*
* Returns "true" when exiting is OK, "false" otherwise.
**/
virtual bool queryExit();
/**
* Save the window properties for each open window during session end to
* the session config file, including saving the currently opened file by a
* temporary filename provided by KApplication.
*
* @see KTMainWindow#saveProperties
**/
virtual void saveProperties( KConfig * config );
/**
* Reads session config file and restore application state including the
* last opened files and documents by reading the temporary files saved by
* saveProperties().
*
* @see KTMainWindow#readProperties
**/
virtual void readProperties( KConfig * config );
/**
* Add a list of features of this program to a feedback question
**/
void addFeatureList( KFeedbackQuestion * question );
/**
* Check if the user should be reminded to submit feedback.
**/
bool doFeedbackReminder();
//
// Data members
//
// Widgets
QSplitter * _splitter;
KDirTreeView * _treeView;
KTreemapView * _treemapView;
KPacMan * _pacMan;
QWidget * _pacManDelimiter;
QPopupMenu * _treeViewContextMenu;
QPopupMenu * _treemapContextMenu;
KDirStat::KSettingsDialog * _settingsDialog;
KFeedbackDialog * _feedbackDialog;
KActivityTracker * _activityTracker;
// Actions
KAction * _fileAskOpenDir;
KAction * _fileAskOpenUrl;
KRecentFilesAction * _fileOpenRecent;
KAction * _fileCloseDir;
KAction * _fileRefreshAll;
KAction * _fileRefreshSelected;
KAction * _fileContinueReadingAtMountPoint;
KAction * _fileStopReading;
KAction * _fileQuit;
KAction * _editCopy;
KAction * _cleanupOpenWith;
KAction * _treemapZoomIn;
KAction * _treemapZoomOut;
KAction * _treemapSelectParent;
KAction * _treemapRebuild;
KAction * _reportMailToOwner;
KAction * _helpSendFeedbackMail;
KToggleAction * _showToolBar;
KToggleAction * _showStatusBar;
KToggleAction * _showTreemapView;
KCleanupCollection * _cleanupCollection;
// Misc
int _treemapViewHeight;
};
#endif // KDirStatApp_h

@ -0,0 +1,184 @@
/*
* File name: kdirstatfeedback.cpp
* Summary: User feedback questions for KDirStat
* License: GPL - See file COPYING for details.
*
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#include <klocale.h>
#include "kdirstatapp.h"
#include "kfeedback.h"
void
KDirStatApp::sendFeedbackMail()
{
if ( ! _feedbackDialog )
{
_feedbackDialog = new KFeedbackDialog( "sh@suse.de", "feedback_mail" );
CHECK_PTR( _feedbackDialog );
connect( _feedbackDialog->form(), SIGNAL( mailSent() ),
this, SLOT( feedbackMailSent() ) );
KFeedbackQuestionList * list = _feedbackDialog->form()->questionList();
KFeedbackQuestion * question =
list->addQuestion( i18n( "What is your general opinion about this program?" ), "general_opinion", true, true );
question->addAnswer( i18n( "It's one of my favourites" ), "1/8_favourite" );
question->addAnswer( i18n( "I like it" ), "2/8_like_it" );
question->addAnswer( i18n( "It's sometimes useful" ), "3/8_sometimes_useful" );
question->addAnswer( i18n( "It's average" ), "4/8_average" );
question->addAnswer( i18n( "Nice try, but this could be done better" ), "5/8_nice_try" );
question->addAnswer( i18n( "It's poor" ), "6/8_poor" );
question->addAnswer( i18n( "It's useless" ), "7/8_useless" );
question->addAnswer( i18n( "It's crap" ), "8/8_crap" );
question = list->addQuestion( i18n( "Which features of this program do you like?" ), "features_liked", false );
addFeatureList( question );
question = list->addQuestion( i18n( "Which features don't you like?" ), "features_not_liked", false );
addFeatureList( question );
question = list->addQuestion( i18n( "Which features do you never use?" ), "features_never_used", false );
addFeatureList( question );
question = list->addQuestion( i18n( "What is your favourite feature?" ), "favourite_feature", true );
addFeatureList( question );
question = list->addQuestion( i18n( "Are there features you are missing?" ), "features_missing", true );
question->addAnswer( i18n( "Yes, a lot! (please add comment below)" ), "1/4_lots" );
question->addAnswer( i18n( "Some (please add comment below)" ), "2/4_some" );
question->addAnswer( i18n( "None" ), "3/4_none" );
question->addAnswer( i18n( "It has too many features already!" ), "4/4_too_many_already" );
question = list->addQuestion( i18n( "How do you rate the stability of this program?" ), "stability", true, true );
question->addAnswer( i18n( "Rock solid" ), "1/5_rock_solid" );
question->addAnswer( i18n( "Good" ), "2/5_good" );
question->addAnswer( i18n( "Average" ), "3/5_average" );
question->addAnswer( i18n( "Poor" ), "4/5_poor" );
question->addAnswer( i18n( "It keeps crashing all the time" ), "5/5_keeps_crashing" );
question = list->addQuestion( i18n( "How do you rate the performance of this program?" ), "performance", true );
question->addAnswer( i18n( "Great" ), "1/5_great" );
question->addAnswer( i18n( "Good" ), "2/5_good" );
question->addAnswer( i18n( "Average" ), "3/5_average" );
question->addAnswer( i18n( "Poor" ), "4/5_poor" );
question->addAnswer( i18n( "It's so slow it drives me nuts" ), "5/5_drives_me_nuts" );
question = list->addQuestion( i18n( "What is your experience with computers in general?" ), "computer_experience", true );
question->addAnswer( i18n( "Expert" ), "1/5_expert" );
question->addAnswer( i18n( "Fair" ), "2/5_fair" );
question->addAnswer( i18n( "Average" ), "3/5_average" );
question->addAnswer( i18n( "Learning" ), "4/5_learning" );
question->addAnswer( i18n( "Newbie" ), "5/5_newbie" );
question = list->addQuestion( i18n( "What is your experience with Unix/Linux systems?" ), "unix_experience", true );
question->addAnswer( i18n( "Expert" ), "1/5_expert" );
question->addAnswer( i18n( "Fair" ), "2/5_fair" );
question->addAnswer( i18n( "Average" ), "3/5_average" );
question->addAnswer( i18n( "Learning" ), "4/5_learning" );
question->addAnswer( i18n( "Newbie" ), "5/5_newbie" );
question = list->addQuestion( i18n( "Did you have trouble figuring out how to work with this program in general?" ),
"learning_curve", true, true );
question->addAnswer( i18n( "No problem" ), "1/5_no_problem" );
question->addAnswer( i18n( "Some" ), "2/5_some_problems" );
question->addAnswer( i18n( "I'm still learning" ), "3/5_still_learing" );
question->addAnswer( i18n( "I didn't have a clue what to do at first" ), "4/5_no_clue_at_first" );
question->addAnswer( i18n( "I still don't have a clue what to do" ), "5/5_still_no_clue" );
question = list->addQuestion( i18n( "Where do you use this program most?" ), "usage_where", true );
question->addAnswer( i18n( "At work" ), "at_work" );
question->addAnswer( i18n( "At home" ), "at_home" );
question->addAnswer( i18n( "At university / school" ), "university" );
question = list->addQuestion( i18n( "What is your primary role there?" ), "primary_role", true );
question->addAnswer( i18n( "Home user" ), "home_user" );
question->addAnswer( i18n( "Student" ), "student" );
question->addAnswer( i18n( "Educational (teacher / professor)" ), "educational" );
question->addAnswer( i18n( "Non-computer related work" ), "non_computer" );
question->addAnswer( i18n( "Developer" ), "developer" );
question->addAnswer( i18n( "System administrator" ), "sysadmin" );
question = list->addQuestion( i18n( "Do you have any other roles there?" ), "other_roles", false );
question->addAnswer( i18n( "Home user" ), "home_user" );
question->addAnswer( i18n( "Student" ), "student" );
question->addAnswer( i18n( "Educational (teacher / professor)" ), "educational" );
question->addAnswer( i18n( "Non-computer related work" ), "non_computer" );
question->addAnswer( i18n( "Developer" ), "developer" );
question->addAnswer( i18n( "System administrator" ), "sysadmin" );
question = list->addQuestion( i18n( "How did you get to know this program?" ), "first_contact", true );
question->addAnswer( i18n( "In a menu on my machine" ), "menu" );
question->addAnswer( i18n( "Somebody told me about it" ), "told" );
question->addAnswer( i18n( "On the internet" ), "internet" );
question->addAnswer( i18n( "Printed magazine / book" ), "print_media" );
question->addAnswer( i18n( "Other (please add comment below)" ), "other" );
list->addYesNoQuestion( i18n( "Did you ever get a KDirStat mail report telling you to clean up disk space?" ),
"got_mail_report" );
question = list->addQuestion( i18n( "Could you figure yet out how to work with the treemaps?" ), "learning_treemaps", true );
question->addAnswer( i18n( "I became an expert at it" ), "1/5_expert" );
question->addAnswer( i18n( "I got a fairly good idea of it" ), "2/5_ok" );
question->addAnswer( i18n( "I'm still learning" ), "3/5_still_learing" );
question->addAnswer( i18n( "I still don't have a clue what to do" ), "4/5_no_clue" );
question->addAnswer( i18n( "Treemaps? Huh? What the hell is that?" ), "5/5_say_what" );
question = list->addQuestion( i18n( "What do you think about the treemaps?" ), "treemaps", false );
question->addAnswer( i18n( "They are useless" ), "useless" );
question->addAnswer( i18n( "The display is confusing" ), "display_confusing" );
question->addAnswer( i18n( "They look ugly" ), "look_ugly" );
question->addAnswer( i18n( "They look nice" ), "look_nice" );
question->addAnswer( i18n( "They help finding large files" ), "good_for_large_files" );
question->addAnswer( i18n( "I could do with the treemap view alone" ), "treemaps_alone" );
question->addAnswer( i18n( "The combination of tree view and treemaps is great" ), "like_combined_views");
question->addAnswer( i18n( "I want more info inside the treemap view" ), "more_info" );
question->addAnswer( i18n( "Leave the treemaps as they are right now" ), "leave_like_this" );
list->addYesNoQuestion( i18n( "Would you recommend this program to a friend?" ), "recommend", true );
}
if ( ! _feedbackDialog->isVisible() )
_feedbackDialog->show();
}
void
KDirStatApp::addFeatureList( KFeedbackQuestion * question )
{
question->addAnswer( i18n( "The directory tree display in general" ), "tree_view" );
question->addAnswer( i18n( "Percentage bars as graphical display of relative sizes" ), "percentage_bars" );
question->addAnswer( i18n( "Files apart from directories in a separate <Files> item"), "files_item" );
question->addAnswer( i18n( "Treemaps in general" ), "treemaps" );
question->addAnswer( i18n( "The cushioned treemap rendering" ), "treemap_cushions" );
question->addAnswer( i18n( "Cleanup actions in general" ), "cleanups_general" );
question->addAnswer( i18n( "Predefined cleanup actions" ), "predefined_cleanups" );
question->addAnswer( i18n( "User defined cleanup actions" ), "user_cleanups" );
question->addAnswer( i18n( "Cleanup action configuration" ), "cleanup_config" );
question->addAnswer( i18n( "Different colors in percentage bars" ), "tree_colors" );
question->addAnswer( i18n( "Tree color configuration" ), "tree_color_config" );
question->addAnswer( i18n( "Staying on one file system" ), "stay_on_one_filesys" );
question->addAnswer( i18n( "The \"mail to owner\" facility" ), "mail_to_owner" );
question->addAnswer( i18n( "This \"feedback mail\" facility" ), "feedback" );
question->addAnswer( i18n( "Human readable sizes (kB, MB, ...)" ), "human_readable_sizes" );
question->addAnswer( i18n( "All the numbers in the tree display" ), "numeric_display" );
question->addAnswer( i18n( "Last change time of an entire directory tree" ), "last_change_time" );
question->addAnswer( i18n( "The PacMan animation" ), "pacman" );
}
// EOF

@ -0,0 +1,115 @@
/*
* File name: kdirstatmain.cpp
* Summary: Main program for KDirStat
* License: GPL - See file COPYING for details.
*
* Author: Stefan Hundhammer <sh@suse.de>
* Parts auto-generated by KDevelop
*
* Updated: 2003-01-07
*/
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include "kdirstatapp.h"
static const char *description =
I18N_NOOP("KDirStat - Directory statistics.\n"
"\n"
"Shows where all your disk space has gone\n"
"and helps you clean it up."
"\n"
"\n"
"\n"
"If you have any comments or if you would simply like to tell your opinion\n"
"about this program, please use \"Send Feedback Mail\" from the \"Help\" menu.\n"
"\n"
"Any feedback (even negative!) is appreciated."
);
static KCmdLineOptions options[] =
{
{ "+[Dir/URL]", I18N_NOOP("Directory or URL to open"), 0 },
{ 0, 0, 0 }
};
int main(int argc, char *argv[])
{
KAboutData aboutData( "kdirstat", I18N_NOOP("KDirStat"),
VERSION, description, KAboutData::License_GPL,
"(c) 1999-2003 Stefan Hundhammer", 0, 0,
"sh@suse.de" );
aboutData.addAuthor( "Stefan Hundhammer",
I18N_NOOP("\n"
"If you have any comments or if you would simply like to tell\n"
"your opinion about this program, please use \n"
"\"Send Feedback Mail\" from the \"Help\" menu.\n"
"\n"
"Any feedback (even negative!) is appreciated." ),
"sh@suse.de", "http://kdirstat.sourceforge.net/" );
aboutData.addCredit( I18N_NOOP( "All the people who worked on SequoiaView" ),
I18N_NOOP( "for showing just how useful treemaps really can be.\n" ),
0, // e-mail
"http://www.win.tue.nl/sequoiaview" );
aboutData.addCredit( I18N_NOOP( "Jarke J. van Wijk, Huub van de Wetering, and Mark Bruls" ),
I18N_NOOP( "for their papers about treemaps.\n" ),
"vanwijk@win.tue.nl",
"http://www.win.tue.nl/~vanwijk/" );
aboutData.addCredit( "Ben Shneiderman",
I18N_NOOP( "for his ingenious idea of treemaps -\n"
"a truly intuitive way of visualizing tree contents.\n" ),
"", // E-Mail
"http://www.cs.umd.edu/hcil/treemaps/" );
aboutData.addCredit( "All the users who gave feedback of any kind",
I18N_NOOP( "for showing that all the work involved with such a project\n"
"is really appreciated out there.\n" ) );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication app;
if ( app.isRestored() )
{
RESTORE(KDirStatApp);
}
else
{
KDirStatApp *kdirstat = new KDirStatApp();
kdirstat->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->count() )
{
// Process command line arguments as URLs or paths to scan
KURL url = fixedUrl( args->arg( 0 ) );
// kdDebug() << "Opening " << url.url() << endl;
kdirstat->openURL( url );
}
else
{
kdirstat->fileAskOpenDir();
}
args->clear();
}
// kdDebug() << "Entering main loop" << endl;
return app.exec();
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,744 @@
/*
* File name: kdirstatsettings.h
* Summary: Settings dialog for KDirStat
* License: GPL - See file COPYING for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KDirStatSettings_h
#define KDirStatSettings_h
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <qlistbox.h>
#include <kdialogbase.h>
#include "kcleanup.h"
#include "kcleanupcollection.h"
#include "kdirstatapp.h"
class QCheckBox;
class QComboBox;
class QHGroupBox;
class QLabel;
class QLineEdit;
class QRadioButton;
class QSlider;
class QSpinBox;
class QVGroupBox;
class QWidget;
class KColorButton;
#define KDirStatSettingsMaxColorButton 12
namespace KDirStat
{
class KCleanupListBox;
class KCleanupPropertiesPage;
class KDirTreeView;
class KTreemapView;
/**
* Settings dialog for KDirStat
*
* @short Settings dialog for KDirStat
**/
class KSettingsDialog: public KDialogBase
{
Q_OBJECT
public:
/**
* Constructor.
*
* Notice there is no parent widget passed but the application's main
* window so its functions can be accessed. The parent of this widget
* is always 0 since this is a dialog.
**/
KSettingsDialog( KDirStatApp * mainWin );
/**
* Destructor.
**/
virtual ~KSettingsDialog();
/**
* Overwritten from @ref QDialog() to get any chance to set up the
* dialog contents when the dialog gets shown - every time, not just at
* program startup when the settings dialog is created (!).
*
* QTabDialog used to have 'aboutToShow()' for a good reason, but the
* creators of @ref KDialogBase in their infinite wisdom chose not to
* include anything similar. How is that supposed to work, anyway?
* Everything I saw in any other KDE sources looked to me like ugly
* hacks to work around this. Am I really supposed to destroy my
* settings dialog and create a new one every time it pops up? This can
* certainly not be the way to go.
*
* This overwritten show() method sends that @ref aboutToShow() signal
* before calling the parent class show() method.
**/
virtual void show();
public slots:
/**
* Reimplemented from @ref KDialogBase to ask for confirmation.
* Emits signal @ref defaultClicked() when the user confirms.
**/
virtual void slotDefault();
/**
* Reimplemented from @ref KDialogBase to set the appropriate help
* topic prior to invoking online help.
**/
virtual void slotHelp();
signals:
/**
* Emitted when (you might have guessed it) the dialog is about to be
* shown. Connect this to slots that fill the individual dialog pages'
* widgets contents (input fields etc.)
**/
void aboutToShow();
protected:
KDirStatApp * _mainWin;
int _cleanupsPageIndex;
int _treeColorsPageIndex;
int _treemapPageIndex;
int _generalSettingsPageIndex;
}; // class KSettingsDialog
/**
* Abstract base class for all settings pages. Contains stubs for methods
* that all settings pages have in common: setup(), apply(),
* revertToDefaults().
*
* Note: This class contains pure virtuals - it cannot be
* instantiated. Rather, derive your own classes from this one.
**/
class KSettingsPage: public QWidget
{
Q_OBJECT
public:
/**
* Constructor.
*
* Sets up standard connections to the methods defined in this class,
* e.g., apply(), setup(), revertToDefaults().
**/
KSettingsPage( KSettingsDialog * dialog,
QWidget * parent );
/**
* Destructor.
**/
virtual ~KSettingsPage();
public slots:
/**
* Apply the changes.
*
* Derived classes need to reimplement this method.
**/
virtual void apply() = 0;
/**
* Revert all values to their defaults.
*
* Derived classes need to reimplement this method.
**/
virtual void revertToDefaults() = 0;
/**
* Set up all fields prior to displaying the dialog.
*
* Derived classes need to reimplement this method.
**/
virtual void setup() = 0;
public:
/**
* Returns the page index of this page.
* This seems to be the only way to find out which settings page is in
* the foreground for a @ref KDialogBase page.
**/
int pageIndex() { return _pageIndex; }
protected:
int _pageIndex;
}; // class KSettingsPage
/**
* Settings tab page for the tree colors.
*
* Uses a vertical slider on the left side and a column of color
* selection buttons on the right side. The slider enables/disables
* the color buttons from top to bottom (at least one button is always
* enabled). Each button represents the percentage fill color of one
* directory level within the tree. When the tree widget runs out of
* colors (i.e. there are more directory levels than different
* colors), it will wrap around to the first color.
*
* @short settings page for tree colors
* @author Stefan Hundhammer <sh@suse.de>
**/
class KTreeColorsPage: public KSettingsPage
{
Q_OBJECT
public:
/**
* Constructor
**/
KTreeColorsPage( KSettingsDialog * dialog,
QWidget * parent,
KDirStatApp * mainWin );
/**
* Destructor
**/
virtual ~KTreeColorsPage();
public slots:
/**
* Apply the changes.
*
* Inherited from @ref KSettingsPage.
**/
virtual void apply();
/**
* Revert all values to their defaults.
*
* Inherited from @ref KSettingsPage.
**/
virtual void revertToDefaults();
/**
* Set up all fields prior to displaying the dialog.
*
* Inherited from @ref KSettingsPage.
**/
virtual void setup();
protected slots:
/**
* Enable all colors up to color no. 'maxColors'.
**/
void enableColors( int maxColors );
protected:
KDirStatApp * _mainWin;
KDirTreeView * _treeView;
QSlider * _slider;
KColorButton * _colorButton [ KDirStatSettingsMaxColorButton ];
QLabel * _colorLabel [ KDirStatSettingsMaxColorButton ];
int _maxButtons;
}; // class KTreeColorsPage
/**
* Settings tab page for cleanup actions.
*
* Uses a KCleanupListBox for selection of one cleanup action and a
* KCleanupPropertiesPage for editing this cleanup action's
* properties. This class handles just the switching between the individual
* cleanups. It copies the cleanup actions inserted and works with the
* copies only until it is requested to save the changes or revert all
* values to their defaults.
*
* @short settings page for cleanup actions
**/
class KCleanupPage: public KSettingsPage
{
Q_OBJECT
public:
/**
* Constructor
**/
KCleanupPage( KSettingsDialog * dialog,
QWidget * parent,
KDirStatApp * mainWin );
/**
* Destructor
**/
virtual ~KCleanupPage();
/**
* Insert an entry for a cleanup action. This is the original value
* that will be changed only when receiving the apply() or
* defaultValues() signals.
**/
void insert( KCleanup *cleanup );
/**
* Import all cleanup actions from the originals (from the main
* window) to internal working copies.
**/
void importCleanups();
/**
* Copy the internal working copies of the cleanup actions back to
* the main window's originals. Take care of pending changes within
* the current properties page's fields prior to that.
**/
void exportCleanups();
public slots:
/**
* Apply the changes.
*
* Inherited from @ref KSettingsPage.
**/
virtual void apply();
/**
* Revert all values to their defaults.
*
* Inherited from @ref KSettingsPage.
**/
virtual void revertToDefaults();
/**
* Set up all fields prior to displaying the dialog.
*
* Inherited from @ref KSettingsPage.
**/
virtual void setup();
/**
* Switch back and forth between all the cleanup actions very much
* like in a tab dialog: Exchange field contents of the cleanup
* properties page with the cleanup specified. Store the old
* properties page contents in the working copies of the cleanups.
**/
void changeCleanup( KCleanup * cleanup );
protected:
/**
* Retrieve any pending changes from the properties page and store
* them in the cleanup specified.
**/
void storeProps( KCleanup * cleanup );
//
// Data members
//
KCleanupListBox * _listBox;
KCleanupPropertiesPage * _props;
KDirStatApp * _mainWin;
KCleanupCollection _workCleanupCollection;
KCleanup * _currentCleanup;
}; // class KCleanupPage
/**
* List box for cleanup actions.
*
* This is meant as a substitute for a tabbed dialog inside the tabbed
* dialog which would be much too wide and possibly confusing. Plus, this
* list box is supposed to take care of its own geometry - the normal
* dumbass list box obviously cannot do that. It just uses some random
* geometry, relying on scroll bars for everything else. But in this
* special case we want all items to be visible at all times without scroll
* bars.
*
* @short cleanup list box
**/
class KCleanupListBox: public QListBox
{
Q_OBJECT
public:
/**
* Constructor.
**/
KCleanupListBox( QWidget * parent = 0 );
/**
* Destructor.
**/
virtual ~KCleanupListBox() {};
/**
* Reimplemented so we can make sure all items are visible at all times
* without scrolling. In fact, we never want to see a scroll bar with
* this kind of list box.
**/
virtual QSize sizeHint() const;
/**
* Insert an entry for a cleanup action into the list box. Uses the
* cleanup action's internally stored title for display.
**/
void insert( KCleanup * cleanup );
/**
* Returns the currently selected cleanup of 0 if nothing is selected.
**/
KCleanup * selection() { return _selection; }
/**
* Update the list item's text that corresponds to 'cleanup' - the user
* may have entered a new cleanup name. '0' means "check all items".
**/
void updateTitle( KCleanup * cleanup = 0 );
signals:
/**
* Emitted when the user selects a list item, i.e. a cleanup action.
**/
void selectCleanup( KCleanup * cleanup );
protected slots:
/**
* Select an item.
**/
void selectCleanup( QListBoxItem * item );
protected:
KCleanup * _selection;
}; // class KCleanupListBox
/**
* List box item for a KCleanupListBox.
**/
class KCleanupListBoxItem: public QListBoxText
{
public:
/**
* Constructor.
**/
KCleanupListBoxItem( KCleanupListBox * listBox,
KCleanup * cleanup );
/**
* Returns the corresponding cleanup.
**/
KCleanup * cleanup() { return _cleanup; }
/**
* Update the list box display with the cleanup's name which may have
* changed - the user may have entered a new one.
**/
void updateTitle();
protected:
// Data members
KCleanup * _cleanup;
}; // class KCleanupListBoxItem
/**
* Properties page for one cleanup action.
**/
class KCleanupPropertiesPage: public QWidget
{
Q_OBJECT
public:
/**
* Constructor
**/
KCleanupPropertiesPage( QWidget * parent,
KDirStatApp * mainWin );
/**
* Retrieve the page's fields' values and store them in the cleanup
* action.
**/
KCleanup fields( void ) const;
public slots:
/**
* Set the page's fields' values with the cleanup action's
* contents.
**/
void setFields( const KCleanup * cleanup );
/**
* Enable / disable all of the properties page's fields except the
* 'enabled' check box.
**/
void enableFields( bool active );
protected:
QString _id;
QCheckBox * _enabled;
QWidget * _fields;
QLineEdit * _title;
QLineEdit * _command;
QCheckBox * _recurse;
QCheckBox * _askForConfirmation;
QCheckBox * _worksForDir;
QCheckBox * _worksForFile;
QCheckBox * _worksForDotEntry;
QComboBox * _worksForProtocols;
QComboBox * _refreshPolicy;
KDirStatApp * _mainWin;
}; // class KCleanupPropertiesPage
/**
* Settings tab page for general/misc settings.
**/
class KGeneralSettingsPage: public KSettingsPage
{
Q_OBJECT
public:
/**
* Constructor
**/
KGeneralSettingsPage( KSettingsDialog * dialog,
QWidget * parent,
KDirStatApp * mainWin );
/**
* Destructor
**/
virtual ~KGeneralSettingsPage();
public slots:
/**
* Apply the changes.
*
* Inherited from @ref KSettingsPage.
**/
virtual void apply();
/**
* Revert all values to their defaults.
*
* Inherited from @ref KSettingsPage.
**/
virtual void revertToDefaults();
/**
* Set up all fields prior to displaying the dialog.
*
* Inherited from @ref KSettingsPage.
**/
virtual void setup();
/**
* Check the enabled state of all widgets depending on the value of
* other widgets.
**/
void checkEnabledState();
protected:
// Data members
KDirStatApp * _mainWin;
KDirTreeView * _treeView;
QCheckBox * _crossFileSystems;
QCheckBox * _enableLocalDirReader;
QCheckBox * _enableToolBarAnimation;
QCheckBox * _enableTreeViewAnimation;
}; // class KGeneralSettingsPage
/**
* Settings tab page for treemap settings.
**/
class KTreemapPage: public KSettingsPage
{
Q_OBJECT
public:
/**
* Constructor
**/
KTreemapPage( KSettingsDialog * dialog,
QWidget * parent,
KDirStatApp * mainWin );
/**
* Destructor
**/
virtual ~KTreemapPage();
public slots:
/**
* Apply the changes.
*
* Inherited from @ref KSettingsPage.
**/
virtual void apply();
/**
* Revert all values to their defaults.
*
* Inherited from @ref KSettingsPage.
**/
virtual void revertToDefaults();
/**
* Set up all fields prior to displaying the dialog.
*
* Inherited from @ref KSettingsPage.
**/
virtual void setup();
/**
* Check the enabled state of all widgets depending on the value of
* other widgets.
**/
void checkEnabledState();
protected:
/**
* Returns the main window's current treemap view or 0 if there is
* none. Don't cache this value, it changes frequently!
**/
KTreemapView * treemapView() const { return _mainWin->treemapView(); }
/**
* Convenience method to read a color from 'config'.
**/
QColor readColorEntry( KConfig * config,
const char * entryName,
QColor defaultColor );
// Data members
KDirStatApp * _mainWin;
// Widgets
QCheckBox * _squarify;
QCheckBox * _doCushionShading;
QVGroupBox * _cushionParams;
QSlider * _ambientLight;
QSpinBox * _ambientLightSB;
QSlider * _heightScalePercent;
QSpinBox * _heightScalePercentSB;
QCheckBox * _ensureContrast;
QCheckBox * _forceCushionGrid;
KColorButton * _cushionGridColor;
QLabel * _cushionGridColorL;
QHGroupBox * _plainTileParams;
KColorButton * _fileFillColor;
KColorButton * _dirFillColor;
KColorButton * _outlineColor;
KColorButton * _highlightColor;
QSpinBox * _minTileSize;
QCheckBox * _autoResize;
}; // class KTreemapPage
} // namespace KDirStat
/**
* Add a horizontal stretch widget to take all excess space.
**/
void addHStretch( QWidget * parent );
/**
* Add a vertical stretch widget to take all excess space.
**/
void addVStretch( QWidget * parent );
#endif // ifndef KDirStatSettings_h
// EOF

@ -0,0 +1,189 @@
<!-- Emacs: -*-xml-*- [must remain in first line!] -->
<!-- -->
<!-- XML GUI description file for KDirStat -->
<!-- -->
<!-- Author: Stefan Hundhammer (sh@suse.de) -->
<!-- Updated: 2004-12-06 -->
<!DOCTYPE kpartgui>
<!-- DOCTYPE kpartgui SYSTEM "kpartgui.dtd" would be correct, but -->
<!-- unfortunately, the DTD isn't installed anywhere, so this only confuses any -->
<!-- XML/SGML tools like Emacs PSGML mode :-( -->
<kpartgui name="kdirstat" version="1.8.2">
<MenuBar>
<Menu name="file" noMerge="1"> <text>&amp;File</text>
<Action name="file_open" />
<Action name="file_open_url" />
<Action name="file_open_recent" />
<Action name="file_refresh_all"/>
<Action name="file_refresh_selected"/>
<Action name="file_continue_reading_at_mount_point"/>
<Action name="file_stop_reading"/>
<Separator/>
<Action name="file_close"/>
<Action name="file_quit"/>
</Menu>
<Menu name="cleanup" noMerge="1"> <text>Clean &amp;Up</text>
<TearOffHandle/>
<Action name="cleanup_open_with"/>
<Separator/>
<Action name="cleanup_open_in_konqueror"/>
<Action name="cleanup_open_in_terminal"/>
<Action name="cleanup_compress_subtree"/>
<Action name="cleanup_make_clean"/>
<Action name="cleanup_delete_trash"/>
<Action name="cleanup_move_to_trash_bin"/>
<Action name="cleanup_hard_delete"/>
<Separator/>
<Action name="cleanup_user_defined_0"/>
<Action name="cleanup_user_defined_1"/>
<Action name="cleanup_user_defined_2"/>
<Action name="cleanup_user_defined_3"/>
<Action name="cleanup_user_defined_4"/>
<Action name="cleanup_user_defined_5"/>
<Action name="cleanup_user_defined_6"/>
<Action name="cleanup_user_defined_7"/>
<Action name="cleanup_user_defined_8"/>
<Action name="cleanup_user_defined_9"/>
</Menu>
<Menu name="treemap" noMerge="1"> <text>&amp;Treemap</text>
<TearOffHandle/>
<Action name="options_show_treemap"/>
<Separator/>
<Action name="treemap_zoom_in"/>
<Action name="treemap_zoom_out"/>
<Action name="treemap_select_parent"/>
<Action name="treemap_rebuild"/>
<Separator/>
<Action name="treemap_help"/>
</Menu>
<Menu name="settings" noMerge="1"> <text>&amp;Settings</text>
<Action name="options_show_treemap"/>
<Action name="options_show_toolbar"/>
<Action name="options_show_statusbar"/>
<Action name="options_configure"/>
</Menu>
<Menu name="report" noMerge="1"> <text>&amp;Report</text>
<Action name="report_mail_to_owner"/>
</Menu>
<Menu name="help" noMerge="1"> <text>&amp;Help</text>
<Action name="help_contents"/>
<Action name="help_whats_this"/>
<Separator/>
<Action name="help_report_bug"/>
<Action name="help_send_feedback_mail"/>
<Separator/>
<Action name="help_about_app"/>
<Action name="help_about_kde"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar" fullWidth="true" noMerge="1"> <text>Main Toolbar</text>
<Action name="file_open" group="file_operations" />
<Action name="file_refresh_all" group="file_operations" />
<Action name="file_stop_reading" group="file_operations" />
<Separator/>
<Action name="edit_copy" group="edit_operations" />
<Action name="report_mail_to_owner" group="report_operations"/>
<Separator/>
<Action name="cleanup_open_in_konqueror" group="cleanup_operations"/>
<Action name="cleanup_open_in_terminal" group="cleanup_operations"/>
<Action name="cleanup_compress_subtree" group="cleanup_operations"/>
<Action name="cleanup_move_to_trash_bin" group="cleanup_operations"/>
<Action name="cleanup_hard_delete" group="cleanup_operations"/>
<Separator/>
<Action name="treemap_zoom_in" group="treemap_operations"/>
<Action name="treemap_zoom_out" group="treemap_operations"/>
</ToolBar>
<!-- Context menu for the tree view -->
<Menu name="treeViewContextMenu" noMerge="1">
<Action name="edit_copy" />
<Action name="report_mail_to_owner"/>
<Separator/>
<Action name="file_refresh_all"/>
<Action name="file_refresh_selected"/>
<Action name="file_continue_reading_at_mount_point"/>
<Separator/>
<Action name="cleanup_open_with"/>
<Separator/>
<Action name="cleanup_open_in_konqueror"/>
<Action name="cleanup_open_in_terminal"/>
<Action name="cleanup_compress_subtree"/>
<Action name="cleanup_make_clean"/>
<Action name="cleanup_delete_trash"/>
<Action name="cleanup_move_to_trash_bin"/>
<Action name="cleanup_hard_delete"/>
<Separator/>
<Action name="cleanup_user_defined_0"/>
<Action name="cleanup_user_defined_1"/>
<Action name="cleanup_user_defined_2"/>
<Action name="cleanup_user_defined_3"/>
<Action name="cleanup_user_defined_4"/>
<Action name="cleanup_user_defined_5"/>
<Action name="cleanup_user_defined_6"/>
<Action name="cleanup_user_defined_7"/>
<Action name="cleanup_user_defined_8"/>
<Action name="cleanup_user_defined_9"/>
</Menu>
<!-- Context menu for the treemap -->
<Menu name="treemapContextMenu" noMerge="1">
<Action name="treemap_zoom_in" />
<Action name="treemap_zoom_out"/>
<Action name="treemap_select_parent"/>
<Action name="treemap_rebuild"/>
<Separator/>
<Action name="treemap_help"/>
<Separator/>
<Action name="file_refresh_all"/>
<Separator/>
<Action name="cleanup_open_with"/>
<Separator/>
<Action name="cleanup_open_in_konqueror"/>
<Action name="cleanup_open_in_terminal"/>
<Action name="cleanup_compress_subtree"/>
<Action name="cleanup_make_clean"/>
<Action name="cleanup_delete_trash"/>
<Action name="cleanup_move_to_trash_bin"/>
<Action name="cleanup_hard_delete"/>
<Separator/>
<Action name="cleanup_user_defined_0"/>
<Action name="cleanup_user_defined_1"/>
<Action name="cleanup_user_defined_2"/>
<Action name="cleanup_user_defined_3"/>
<Action name="cleanup_user_defined_4"/>
<Action name="cleanup_user_defined_5"/>
<Action name="cleanup_user_defined_6"/>
<Action name="cleanup_user_defined_7"/>
<Action name="cleanup_user_defined_8"/>
<Action name="cleanup_user_defined_9"/>
</Menu>
<!-- Emacs Customization -->
<!-- Local Variables: -->
<!-- sgml-indent-step: 4 -->
<!-- End: -->
</kpartgui>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,417 @@
/*
* File name: kdirtreeiterators.h
* Summary: Support classes for KDirStat - KDirTree iterator classes
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#include "kdirtreeiterators.h"
#include "kdirtree.h"
using namespace KDirStat;
KFileInfoIterator::KFileInfoIterator( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy )
{
init( parent,
dotEntryPolicy,
true ); // callNext
}
KFileInfoIterator::KFileInfoIterator( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy,
bool callNext )
{
init( parent, dotEntryPolicy, callNext );
}
void
KFileInfoIterator::init( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy,
bool callNext )
{
_parent = parent;
_policy = dotEntryPolicy;
_current = 0;
_directChildrenProcessed = false;
_dotEntryProcessed = false;
_dotEntryChildrenProcessed = false;
if ( callNext )
next();
}
KFileInfoIterator::~KFileInfoIterator()
{
// NOP
}
void KFileInfoIterator::next()
{
if ( ! _directChildrenProcessed )
{
// Process direct children
_current = _current ? _current->next() : _parent->firstChild();
if ( ! _current )
{
_directChildrenProcessed = true;
next();
}
else
{
// kdDebug() << k_funcinfo << " direct child " << _current << endl;
}
}
else // _directChildrenProcessed
{
if ( ! _dotEntryProcessed )
{
// Process dot entry
_current = _policy == KDotEntryAsSubDir ? _parent->dotEntry() : 0;
_dotEntryProcessed = true;
if ( ! _current )
{
next();
}
else
{
// kdDebug() << k_funcinfo << " dot entry " << _current << endl;
}
}
else // Dot entry already processed or processing it not desired
{
if ( ! _dotEntryChildrenProcessed )
{
if ( _policy == KDotEntryTransparent )
{
// Process dot entry children
_current = _current ?
_current->next() :
( _parent->dotEntry() ? _parent->dotEntry()->firstChild() : 0 );
if ( ! _current )
{
_dotEntryChildrenProcessed = true;
}
else
{
// kdDebug() << k_funcinfo << " dot entry child " << _current << endl;
}
}
else // _policy != KDotEntryTransparent
{
_current = 0;
_dotEntryChildrenProcessed = true;
}
}
}
}
}
int
KFileInfoIterator::count()
{
int cnt = 0;
// Count direct children
KFileInfo *child = _parent->firstChild();
while ( child )
{
cnt++;
child = child->next();
}
// Handle the dot entry
switch ( _policy )
{
case KDotEntryTransparent: // Count the dot entry's children as well.
if ( _parent->dotEntry() )
{
child = _parent->dotEntry()->firstChild();
while ( child )
{
cnt++;
child = child->next();
}
}
break;
case KDotEntryAsSubDir: // The dot entry counts as one item.
if ( _parent->dotEntry() )
cnt++;
break;
case KDotEntryIgnore: // We're done.
break;
}
return cnt;
}
KFileInfoSortedIterator::KFileInfoSortedIterator( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy,
KFileInfoSortOrder sortOrder,
bool ascending )
: KFileInfoIterator( parent, dotEntryPolicy, false )
{
_sortOrder = sortOrder;
_ascending = ascending;
_initComplete = false;
_childrenList = 0;
_current = 0;
}
void
KFileInfoSortedIterator::delayedInit()
{
_childrenList = new KFileInfoList( _sortOrder, _ascending );
CHECK_PTR( _childrenList );
if ( _sortOrder == KSortByName )
{
makeDefaultOrderChildrenList();
}
else
{
makeChildrenList();
}
_current = _childrenList->first();
_initComplete = true;
}
KFileInfoSortedIterator::~KFileInfoSortedIterator()
{
if ( _childrenList )
delete _childrenList;
}
void KFileInfoSortedIterator::makeDefaultOrderChildrenList()
{
// Fill children list with direct children
KFileInfo *child = _parent->firstChild();
while ( child )
{
_childrenList->append( child );
child = child->next();
}
_childrenList->sort();
if ( _policy == KDotEntryAsSubDir && _parent->dotEntry() )
{
// Append dot entry to the children list
_childrenList->append( _parent->dotEntry() );
}
// Append the dot entry's children to the children list
if ( _policy == KDotEntryTransparent && _parent->dotEntry() )
{
// Create a temporary list for the dot entry children
KFileInfoList dotEntryChildrenList( _sortOrder, _ascending );
child = _parent->dotEntry()->firstChild();
while ( child )
{
dotEntryChildrenList.append( child );
child = child->next();
}
dotEntryChildrenList.sort();
// Now append all of this dot entry children list to the children list
child = dotEntryChildrenList.first();
while ( child )
{
_childrenList->append( child );
child = dotEntryChildrenList.next();
}
}
}
void
KFileInfoSortedIterator::makeChildrenList()
{
KFileInfoIterator it( _parent, _policy );
while ( *it )
{
_childrenList->append( *it );
++it;
}
_childrenList->sort();
}
KFileInfo *
KFileInfoSortedIterator::current()
{
if ( ! _initComplete )
delayedInit();
return _current;
}
void KFileInfoSortedIterator::next()
{
if ( ! _initComplete )
delayedInit();
_current = _childrenList->next();
}
bool
KFileInfoSortedIterator::finished()
{
if ( ! _initComplete )
delayedInit();
return _current == 0;
}
KFileInfoSortedBySizeIterator::KFileInfoSortedBySizeIterator( KFileInfo * parent,
KFileSize minSize,
KDotEntryPolicy dotEntryPolicy,
bool ascending )
: KFileInfoSortedIterator( parent, dotEntryPolicy, KSortByTotalSize, ascending )
, _minSize( minSize )
{
}
void
KFileInfoSortedBySizeIterator::makeChildrenList()
{
KFileInfoIterator it( _parent, _policy );
while ( *it )
{
if ( (*it)->totalSize() >= _minSize )
_childrenList->append( *it );
++it;
}
_childrenList->sort();
}
KFileInfoList::KFileInfoList( KFileInfoSortOrder sortOrder, bool ascending )
: QPtrList<KFileInfo>()
{
_sortOrder = sortOrder;
_ascending = ascending;
}
KFileInfoList::~KFileInfoList()
{
// NOP
}
KFileSize
KFileInfoList::sumTotalSizes()
{
KFileSize sum = 0;
KFileInfoListIterator it( *this );
while ( *it )
{
sum += (*it)->totalSize();
++it;
}
return sum;
}
int
KFileInfoList::compareItems( QCollection::Item it1, QCollection::Item it2 )
{
if ( it1 == it2 )
return 0;
KFileInfo *file1 = (KFileInfo *) it1;
KFileInfo *file2 = (KFileInfo *) it2;
int result = 0;
switch ( _sortOrder )
{
case KUnsorted:
return 1;
case KSortByName:
result = QString::compare( file1->name(), file2->name() );
break;
case KSortByTotalSize:
result = compare<KFileSize>( file1->totalSize(), file2->totalSize() );
break;
case KSortByLatestMtime:
result = compare<time_t>( file1->latestMtime(), file2->latestMtime() );
break;
}
return _ascending ? result : -result;
}
// EOF

@ -0,0 +1,386 @@
/*
* File name: kdirtreeiterators.h
* Summary: Support classes for KDirStat - KDirTree iterators
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-01-07
*/
#ifndef KDirTreeIterators_h
#define KDirTreeIterators_h
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "kdirtree.h"
namespace KDirStat
{
/**
* Policies how to treat a "dot entry" for iterator objects.
* See @ref KFileInfoIterator for details.
**/
typedef enum
{
KDotEntryTransparent, // Flatten hierarchy - move dot entry children up
KDotEntryAsSubDir, // Treat dot entry as ordinary subdirectory
KDotEntryIgnore // Ignore dot entry and its children completely
} KDotEntryPolicy;
typedef enum
{
KUnsorted,
KSortByName,
KSortByTotalSize,
KSortByLatestMtime
} KFileInfoSortOrder;
// Forward declarations
class KFileInfoList;
/**
* Iterator class for children of a @ref KFileInfo object. For optimum
* performance, this iterator class does NOT return children in any
* specific sort order. If you need that, use @ref KFileInfoSortedIterator
* instead.
*
* Sample usage:
*
* KFileInfoIterator it( node, KDotEntryTransparent );
*
* while ( *it )
* {
* kdDebug() << *it << ":\t" << (*it)->totalSize() ) << endl;
* ++it;
* }
*
* This will output the URL (path+name) and the total size of each (direct)
* subdirectory child and each (direct) file child of 'node'.
* Notice: This does not recurse into subdirectories!
*
* @short (unsorted) iterator for @ref KFileInfo children.
**/
class KFileInfoIterator
{
public:
/**
* Constructor: Initialize an iterator object to iterate over the
* children of 'parent' (unsorted!), depending on 'dotEntryPolicy':
*
* KDotEntryTransparent (default):
*
* Treat the dot entry as if it wasn't there - pretend to move all its
* children up to the real parent. This makes a directory look very
* much like the directory on disk, without the dot entry. 'current()'
* or 'operator*()' will never return the dot entry, but all of its
* children. Subdirectories will be processed before any file children.
*
* KDotEntryIsSubDir:
*
* Treat the dot entry just like any other subdirectory. Don't iterate
* over its children, too (unlike KDotEntryTransparent above).
* 'current()' or 'operator*()' will return the dot entry, but none of
* its children (unless, of course, you create an iterator with the dot
* entry as the parent).
*
* KDotEntryIgnore:
*
* Ignore the dot entry and its children completely. Useful if children
* other than subdirectories are not interesting anyway. 'current()'
* or 'operator*()' will never return the dot entry nor any of its
* children.
*
**/
KFileInfoIterator( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy = KDotEntryTransparent );
protected:
/**
* Alternate constructor to be called from derived classes: Those can
* choose not to call next() in the constructor.
**/
KFileInfoIterator ( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy,
bool callNext );
private:
/**
* Internal initialization called from any constructor.
**/
void init ( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy,
bool callNext );
public:
/**
* Destructor.
**/
virtual ~KFileInfoIterator();
/**
* Return the current child object or 0 if there is no more.
* Same as @ref operator*() .
**/
virtual KFileInfo * current() { return _current; }
/**
* Return the current child object or 0 if there is no more.
* Same as @ref current().
**/
KFileInfo * operator*() { return current(); }
/**
* Advance to the next child. Same as @ref operator++().
**/
virtual void next();
/**
* Advance to the next child. Same as @ref next().
**/
void operator++() { next(); }
/**
* Returns 'true' if this iterator is finished and 'false' if not.
**/
virtual bool finished() { return _current == 0; }
/**
* Check whether or not the current child is a directory, i.e. can be
* cast to @ref KDirInfo * .
**/
bool currentIsDir() { return _current && _current->isDirInfo(); }
/**
* Return the current child object cast to @ref KDirInfo * or 0 if
* there either is no more or it isn't a directory. Check with @ref
* currentIsDir() before using this!
**/
KDirInfo * currentDir() { return currentIsDir() ? (KDirInfo *) _current : 0; }
/**
* Return the number of items that will be processed.
* This is an expensive operation.
**/
int count();
protected:
KFileInfo * _parent;
KDotEntryPolicy _policy;
KFileInfo * _current;
bool _directChildrenProcessed;
bool _dotEntryProcessed;
bool _dotEntryChildrenProcessed;
}; // class KFileInfoIterator
/**
* Iterator class for children of a @ref KFileInfo object. This iterator
* returns children sorted by name: Subdirectories first, then the dot
* entry (if desired - depending on policy), then file children (if
* desired). Note: If you don't need the sorting feature, you might want to
* use @ref KFileItemIterator instead which has better performance.
*
* @short sorted iterator for @ref KFileInfo children.
**/
class KFileInfoSortedIterator: public KFileInfoIterator
{
public:
/**
* Constructor. Specify the sorting order with 'sortOrder' and 'ascending'.
* See @ref KFileInfoIterator for more details.
**/
KFileInfoSortedIterator( KFileInfo * parent,
KDotEntryPolicy dotEntryPolicy = KDotEntryTransparent,
KFileInfoSortOrder sortOrder = KSortByName,
bool ascending = true );
/**
* Destructor.
**/
virtual ~KFileInfoSortedIterator();
/**
* Return the current child object or 0 if there is no more.
*
* Inherited from @ref KFileInfoIterator.
* Overwritten to overcome some shortcomings of C++:
* Virtual methods cannot be used in the constructor.
**/
virtual KFileInfo * current();
/**
* Advance to the next child. Same as @ref operator++().
* Sort by name, sub directories first, then the dot entry (if
* desired), then files (if desired).
*
* Inherited from @ref KFileInfoIterator.
**/
virtual void next();
/**
* Returns 'true' if this iterator is finished and 'false' if not.
*
* Inherited from @ref KFileInfoIterator.
**/
virtual bool finished();
protected:
/**
* Delayed initialization for class parts that rely on availability of
* virtual methods. This is a kludge to overcome a major shortcoming of
* C++: Virtual methods are not available in the constructor yet.
* This is a neverending cause of trouble.
**/
void delayedInit();
/**
* Make a 'default order' children list:
* First all subdirectories sorted by name,
* then the dot entry (depending on policy),
* then the dot entry's children (depending on policy).
**/
virtual void makeDefaultOrderChildrenList();
/**
* Make a sorted children list according to the current sort
* criteria - unless KSortByName is requested, in which case
* makeDefaultOrderChildrenList() above is used.
**/
virtual void makeChildrenList();
// Data members
KFileInfoList * _childrenList;
KFileInfoSortOrder _sortOrder;
bool _ascending;
bool _initComplete;
}; // class KFileInfoSortedIterator
/**
* Specialized KFileInfo iterator that sorts by (total) size, yet
* disregards children below a minimum size. This can considerably improve
* performance if the number of children that need to be sorted decreases
* dramatically.
*
* For example, treemaps can only display a limited portion of large
* directory trees since the number of available pixels is very
* limited. Thus, files (or directories) below a certain size usually don't
* get a individual visual representation anyway, so they may as well be
* omitted right away - no need for expensive list sorting operations.
**/
class KFileInfoSortedBySizeIterator: public KFileInfoSortedIterator
{
public:
/**
* Constructor. Children below 'minSize' will be ignored by this iterator.
**/
KFileInfoSortedBySizeIterator( KFileInfo * parent,
KFileSize minSize = 0,
KDotEntryPolicy dotEntryPolicy = KDotEntryTransparent,
bool ascending = false );
/**
* Destructor.
**/
virtual ~KFileInfoSortedBySizeIterator() {};
protected:
/**
* Create the (sorted) children list. Disregard children below minSize.
* Reimplemented from KFileInfoSortedIterator.
**/
virtual void makeChildrenList();
// Data members
KFileSize _minSize;
}; // class KFileInfoSortedBySizeIterator
/**
* Internal helper class for sorting iterators.
**/
class KFileInfoList: public QPtrList<KFileInfo>
{
public:
/**
* Constructor.
**/
KFileInfoList( KFileInfoSortOrder sortOrder = KSortByName,
bool ascending = true );
/**
* Destructor.
**/
virtual ~KFileInfoList();
/**
* Returns the sum of all the total sizes in the list.
**/
KFileSize sumTotalSizes();
protected:
/**
* Comparison function. This is why this class is needed at all.
**/
virtual int compareItems( QCollection::Item it1, QCollection::Item it2 );
KFileInfoSortOrder _sortOrder;
bool _ascending;
};
typedef QPtrListIterator<KFileInfo> KFileInfoListIterator;
//----------------------------------------------------------------------
// Static Functions
//----------------------------------------------------------------------
/**
* Generic comparison function as expected by all kinds of sorting etc.
* algorithms. Requires operator<() and operator==() to be defined for this
* class.
**/
template<class T>
inline int compare( T val1, T val2 )
{
if ( val1 < val2 ) return -1;
else if ( val1 == val2 ) return 0;
else return 1;
}
} // namespace KDirStat
#endif // ifndef KDirTreeIterators_h
// EOF

File diff suppressed because it is too large Load Diff

@ -0,0 +1,889 @@
/*
* File name: kdirtreeview.h
* Summary: High level classes for KDirStat
* License: LGPL - See file COPYING.LIB for details.
* Author: Stefan Hundhammer <sh@suse.de>
*
* Updated: 2003-08-26
*/
#ifndef KDirTreeView_h
#define KDirTreeView_h
// Alternative parent class for KDirTreeView.
//
// If you change this, don't forget to change the KDirTreeView class
// declaration also. Unfortunately there this 'define' can't be used -
// it seems to confuse the 'moc' preprocessor.
#define USE_KLISTVIEW 0
#define DEBUG_COUNTERS 10
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <qdatetime.h>
#include <qlistview.h>
#include <qpixmap.h>
#include <klistview.h>
#include "kdirtree.h"
// Forward declarations
class QWidget;
class QTimer;
class QPopupMenu;
class KPacManAnimation;
// Open a new name space since KDE's name space is pretty much cluttered
// already - all names that would even remotely match are already used up,
// yet the resprective classes don't quite fit the purposes required here.
namespace KDirStat
{
#define KDirTreeViewMaxFillColor 16
#if USE_KLISTVIEW
# define KDirTreeViewParentClass KListView
#else
# define KDirTreeViewParentClass QListView
#endif
class KDirTreeViewItem;
class KDirTreeView: public QListView
// Using
// class KDirTreeView: public KDirTreeViewParentClass
// or some other 'ifdef' ... construct seems to confuse "moc".
{
Q_OBJECT
public:
/**
* Default constructor.
**/
KDirTreeView( QWidget * parent = 0 );
/**
* Destructor.
**/
virtual ~KDirTreeView();
/**
* Locate the counterpart to an original tree item "wanted" somewhere
* within this view tree. Returns 0 on failure.
* If "lazy" is set, only the open part of the tree is searched.
* "doClone" specifies whether or not to (deferred) clone nodes that
* are not cloned yet. This is only used if "lazy" is false.
**/
KDirTreeViewItem * locate( KFileInfo * wanted,
bool lazy = true,
bool doClone = true );
/**
* Get the first child of this view or 0 if there is none.
* Use the child's next() method to get the next child.
* Reimplemented from @ref QListView.
**/
KDirTreeViewItem * firstChild() const
{ return (KDirTreeViewItem *) KDirTreeViewParentClass::firstChild(); }
/**
* Return the currently selected item or 0, if none is selected.
**/
KDirTreeViewItem * selection() const { return _selection; }
/**
* Returns the default level until which items are opened by default
* (unless they are dot entries).
**/
int openLevel() const { return _openLevel; }
/**
* Returns true if the view tree is to be cloned lazily, i.e. only
* those view tree branches that are really visible are synced with the
* original tree.
**/
bool doLazyClone() const { return _doLazyClone; }
/**
* Enable / disable PacMan animation in this tree view during directory
* reading. This is disabled by default since it eats quite some
* performance.
**/
void enablePacManAnimation( bool enable ) { _doPacManAnimation = enable; }
/**
* Returns true if the PacMan animation is to be used during directory
* reading.
**/
bool doPacManAnimation() const { return _doPacManAnimation; }
/**
* Returns the number of open items in the entire tree.
**/
int openCount();
/**
* Return the percentage bar fill color for the specified directory
* level (0..MaxInt). Wraps around every usedFillColors() colors.
**/
const QColor & fillColor( int level ) const;
/**
* Very much like @ref fillColor(), but doesn't wrap around at @ref
* usedFillColors(), but at KDirTreeViewMaxFillColor.
**/
const QColor & rawFillColor( int level ) const;
/**
* Set the fill color of percentage bars of the specified directory
* level (0..KDirTreeViewMaxFillColor-1).
*
* Calling repaint() after setting all desired colors is the
* caller's responsibility.
**/
void setFillColor( int level, const QColor &color );
/**
* Set all tree colors to default values.
**/
void setDefaultFillColors();
/**
* Set the number of used percentage bar fill colors
* (1..KDirTreeViewMaxFillColor).
**/
void setUsedFillColors( int usedFillColors );
/**
* Returns the number of used percentage bar fill colors.
**/
int usedFillColors() const { return _usedFillColors; }
/**
* Set the tree background color.
*
* Calling repaint() after setting all desired colors is the
* caller's responsibility.
**/
void setTreeBackground( const QColor &color );
/**
* Returns the tree background color.
**/
const QColor & treeBackground() const { return _treeBackground; }
/**
* Returns the background color for percentage bars.
**/
const QColor & percentageBarBackground() const { return _percentageBarBackground; }
/**
* (Try to) ensure good contrast between the tree background and the
* percentage bars' 3D edges - prevent ugly 3D effects which will
* inevitably be the case for a white background (which unfortunately
* is very common): The percentage bars use white and black for 3D
* borders - like any other widget. But other widgets normally can
* assume their parent widget uses some more neutral color so white and
* black will result in at least some minimal contrast.
*
* This function automagically sets a reasonable default background
* color for the tree display: If the current color scheme's document
* background color (as used for input fields, lists etc.) is white or
* black, use the palette midlight color (the same color as "normal"
* widgets like push buttons etc., but brighter). For all other colors
* than white, the document background color (the palette base color)
* is used.
**/
void ensureContrast();
/**
* Set the sort column.
*
* Reimplemented from QListView so we can keep track of the sort column.
**/
virtual void setSorting( int column, bool increasing = TRUE );
/**
* Returns the internal @ref KDirTree this view works on.
* Handle with caution: This might be short-lived information.
* The view might choose to create a new tree shortly after returning
* this, so don't store this pointer internally.
**/
KDirTree *tree() { return _tree; }
int nameCol() const { return _nameCol; }
int iconCol() const { return _iconCol; }
int percentBarCol() const { return _percentBarCol; }
int percentNumCol() const { return _percentNumCol; }
int totalSizeCol() const { return _totalSizeCol; }
int workingStatusCol() const { return _workingStatusCol; }
int ownSizeCol() const { return _ownSizeCol; }
int totalItemsCol() const { return _totalItemsCol; }
int totalFilesCol() const { return _totalFilesCol; }
int totalSubDirsCol() const { return _totalSubDirsCol; }
int latestMtimeCol() const { return _latestMtimeCol; }
int readJobsCol() const { return _readJobsCol; }
int sortCol() const { return _sortCol; }
QPixmap openDirIcon() const { return _openDirIcon; }
QPixmap closedDirIcon() const { return _closedDirIcon; }
QPixmap openDotEntryIcon() const { return _openDotEntryIcon; }
QPixmap closedDotEntryIcon() const { return _closedDotEntryIcon; }
QPixmap unreadableDirIcon() const { return _unreadableDirIcon; }
QPixmap mountPointIcon() const { return _mountPointIcon; }
QPixmap fileIcon() const { return _fileIcon; }
QPixmap symLinkIcon() const { return _symLinkIcon; }
QPixmap blockDevIcon() const { return _blockDevIcon; }
QPixmap charDevIcon() const { return _charDevIcon; }
QPixmap fifoIcon() const { return _fifoIcon; }
QPixmap stopIcon() const { return _stopIcon; }
QPixmap workingIcon() const { return _workingIcon; }
QPixmap readyIcon() const { return _readyIcon; }
/**
* Set function name of debug function #i
**/
void setDebugFunc( int i, const QString & functionName );
/**
* Increase debug counter #i
**/
void incDebugCount( int i );
public slots:
/**
* Open a directory URL. Assume "file:" protocol unless otherwise specified.
**/
void openURL( KURL url );
/**
* Refresh (i.e. re-read from disk) the entire tree.
**/
void refreshAll();
/**
* Refresh (i.e. re-read from disk) the selected subtree.
**/
void refreshSelected();
/**
* Forcefully stop a running read process.
**/
void abortReading();
/**
* Clear this view's contents.
**/
void clear();
/**
* Select a (QListViewItem) item. Triggers selectionChanged() signals.
**/
void selectItem( QListViewItem *item );
/**
* Select an item. Triggers selectionChanged() signals.
* Overloaded for convenience.
**/
void selectItem( KDirTreeViewItem *item ) { selectItem( (QListViewItem *) item ); }
/**
* Select a KDirTree item. Used for connecting the @ref
* KDirTree::selectionChanged() signal.
**/
void selectItem( KFileInfo *item );
/**
* Clear the current selection. Triggers selectionChanged() signals.
**/
void clearSelection();
/**
* Close all tree branches except the one specified.
**/
void closeAllExcept( KDirTreeViewItem *except );
/**
* Send a standardized mail to the owner of the selected branch.
* The user will get a mailer window where he can edit that mail all he
* likes before deciding to send or discard it.
*
* The mail includes all currently open branches from the selected
* branch on.
**/
void sendMailToOwner();
/**
* Notification of a change in the KDE palette, i.e. the user selected
* and applied different colors in the KDE control center.
**/
void paletteChanged();
/**
* Read configuration and initialize variables accordingly.
* Will be called automatically in the constructor.
**/
void readConfig();
/**
* Save configuraton.
**/
void saveConfig() const;
/**
* Emit a @ref userActivity() signal worth 'points' activity points.
**/
void logActivity( int points );
/**
* Returns the minimum recommended size for this widget.
* Reimplemented from QWidget.
**/
virtual QSize minimumSizeHint() const { return QSize( 0, 0 ); }
protected slots:
/**
* Add a child as a clone of original tree item "newChild" to this view
* tree.
**/
void addChild ( KFileInfo *newChild );
/**
* Delete a cloned child.
**/
void deleteChild ( KFileInfo *newChild );
/**
* Recursively update the visual representation of the summary fields.
* This update is as lazy as possible for optimum performance since it
* is called very frequently as a cyclic update.
**/
void updateSummary();
/**
* Signal end of all read jobs, finalize display and terminate pending
* cyclic visual update.
**/
void slotFinished();
/**
* Signal abortion of all read jobs, finalize display and terminate pending
* cyclic visual update.
**/
void slotAborted();
/**
* Signal end of one read job at this level and finalize display of
* this level.
**/
void finalizeLocal( KDirInfo *dir );
/**
* Display progress information in the status bar. Automatically adds
* the elapsed time of a directory scan.
**/
void sendProgressInfo( const QString & currentDir = "" );
#if QT_VERSION < 300
/**
* "moc" doesnt't seem to handle default arguments well, so this is an
* overloaded slot that uses the internally stored current directory.
**/
void sendProgressInfo();
#endif
/**
* Set up everything prior to reading: Cyclic update timer, display
* busy state, default sorting, stopwatch.
**/
void prepareReading();
/**
* Change the tree display to "busy" state, i.e. add a column to
* display the number of pending read jobs for each level.
**/
void busyDisplay();
/**
* Change the tree display back to "idle" state, i.e. remove columns
* that are useful only while directories are being read, like the
* pending read jobs column.
**/
void idleDisplay();
/**
* Pop up context menu (i.e. emit the contextMenu() signal) or open a
* small info popup with exact information, depending on 'column'.
**/
void popupContextMenu ( QListViewItem * listViewItem,
const QPoint & pos,
int column );
/**
* Pop up info window with exact byte size.
**/
void popupContextSizeInfo ( const QPoint & pos,
KFileSize size );
/**
* Pop up info window with arbitrary one-line text.
**/
void popupContextInfo ( const QPoint & pos,
const QString & info );
protected slots:
/**
* Notification that a column has just been resized, thus may need
* repaining.
**/
void columnResized( int column, int oldSize, int newSize );
signals:
/**
* Single line progress information, emitted when the read status
* changes - typically when a new directory is being read. Connect to a
* status bar etc. to keep the user busy.
**/
void progressInfo( const QString &infoLine );
/**
* Emitted when reading is started.
**/
void startingReading();
/**
* Emitted when reading this tree is finished.
**/
void finished();
/**
* Emitted when reading this tree has been aborted.
**/
void aborted();
/**
* Emitted when the currently selected item changes.
* Caution: 'item' may be 0 when the selection is cleared.
**/
void selectionChanged( KDirTreeViewItem *item );
/**
* Emitted when the currently selected item changes.
* Caution: 'item' may be 0 when the selection is cleared.
**/
void selectionChanged( KFileInfo *item );
/**
* Emitted when a context menu for this item should be opened.
* (usually on right click). 'pos' contains the click's mouse
* coordinates.
*
* NOTE:
*
* This is _not_ the same as @ref QListView::rightButtonClicked():
* The context menu may not open on a right click on every column,
* usually only in the nameCol().
**/
void contextMenu( KDirTreeViewItem *item, const QPoint &pos );
/**
* Emitted at user activity. Some interactive actions are assigned an
* amount of "activity points" that can be used to judge whether or not
* the user is actually using this program or if it's just idly sitting
* around on the desktop. This is intended for use together with a @ref
* KActivityTracker.
**/
void userActivity( int points );
protected:
KDirTree * _tree;
QTimer * _updateTimer;
QTime _stopWatch;
QString _currentDir;
KDirTreeViewItem * _selection;
QPopupMenu * _contextInfo;
int _idContextInfo;
int _openLevel;
bool _doLazyClone;
bool _doPacManAnimation;
int _updateInterval; // millisec
int _usedFillColors;
QColor _fillColor [ KDirTreeViewMaxFillColor ];
QColor _treeBackground;
QColor _percentageBarBackground;
// The various columns in which to display information
int _nameCol;
int _iconCol;
int _percentNumCol;
int _percentBarCol;
int _totalSizeCol;
int _workingStatusCol;
int _ownSizeCol;
int _totalItemsCol;
int _totalFilesCol;
int _totalSubDirsCol;
int _latestMtimeCol;
int _readJobsCol;
int _sortCol;
int _debugCount[ DEBUG_COUNTERS ];
QString _debugFunc [ DEBUG_COUNTERS ];
// The various icons
QPixmap _openDirIcon;
QPixmap _closedDirIcon;
QPixmap _openDotEntryIcon;
QPixmap _closedDotEntryIcon;
QPixmap _unreadableDirIcon;
QPixmap _mountPointIcon;
QPixmap _fileIcon;
QPixmap _symLinkIcon;
QPixmap _blockDevIcon;
QPixmap _charDevIcon;
QPixmap _fifoIcon;
QPixmap _stopIcon;
QPixmap _workingIcon;
QPixmap _readyIcon;
};
class KDirTreeViewItem: public QListViewItem
{
public:
/**
* Constructor for the root item.
**/
KDirTreeViewItem ( KDirTreeView * view,
KFileInfo * orig );
/**
* Constructor for all other items.
**/
KDirTreeViewItem ( KDirTreeView * view,
KDirTreeViewItem * parent,
KFileInfo * orig );
/**
* Destructor.
**/
virtual ~KDirTreeViewItem();
/**
* Locate the counterpart to an original tree item "wanted" somewhere
* within this view tree. Returns 0 on failure.
*
* When "lazy" is set, only the open part of the tree is searched.
* "doClone" specifies whether or not to (deferred) clone nodes that
* are not cloned yet. This is only used if "lazy" is false.
* "Level" is just a hint for the current tree level for better
* performance. It will be calculated automatically if omitted.
**/
KDirTreeViewItem * locate( KFileInfo * wanted,
bool lazy = true,
bool doClone = true,
int level = -1 );
/**
* Recursively update the visual representation of the summary fields.
* This update is as lazy as possible for optimum performance.
**/
void updateSummary();