Browse Source

Added adept (KDE3 version abandoned by original author)

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/adept@1072021 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
commit
a4e1f41de2
  1. 12
      Makefile.am
  2. 11
      Makefile.am.in
  3. 12420
      acinclude.m4
  4. 13333
      aclocal.m4
  5. 29
      adept/COPYING
  6. 1
      adept/Makefile.am
  7. 2
      adept/NEWS
  8. 33
      adept/TODO
  9. 35
      adept/adept/Makefile.am
  10. 295
      adept/adept/acqprogress.cpp
  11. 127
      adept/adept/acqprogress.h
  12. 53
      adept/adept/acqprogresswidget.cpp
  13. 30
      adept/adept/acqprogresswidget.h
  14. 79
      adept/adept/acqprogresswidgetui.ui
  15. 43
      adept/adept/actor.h
  16. 350
      adept/adept/application.cpp
  17. 102
      adept/adept/application.h
  18. 145
      adept/adept/changelog.cpp
  19. 45
      adept/adept/changelog.h
  20. 117
      adept/adept/commitprogress.cpp
  21. 41
      adept/adept/commitprogress.h
  22. 197
      adept/adept/commitprogressui.ui
  23. 116
      adept/adept/desktopentryui.ui
  24. 194
      adept/adept/desktoplist.cpp
  25. 117
      adept/adept/desktoplist.h
  26. 258
      adept/adept/dpkgpm-gui.cpp
  27. 68
      adept/adept/dpkgpm-gui.h
  28. 462
      adept/adept/dpkgpm.cpp
  29. 49
      adept/adept/dpkgpm.h
  30. 81
      adept/adept/easytagfilter.cpp
  31. 93
      adept/adept/easytagfilter.h
  32. 201
      adept/adept/easytagfilterui.ui
  33. 339
      adept/adept/extendablelist.cpp
  34. 166
      adept/adept/extendablelist.h
  35. 232
      adept/adept/filterlist.cpp
  36. 149
      adept/adept/filterlist.h
  37. 72
      adept/adept/filtersidebar.cpp
  38. 26
      adept/adept/filtersidebar.h
  39. 119
      adept/adept/filtersidebarui.ui
  40. 36
      adept/adept/filterwidget.cpp
  41. 39
      adept/adept/filterwidget.h
  42. 137
      adept/adept/groupeddesktopselector.cpp
  43. 39
      adept/adept/groupeddesktopselector.h
  44. 112
      adept/adept/installerview.cpp
  45. 33
      adept/adept/installerview.h
  46. 203
      adept/adept/installerviewui.ui
  47. 818
      adept/adept/lister.cpp
  48. 261
      adept/adept/lister.h
  49. 309
      adept/adept/listerextenderui.ui
  50. 14
      adept/adept/listerpredicate.h
  51. 273
      adept/adept/packagedetails.cpp
  52. 58
      adept/adept/packagedetails.h
  53. 506
      adept/adept/packagedetailsui.ui
  54. 181
      adept/adept/packageinfo.cpp
  55. 49
      adept/adept/packageinfo.h
  56. 180
      adept/adept/packageinfoui.ui
  57. 58
      adept/adept/progress.cpp
  58. 30
      adept/adept/progress.h
  59. 79
      adept/adept/quickfilter.cpp
  60. 119
      adept/adept/quickfilter.h
  61. 130
      adept/adept/quickfilterui.ui
  62. 165
      adept/adept/sourceseditor.cpp
  63. 63
      adept/adept/sourceseditor.h
  64. 173
      adept/adept/sourceseditorui.ui
  65. 60
      adept/adept/statefilter.cpp
  66. 144
      adept/adept/statefilter.h
  67. 166
      adept/adept/statefilterui.ui
  68. 147
      adept/adept/tagchooser.cpp
  69. 83
      adept/adept/tagchooser.h
  70. 67
      adept/adept/tagfilter.cpp
  71. 110
      adept/adept/tagfilter.h
  72. 95
      adept/adept/tagfilterui.ui
  73. 138
      adept/adept/taglist.cpp
  74. 72
      adept/adept/taglist.h
  75. 44
      adept/adept/threadutils.cpp
  76. 71
      adept/adept/utils.h
  77. 153
      adept/adept/view.cpp
  78. 66
      adept/adept/view.h
  79. 20
      adept/batch/Makefile.am
  80. 16
      adept/batch/adept_batchui.rc
  81. 70
      adept/batch/adept_updater.desktop
  82. 142
      adept/batch/app.cpp
  83. 54
      adept/batch/app.h
  84. 48
      adept/batch/main.cpp
  85. 5
      adept/configure.in.in
  86. 21
      adept/deb-build
  87. 1
      adept/icons/Makefile.am
  88. BIN
      adept/icons/cr128-action-adept_notifier_warning.png
  89. BIN
      adept/icons/cr16-action-adept_commit.png
  90. BIN
      adept/icons/cr16-action-adept_distupgrade.png
  91. BIN
      adept/icons/cr16-action-adept_install.png
  92. BIN
      adept/icons/cr16-action-adept_keep.png
  93. BIN
      adept/icons/cr16-action-adept_main_indicator.png
  94. BIN
      adept/icons/cr16-action-adept_notifier_ok.png
  95. BIN
      adept/icons/cr16-action-adept_notifier_warning.png
  96. BIN
      adept/icons/cr16-action-adept_preview.png
  97. BIN
      adept/icons/cr16-action-adept_purge.png
  98. BIN
      adept/icons/cr16-action-adept_reinstall.png
  99. BIN
      adept/icons/cr16-action-adept_remove.png
  100. BIN
      adept/icons/cr16-action-adept_sourceseditor.png
  101. BIN
      adept/icons/cr16-action-adept_update.png
  102. BIN
      adept/icons/cr16-action-adept_upgrade.png
  103. BIN
      adept/icons/cr16-action-extender_closed.png
  104. BIN
      adept/icons/cr16-action-extender_opened.png
  105. BIN
      adept/icons/cr22-action-adept_commit.png
  106. BIN
      adept/icons/cr22-action-adept_distupgrade.png
  107. BIN
      adept/icons/cr22-action-adept_install.png
  108. BIN
      adept/icons/cr22-action-adept_keep.png
  109. BIN
      adept/icons/cr22-action-adept_notifier_ok.png
  110. BIN
      adept/icons/cr22-action-adept_notifier_warning.png
  111. BIN
      adept/icons/cr22-action-adept_preview.png
  112. BIN
      adept/icons/cr22-action-adept_purge.png
  113. BIN
      adept/icons/cr22-action-adept_reinstall.png
  114. BIN
      adept/icons/cr22-action-adept_remove.png
  115. BIN
      adept/icons/cr22-action-adept_sourceseditor.png
  116. BIN
      adept/icons/cr22-action-adept_update.png
  117. BIN
      adept/icons/cr22-action-adept_upgrade.png
  118. BIN
      adept/icons/cr22-action-extender_closed.png
  119. BIN
      adept/icons/cr22-action-extender_opened.png
  120. BIN
      adept/icons/cr32-action-adept_commit.png
  121. BIN
      adept/icons/cr32-action-adept_distupgrade.png
  122. BIN
      adept/icons/cr32-action-adept_install.png
  123. BIN
      adept/icons/cr32-action-adept_keep.png
  124. BIN
      adept/icons/cr32-action-adept_notifier_ok.png
  125. BIN
      adept/icons/cr32-action-adept_notifier_warning.png
  126. BIN
      adept/icons/cr32-action-adept_preview.png
  127. BIN
      adept/icons/cr32-action-adept_purge.png
  128. BIN
      adept/icons/cr32-action-adept_reinstall.png
  129. BIN
      adept/icons/cr32-action-adept_remove.png
  130. BIN
      adept/icons/cr32-action-adept_sourceseditor.png
  131. BIN
      adept/icons/cr32-action-adept_update.png
  132. BIN
      adept/icons/cr32-action-adept_upgrade.png
  133. BIN
      adept/icons/cr32-action-extender_closed.png
  134. BIN
      adept/icons/cr32-action-extender_opened.png
  135. BIN
      adept/icons/cr48-action-adept_commit.png
  136. BIN
      adept/icons/cr48-action-adept_distupgrade.png
  137. BIN
      adept/icons/cr48-action-adept_install.png
  138. BIN
      adept/icons/cr48-action-adept_keep.png
  139. BIN
      adept/icons/cr48-action-adept_notifier_ok.png
  140. BIN
      adept/icons/cr48-action-adept_notifier_warning.png
  141. BIN
      adept/icons/cr48-action-adept_preview.png
  142. BIN
      adept/icons/cr48-action-adept_purge.png
  143. BIN
      adept/icons/cr48-action-adept_reinstall.png
  144. BIN
      adept/icons/cr48-action-adept_remove.png
  145. BIN
      adept/icons/cr48-action-adept_sourceseditor.png
  146. BIN
      adept/icons/cr48-action-adept_update.png
  147. BIN
      adept/icons/cr48-action-adept_upgrade.png
  148. BIN
      adept/icons/cr48-action-extender_closed.png
  149. BIN
      adept/icons/cr48-action-extender_opened.png
  150. BIN
      adept/icons/cr64-action-adept_notifier_warning.png
  151. BIN
      adept/icons/crsc-action-adept_notifier_warning.svgz
  152. 22
      adept/installer/Makefile.am
  153. 45
      adept/installer/adept_installer.desktop
  154. 20
      adept/installer/adept_installerui.rc
  155. 416
      adept/installer/app.cpp
  156. 128
      adept/installer/app.h
  157. BIN
      adept/installer/hi128-app-adept_installer.png
  158. BIN
      adept/installer/hi16-app-adept_installer.png
  159. BIN
      adept/installer/hi22-app-adept_installer.png
  160. BIN
      adept/installer/hi32-app-adept_installer.png
  161. BIN
      adept/installer/hi48-app-adept_installer.png
  162. BIN
      adept/installer/hi64-app-adept_installer.png
  163. BIN
      adept/installer/hisc-app-adept_installer.svgz
  164. 51
      adept/installer/main.cpp
  165. 11
      adept/kubuntu_upgrader/Makefile.am
  166. 48
      adept/kubuntu_upgrader/errordialog.cpp
  167. 51
      adept/kubuntu_upgrader/errordialog.h
  168. 67
      adept/kubuntu_upgrader/errordialogbase.ui
  169. 545
      adept/kubuntu_upgrader/upgradewizard.cpp
  170. 96
      adept/kubuntu_upgrader/upgradewizard.h
  171. 143
      adept/kubuntu_upgrader/upgradewizardbase.ui
  172. 33
      adept/libadept/Makefile.am
  173. 295
      adept/libadept/acqprogress.cpp
  174. 127
      adept/libadept/acqprogress.h
  175. 53
      adept/libadept/acqprogresswidget.cpp
  176. 30
      adept/libadept/acqprogresswidget.h
  177. 79
      adept/libadept/acqprogresswidgetui.ui
  178. 43
      adept/libadept/actor.h
  179. 197
      adept/libadept/application.cpp
  180. 75
      adept/libadept/application.h
  181. 115
      adept/libadept/commitprogress.cpp
  182. 41
      adept/libadept/commitprogress.h
  183. 197
      adept/libadept/commitprogressui.ui
  184. 116
      adept/libadept/desktopentryui.ui
  185. 194
      adept/libadept/desktoplist.cpp
  186. 117
      adept/libadept/desktoplist.h
  187. 258
      adept/libadept/dpkgpm-gui.cpp
  188. 68
      adept/libadept/dpkgpm-gui.h
  189. 451
      adept/libadept/dpkgpm.cpp
  190. 49
      adept/libadept/dpkgpm.h
  191. 82
      adept/libadept/easytagfilter.cpp
  192. 93
      adept/libadept/easytagfilter.h
  193. 201
      adept/libadept/easytagfilterui.ui
  194. 332
      adept/libadept/extendablelist.cpp
  195. 165
      adept/libadept/extendablelist.h
  196. 231
      adept/libadept/filterlist.cpp
  197. 149
      adept/libadept/filterlist.h
  198. 71
      adept/libadept/filtersidebar.cpp
  199. 26
      adept/libadept/filtersidebar.h
  200. 119
      adept/libadept/filtersidebarui.ui
  201. 36
      adept/libadept/filterwidget.cpp
  202. 39
      adept/libadept/filterwidget.h
  203. 137
      adept/libadept/groupeddesktopselector.cpp
  204. 39
      adept/libadept/groupeddesktopselector.h
  205. 88
      adept/libadept/installerview.cpp
  206. 33
      adept/libadept/installerview.h
  207. 194
      adept/libadept/installerviewui.ui
  208. 707
      adept/libadept/lister.cpp
  209. 220
      adept/libadept/lister.h
  210. 310
      adept/libadept/listerextenderui.ui
  211. 14
      adept/libadept/listerpredicate.h
  212. 253
      adept/libadept/packagedetails.cpp
  213. 55
      adept/libadept/packagedetails.h
  214. 464
      adept/libadept/packagedetailsui.ui
  215. 181
      adept/libadept/packageinfo.cpp
  216. 49
      adept/libadept/packageinfo.h
  217. 180
      adept/libadept/packageinfoui.ui
  218. 58
      adept/libadept/progress.cpp
  219. 30
      adept/libadept/progress.h
  220. 79
      adept/libadept/quickfilter.cpp
  221. 119
      adept/libadept/quickfilter.h
  222. 130
      adept/libadept/quickfilterui.ui
  223. 165
      adept/libadept/sourceseditor.cpp
  224. 63
      adept/libadept/sourceseditor.h
  225. 173
      adept/libadept/sourceseditorui.ui
  226. 60
      adept/libadept/statefilter.cpp
  227. 144
      adept/libadept/statefilter.h
  228. 166
      adept/libadept/statefilterui.ui
  229. 144
      adept/libadept/tagchooser.cpp
  230. 82
      adept/libadept/tagchooser.h
  231. 67
      adept/libadept/tagfilter.cpp
  232. 113
      adept/libadept/tagfilter.h
  233. 95
      adept/libadept/tagfilterui.ui
  234. 134
      adept/libadept/taglist.cpp
  235. 75
      adept/libadept/taglist.h
  236. 44
      adept/libadept/threadutils.cpp
  237. 71
      adept/libadept/utils.h
  238. 153
      adept/libadept/view.cpp
  239. 66
      adept/libadept/view.h
  240. 20
      adept/manager/Makefile.am
  241. 43
      adept/manager/adept_manager.desktop
  242. 38
      adept/manager/adept_managerui.rc
  243. 450
      adept/manager/app.cpp
  244. 162
      adept/manager/app.h
  245. BIN
      adept/manager/hi128-app-adept_manager.png
  246. BIN
      adept/manager/hi16-app-adept_manager.png
  247. BIN
      adept/manager/hi22-app-adept_manager.png
  248. BIN
      adept/manager/hi32-app-adept_manager.png
  249. BIN
      adept/manager/hi48-app-adept_manager.png
  250. BIN
      adept/manager/hi64-app-adept_manager.png
  251. BIN
      adept/manager/hisc-app-adept_manager.svgz
  252. 71
      adept/manager/main.cpp
  253. 3
      adept/notifier/15adept-periodic-update
  254. 26
      adept/notifier/Makefile.am
  255. 63
      adept/notifier/adept_notifier.desktop
  256. 23
      adept/notifier/adept_notifier_auto.desktop
  257. 342
      adept/notifier/app.cpp
  258. 93
      adept/notifier/app.h
  259. 34
      adept/tests/libcapture/celem-test.cpp
  260. 44
      adept/tests/libcapture/grouper-test.cpp
  261. 71
      adept/tests/libcapture/pkgcache-test.cpp
  262. 56
      adept/tests/libcapture/stl_util-test.cpp
  263. 86
      adept/tests/libcapture/tree-test.cpp
  264. 61
      adept/tests/tut-main.cpp
  265. 872
      adept/tests/tut.h
  266. 182
      adept/tests/tut_reporter.h
  267. 21
      adept/updater/Makefile.am
  268. 69
      adept/updater/adept_updater.desktop
  269. 16
      adept/updater/adept_updaterui.rc
  270. 275
      adept/updater/app.cpp
  271. 105
      adept/updater/app.h
  272. BIN
      adept/updater/hi128-app-adept_updater.png
  273. BIN
      adept/updater/hi16-app-adept_updater.png
  274. BIN
      adept/updater/hi22-app-adept_updater.png
  275. BIN
      adept/updater/hi32-app-adept_updater.png
  276. BIN
      adept/updater/hi48-app-adept_updater.png
  277. BIN
      adept/updater/hi64-app-adept_updater.png
  278. BIN
      adept/updater/hisc-app-adept_updater.svgz
  279. 56
      adept/updater/main.cpp
  280. 394
      config.h.in
  281. 3
      configure.files
  282. 160
      configure.in
  283. 27
      configure.in.in
  284. 1
      subdirs

12
Makefile.am

@ -0,0 +1,12 @@
## kdebase/Makefile.am
## (C) 1997 Stephan Kulow
AUTOMAKE_OPTIONS = foreign 1.5
dist-hook:
cd $(top_distdir) && perl $(top_srcdir)/admin/am_edit -padmin
include admin/Doxyfile.am
include admin/deps.am
SUBDIRS=$(TOPSUBDIRS)

11
Makefile.am.in

@ -0,0 +1,11 @@
## kdebase/Makefile.am
## (C) 1997 Stephan Kulow
AUTOMAKE_OPTIONS = foreign 1.5
dist-hook:
cd $(top_distdir) && perl $(top_srcdir)/admin/am_edit -padmin
include admin/Doxyfile.am
include admin/deps.am

12420
acinclude.m4

File diff suppressed because it is too large Load Diff

13333
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

29
adept/COPYING

@ -0,0 +1,29 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of [original copyright holder] nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1
adept/Makefile.am

@ -0,0 +1 @@
SUBDIRS = kubuntu_upgrader adept installer manager updater notifier icons batch

2
adept/NEWS

@ -0,0 +1,2 @@
good bye kapture, hello ept
ept - kde apt frontend based on libapt-front

33
adept/TODO

@ -0,0 +1,33 @@
the 1.88 milestone:
* the most "intrusive" changes to ui should be done at this point: the detailed
package view and package browsing interface, improvements to the filtering ui
- make the filter area resize itself to fit the contained filters [done]
- clean up individual filters (their extended state that is) [done]
- implement a sidebar for listing available filtering options
- implement "buckets" for wanted and unwanted tags (these are basically a
want/unwant anded tag filters)
- implement drag&drop from sidebar to buckets and to filter list
- implement shuffling of items in the filter list by d&d (needs fixes in
extendablelist)
- implement detailed package view
- implement package browsing (needs thinking)
* basic pinning support in the libraries should be done (the ui will possibly
have to wait till beta)
* the ui should be fully i18n'd
- libapt-front needs to be i18n'd
- strings in libept and apps need to be wrapped in i18n
* skeleton of the update notifier should be done
* purge and reinstall options in the UI
- need respective options in libapt-front
- add actions to context menu
- think about semantics...
* support for individual deb handling in the libraries (possibly without
ui)
* at least basic support for konsole hiding (eventually without "waiting
for input" detection)

35
adept/adept/Makefile.am

@ -0,0 +1,35 @@
noinst_LTLIBRARIES = libadept.la
libadept_la_SOURCES = changelog.cpp\
acqprogresswidgetui.ui acqprogress.cpp \
tagchooser.cpp filtersidebarui.ui filtersidebar.cpp \
application.cpp \
tagfilterui.ui tagfilter.cpp taglist.cpp \
packageinfoui.ui packageinfo.cpp \
commitprogressui.ui commitprogress.cpp \
progress.cpp \
sourceseditorui.ui sourceseditor.cpp \
acqprogresswidget.cpp dpkgpm.cpp \
dpkgpm-gui.cpp \
extendablelist.cpp \
desktopentryui.ui desktoplist.cpp \
groupeddesktopselector.cpp \
packagedetailsui.ui packagedetails.cpp view.cpp \
listerextenderui.ui lister.cpp filterlist.cpp \
filterwidget.cpp \
quickfilterui.ui quickfilter.cpp \
statefilterui.ui statefilter.cpp \
easytagfilterui.ui easytagfilter.cpp \
actor.h threadutils.cpp \
installerviewui.ui installerview.cpp
libadept_la_LDFLAGS = -L/usr/lib/debug $(all_libraries)
libadept_la_LIBADD = -lapt-front $(LIBTAGCOLL2_LIBS)
acqprogress.cpp: acqprogress.moc
INCLUDES = -I$(srcdir)/.. -I.. $(all_includes) $(LIBEPT_CFLAGS) $(LIBTAGCOLL2_CFLAGS) $(LIBAPT_FRONT_CFLAGS) $(LIBWIBBLE_CFLAGS)
KDE_CXXFLAGS = $(USE_EXCEPTIONS) -DQT_NO_ASCII_CAST -DQT_NO_CAST_ASCII -DDEFAULT_KONSOLE_HIDDEN=true
METASOURCES = AUTO
messages: rc.cpp
$(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/libept.pot

295
adept/adept/acqprogress.cpp

@ -0,0 +1,295 @@
// -*- C++ -*-
#include <qprogressbar.h>
#include <klistview.h>
#include <kapplication.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qstyle.h>
#include <kmessagebox.h>
#include <klocale.h>
#include <kdebug.h>
#include "acqprogress.h"
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <adept/utils.h>
#include <stdio.h>
#include <signal.h>
#include <iostream>
#define _(a...) (a) // XXX
using namespace std;
namespace adept {
AcqStatus::Item::Item (KListView *parent, pkgAcquire::ItemDesc &item, bool hit)
: KListViewItem( parent )
{
m_pbcol = 0;
m_prog = new ItemProgress( 0, 0 );
m_prog->setStatus( "waiting" );
m_prog->setTotalSteps( 100 );
m_item = item;
m_id = m_item.Owner->ID;
/* if (item.Owner->FileSize > 0)
setText( 1, SizeToStr( item.Owner->FileSize ).c_str() + QString( "B" ) ); */
setText( 1, u8( item.Description ) );
// cerr << "create: id = " << item . Owner -> ID << ", myId = " << m_item . Owner -> ID << endl;
if (hit) {
m_prog->setStatus( "hit" );
} else
m_prog->setStatus( "waiting" );
// QString (SizeToStr (Itm.Owner -> FileSize) . c_str ()) + QString ("B"),
// /* QString (Itm . Owner -> ID) + */ QString (Itm.Description . c_str ()));
}
AcqStatus::Item::~Item ()
{
delete m_prog;
}
int AcqStatus::Item::compare (QListViewItem *i, int /*col*/, bool /*ascend*/) const
{
int id1 = m_id;
int id2 = ((Item *) i) -> m_id;
return (id2 >= id1) - (id2 <= id1);
}
void AcqStatus::Item::pulse (pkgAcquire::Worker *w)
{
if (w) {
if (w->TotalSize)
setStatus( "progress", long( double(
w -> CurrentSize * 100.0)
/ double( w->TotalSize ) ) );
else
setStatus( "downloading", 0 );
}
}
void AcqStatus::Item::setStatus( const std::string &s, int i )
{
m_prog->setStatus( s, i );
}
void AcqStatus::Item::paintCell (QPainter *p, const QColorGroup &cg,
int column, int width, int alignment )
{
QColorGroup _cg( cg );
QColor c = _cg.text();
if ( column == m_pbcol ) {
const QRect bar = QRect( 0, 0, width, height() );
m_prog->resize( width, height() );
QPixmap pm = QPixmap::grabWidget( m_prog );
// p->fillRect( bar, listView()->paletteBackgroundColor() );
p->drawPixmap( bar.x(), bar.y(), pm );
} else {
QPixmap pm( width, height() );
QPainter _p( &pm );
_cg.setColor( QColorGroup::Text, c );
KListViewItem::paintCell( &_p, _cg, column, width, alignment );
p->drawPixmap( 0, 0, pm );
}
}
AcqStatus::Item *AcqStatus::findItem (pkgAcquire::ItemDesc &Itm)
{
if ( Itm.Owner->ID < m_idOffset )
return 0;
if ( Itm.Owner->ID - m_idOffset >= m_items.size() )
return 0;
return m_items[ Itm.Owner->ID - m_idOffset ];
}
AcqStatus::AcqStatus(QWidget *parent, const char *name)
: KListView (parent, name), m_idOffset( 0 ), m_continue( true )
{
// m_lastItem = 0;
addColumn( i18n( "Progress" ) );
addColumn( i18n( "Description" ) );
setSorting (1);
setColumnWidth (0, 220);
setColumnWidth (1, 300);
setResizeMode (LastColumn);
ID = 0;
}
void AcqStatus::Done (pkgAcquire::ItemDesc &Itm)
{
Item *i = findItem (Itm);
if (i) {
i->setStatus( "done" );
}
emit statusChanged( StWaiting );
triggerUpdate();
KApplication::kApplication()->processEvents();
}
void AcqStatus::clear()
{
KListView::clear();
m_idOffset += m_items.size();
m_items.clear(); // got deleted by klistview already
}
void AcqStatus::Start()
{
clear();
pkgAcquireStatus::Start();
kdDebug() << "AcqStatus::Start ()" << endl;
_config -> Set ("APT::Fetcher::Select-Timeout-Usec", 100000);
emit statusChanged( StWaiting );
triggerUpdate();
KApplication::kApplication()->processEvents();
}
void AcqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
{
Itm.Owner->ID = ID++;
Item *i = new Item( this, Itm, true );
// ensureItemVisible( i );
i->setStatus( "hit" );
m_items.push_back( i );
kdDebug() << "imshit called on ID = " << ID - 1 << " i = " << (void *)i << endl;
triggerUpdate();
KApplication::kApplication()->processEvents();
};
void AcqStatus::Fetch(pkgAcquire::ItemDesc &Itm)
// an item started to download
{
Update = true;
if (Itm.Owner->Complete == true) // XXX?
return;
Itm.Owner->ID = ID++;
Item *i = new Item( this, Itm );
// ensureItemVisible( i );
m_items.push_back( i );
kdDebug() << "fetch called on ID = " << ID - 1 << " i = " << (void *)i << endl;
emit statusChanged( StDownloading );
triggerUpdate();
KApplication::kApplication()->processEvents();
};
void AcqStatus::Fail(pkgAcquire::ItemDesc &Itm)
// item failed to download
{
kdDebug() << "fail, status = " << Itm.Owner->Status
<< " ID = " << Itm.Owner->ID << endl;
// Ignore certain kinds of transient failures (bad code)
if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
kdDebug() << "fail with StatIdle, ignoring" << endl;
return;
}
Item *i = findItem (Itm);
kdDebug() << "fail, i = " << i << endl;
if (! i)
return;
if (Itm.Owner->Status == pkgAcquire::Item::StatDone) {
i->setStatus( "ignored" );
} else {
i->setStatus( "error" );
}
triggerUpdate();
KApplication::kApplication()->processEvents();
};
void AcqStatus::Stop()
{
pkgAcquireStatus::Stop();
emit statusChanged( StDone );
triggerUpdate ();
KApplication::kApplication()->processEvents();
}
bool AcqStatus::Pulse(pkgAcquire *Owner)
{
pkgAcquireStatus::Pulse(Owner);
for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
I = Owner->WorkerStep(I)) {
if (I -> CurrentItem) {
Item *i = findItem (* (I -> CurrentItem));
if (i)
i -> pulse (I);
}
}
triggerUpdate ();
// repaint ();
if (TotalBytes > 0)
emit totalProgress(
long( double(
(CurrentBytes +
CurrentItems)*100.0)/double(TotalBytes+TotalItems) ) );
else
emit totalProgress (-1);
KApplication::kApplication () -> processEvents ();
if ( m_continue )
return true;
m_continue = true;
return false;
}
bool AcqStatus::MediaChange(string Media,string Drive)
{
int res = KMessageBox::warningContinueCancel(
this, i18n( "Please insert the disc "
"labeled '%1' in the drive "
"'%2' and press enter" ).arg(
u8( Media ) ).arg( u8( Drive ) ),
i18n( "Media Change" ) );
if ( res == KMessageBox::Cancel )
cancel();
return true;
}
void AcqStatus::cancel()
{
m_continue = false;
}
AcqStatusDialog::AcqStatusDialog (QWidget *parent, const char *name, bool modal)
: KDialogBase( parent, name, modal,
u8( "progress dialog (FIXME: waiting for headers, done)" ),
Ok|Cancel, Cancel, true )
{
m_status = new AcqStatus (this, "");
setMainWidget( m_status.data() );
enableButton (Ok, false);
connect (m_status.data(), SIGNAL (statusChanged (AcqStatus::Status)),
this, SLOT (statusChange (AcqStatus::Status)));
}
void AcqStatusDialog::statusChange (AcqStatus::Status st)
{
if (st == AcqStatus::StDownloading || st == AcqStatus::StWaiting) {
enableButton (Ok, false);
// XXX: cancel should be true; but needs implementation first
enableButton (Cancel, false);
} else if (st == AcqStatus::StDone) {
enableButton (Ok, true);
enableButton (Cancel, false);
}
}
}
#include "acqprogress.moc"

127
adept/adept/acqprogress.h

@ -0,0 +1,127 @@
/** -*- C++ -*-
@file adept/acqprogress.h
@author Peter Rockai <me@mornfall.net>
*/
#ifndef ACQPROGRESS_H
#define ACQPROGRESS_H
#include <klocale.h>
#include <kdialogbase.h>
#include <klistview.h>
#include <kprogress.h>
#include <vector>
#include <apt-pkg/acquire.h>
#include <apt-front/progresscallback.h>
class AcqStatus;
class QLabel;
class QProgressBar;
class QSpacer;
class QGridLayout;
namespace adept {
class AcqStatus : public KListView, public aptFront::ProgressCallback
{
Q_OBJECT
protected:
class ItemProgress: public KProgress {
public:
ItemProgress( QWidget *parent, const char *name = 0 )
: KProgress( parent, name ), m_spin( 0 ) {}
void setStatus( const std::string &s,
int prog = 0 ) {
m_status = s;
if (m_status == "hit"
|| m_status == "ignored"
|| m_status == "done")
prog = 100;
if (m_status == "waiting") {
prog = 0;
}
if (m_status == "progress" && prog != 100)
setFormat( i18n( "downloading (%p%)" ) );
else if (prog == 100) // who cares about hit/ignore anyway?
setFormat( i18n( "done (%p%)" ) );
else
setFormat( m_status );
setProgress( prog );
}
protected:
std::string m_status;
int m_spin;
};
class Item : public KListViewItem {
protected:
ItemProgress *m_prog;
int m_pbcol;
unsigned long m_id;
pkgAcquire::ItemDesc m_item;
public:
Item (KListView *parent, pkgAcquire::ItemDesc &item,
bool hit = false);
virtual ~Item ();
virtual void paintCell (QPainter *p, const QColorGroup &cg,
int column, int width, int alignment);
void setProgress (int);
virtual int compare (QListViewItem *i, int col, bool ascend) const;
virtual void pulse (pkgAcquire::Worker *);
void setStatus( const std::string &, int = 0 );
void setup() {
KListViewItem::setup();
setHeight( height() + 6 );
}
};
unsigned long ID;
unsigned long m_idOffset;
std::vector <Item *> m_items;
bool m_continue;
public:
enum Status { StWaiting, StDownloading, StDone };
AcqStatus (QWidget *parent, const char *name);
Item *findItem (pkgAcquire::ItemDesc &Itm);
virtual bool MediaChange (string Media,string Drive);
virtual void IMSHit (pkgAcquire::ItemDesc &Itm);
virtual void Fetch (pkgAcquire::ItemDesc &Itm);
virtual void Done (pkgAcquire::ItemDesc &Itm);
virtual void Fail (pkgAcquire::ItemDesc &Itm);
virtual void Start ();
virtual void Stop ();
void addLine (QWidget *l, QWidget *s, QWidget *prog);
void clear();
bool Pulse (pkgAcquire *Owner);
public slots:
void cancel();
signals:
void statusChanged (AcqStatus::Status st);
void totalProgress (int percent);
//AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet);
};
class AcqStatusDialog : public KDialogBase
{
Q_OBJECT
protected:
aptFront::SharedPtr<AcqStatus> m_status;
public:
aptFront::SharedPtr<aptFront::ProgressCallback> callback() { return m_status.data(); };
AcqStatusDialog (QWidget *parent, const char *name, bool modal);
public slots:
void statusChange (AcqStatus::Status st);
};
}
#endif

53
adept/adept/acqprogresswidget.cpp

@ -0,0 +1,53 @@
#include <kprogress.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <klocale.h>
#include "acqprogresswidget.h"
#include "acqprogress.h"
using namespace adept;
AcqProgressWidget::AcqProgressWidget( QWidget *parent, const char *name )
: AcqProgressWidgetUi( parent, name )
{
m_statusRef = m_status;
m_progress->setTotalSteps( 100 );
m_progress->setProgress( 0 );
connect(m_status, SIGNAL( totalProgress( int ) ),
this, SLOT( setProgress( int ) ) );
connect(m_status, SIGNAL( statusChanged( AcqStatus::Status ) ),
this, SLOT( statusChange( AcqStatus::Status ) ) );
connect( m_cancel, SIGNAL( clicked() ),
m_status, SLOT( cancel() ) );
}
void AcqProgressWidget::statusChange( AcqStatus::Status s )
{
QString t;
switch (s) {
case AcqStatus::StWaiting:
t = i18n( "Waiting for headers (%p%)" );
break;
case AcqStatus::StDownloading:
t = i18n( "Downloading (%p%)" );
break;
case AcqStatus::StDone:
t = i18n( "Done (%p%)" );
m_progress->setProgress( 100 );
break;
}
m_progress->setFormat( t );
}
void AcqProgressWidget::setProgress( int p )
{
if (p < 0) {
m_progress->setTotalSteps( 0 );
m_progress->setProgress( m_progress->progress() + 1 );
} else {
m_progress->setTotalSteps( 100 );
m_progress->setProgress( p );
}
}
#include "acqprogresswidget.moc"

30
adept/adept/acqprogresswidget.h

@ -0,0 +1,30 @@
/** -*- C++ -*-
@file adept/acqprogresswidget.h
@author Peter Rockai <me@mornfall.net>
@todo Close button!
*/
#ifndef PROGRESSWIDGET_H
# define PROGRESSWIDGET_H
#include <adept/acqprogresswidgetui.h>
#include <adept/acqprogress.h>
namespace adept {
class AcqProgressWidget : public AcqProgressWidgetUi {
Q_OBJECT
public:
AcqProgressWidget (QWidget *parent = 0, const char *name = 0);
aptFront::SharedPtr<aptFront::ProgressCallback> callback() { return m_statusRef.data(); };
public slots:
void statusChange( AcqStatus::Status );
void setProgress( int );
protected:
aptFront::SharedPtr<AcqStatus> m_statusRef;
};
}
#endif /* ifndef PROGRESSWIDGET_H */

79
adept/adept/acqprogresswidgetui.ui

@ -0,0 +1,79 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>adept::AcqProgressWidgetUi</class>
<widget class="QWidget">
<property name="name">
<cstring>adept::AcqProgressWidgetUi</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>705</width>
<height>289</height>
</rect>
</property>
<property name="caption">
<string>Download Progress</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="adept::AcqStatus" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>m_status</cstring>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>150</height>
</size>
</property>
</widget>
<widget class="KProgress" row="1" column="0">
<property name="name">
<cstring>m_progress</cstring>
</property>
</widget>
<widget class="QPushButton" row="1" column="1">
<property name="name">
<cstring>m_cancel</cstring>
</property>
<property name="text">
<string>Cancel Download</string>
</property>
</widget>
</grid>
</widget>
<customwidgets>
<customwidget>
<class>adept::AcqStatus</class>
<header location="global">acqprogress.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>5</hordata>
<verdata>5</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<pixmap>image0</pixmap>
</customwidget>
</customwidgets>
<images>
<image name="image0">
<data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data>
</image>
</images>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>adept/acqprogress.h</includehint>
<includehint>kprogress.h</includehint>
</includehints>
</UI>

43
adept/adept/actor.h

@ -0,0 +1,43 @@
/** -*- C++ -*-
@file adept/actor.h
@author Peter Rockai <me@mornfall.net>
*/
#include <qobject.h>
#include <apt-front/cache/entity/entity.h>
#include <apt-front/actor.h>
#ifndef EPT_ACTOR_H
#define EPT_ACTOR_H
namespace adept {
using namespace aptFront;
class EntityActor : public QObject
{
Q_OBJECT
public:
EntityActor( actor::Bound< cache::entity::Entity > a )
: m_actor( a ), m_dead( false )
{}
actor::Bound< cache::entity::Entity > actor() const {
return m_actor;
}
public slots:
void act() { m_actor(); }
void destructiveAct() {
// in case we don't get deleted soon enough
if ( m_dead ) return;
m_dead = true;
act();
deleteLater();
}
protected:
actor::Bound< cache::entity::Entity > m_actor;
bool m_dead;
};
}
#endif

350
adept/adept/application.cpp

@ -0,0 +1,350 @@
/** -*- C++ -*-
@file adept/application.cpp
@author Peter Rockai <me@mornfall.net>
*/
#include <qprocess.h>
#include <kmessagebox.h>
#include <klocale.h>
#include <kapplication.h>
#include <kstatusbar.h>
#include <kdebug.h>
#include <apt-front/init.h>
#include <apt-front/cache/component/packages.h>
#include <apt-front/cache/component/state.h>
#include <adept/commitprogress.h>
#include <adept/application.h>
#include <adept/packageinfo.h>
#include <adept/progress.h>
#include <adept/utils.h>
namespace adept {
using namespace cache;
#ifdef KUBUNTU
#include <qstringlist.h>
#define DPKG_FIXER_ARGS QStringList::split(QString(" "), QString("dpkg --configure -a"), false)
DpkgFixer::DpkgFixer(struct Application* parent)
: m_parent(parent)
{
m_fixer = 0;
m_waiter = 0;
m_output = "";
m_done = false;
}
DpkgFixer::~DpkgFixer()
{
if (m_fixer != 0) {
delete m_fixer;
}
if (m_waiter != 0) {
delete m_waiter;
}
std::cout << "Got output " << m_output.latin1() << std::endl;
}
void DpkgFixer::fixDpkgLock()
{
kdDebug() << "Asking user if they would like to fix dpkg lock..." << endl;
int decision = KMessageBox::warningYesNoCancel(m_parent->mainWindow(),
i18n("Another process is using the packaging system database "
"(probably some other Adept application or apt-get or "
"aptitude).\nWould you like to attempt to resolve this problem? "
"No will enter read-only mode and Cancel to quit and resolve "
"this issue yourself."),
i18n( "Database Locked" ) );
switch (decision) {
case KMessageBox::Yes:
kdDebug() << "User opted to fix the dpkg database. Trying to run the process..." << endl;
cache::Global::get().close();
// Call the dpkg fixer.
m_fixer = new QProcess(dynamic_cast<QObject*>(this));
m_fixer->setArguments(DPKG_FIXER_ARGS);
// Handle when the process exits
connect(dynamic_cast<QObject*>(m_fixer), SIGNAL( processExited() ),
dynamic_cast<QObject*>(this), SLOT( retryOpen() ));
// Handle when the process has stdout output
connect(dynamic_cast<QObject*>(m_fixer), SIGNAL( readyReadStdout() ),
dynamic_cast<QObject*>(this), SLOT( handleStdout() ));
// Handle when the process has stderr output
connect(dynamic_cast<QObject*>(m_fixer), SIGNAL( readyReadStderr() ),
dynamic_cast<QObject*>(this), SLOT( handleStderr() ));
// Fire off the waiter...
m_waiter = new KProgressDialog(m_parent->mainWindow(), "waiter",
i18n("Unlocking; Please Wait..."), i18n("Unlocking dpkg database; Please wait..."));
m_waiter->setAllowCancel(false);
m_waiter->show();
m_fixer->start();
kdDebug() << "dpkg fixer fired off." << endl;
break;
case KMessageBox::Cancel:
kdDebug() << "User opted to cancel and repair manually." << endl;
exit(1);
break;
default:
kdDebug() << "User opted to continue in read-only mode." << endl;
m_parent->updateStatusbar();
m_parent->cacheOpenedNowFinishInit();
break;
}
return;
}
void DpkgFixer::retryOpen()
{
kdDebug() << "Retrying the open..." << endl;
m_waiter->setLabel(i18n("Reopening the dpkg database..."));
m_waiter->progressBar()->setValue(50);
try {
if (!m_fixer->normalExit()) {
kdDebug() << "The fixer command did not exit normally. Throwing exception." << endl;
throw 0;
}
kdDebug() << "The fixer command exited normally, trying to reopen the database." << endl;
cache::Global::get().open( m_parent->openFlags() );
} catch (...) {
KMessageBox::information(m_parent->mainWindow(),
i18n( "Failed to unlock the database. "
"Please try to resolve this issue. "
"`sudo dpkg --configure -a` may help." ),
i18n( "Unlock Failed." ) );
exit( 1 );
}
m_waiter->progressBar()->setValue(100);
m_waiter->close();
m_parent->updateStatusbar();
m_parent->cacheOpenedNowFinishInit();
}
void DpkgFixer::outputUpdated()
{
}
void DpkgFixer::handleStdout()
{
// m_output += m_fixer->readStdout();
// outputUpdated();
}
void DpkgFixer::handleStderr()
{
// m_output += m_fixer->readStderr();
// outputUpdated();
}
#endif // KUBUNTU
Application::Application()
: m_acceptReadOnly( false ), m_main( 0 ), m_history( 0 ), m_statusBar( 0 )
{
#ifdef KUBUNTU
m_dpkgfixer = 0;
#endif // KUBUNTU
}
Application::~Application()
{
#ifdef KUBUNTU
if (m_dpkgfixer != 0) {
delete m_dpkgfixer;
}
#endif // KUBUNTU
}
void Application::openCache( unsigned flags )
{
m_flags = flags;
bool ro = m_acceptReadOnly;
bool root = ::getuid() == 0 || ::geteuid() == 0;
try {
cache::Global::get().open( m_flags );
} catch (...) {
try {
cache::Global::get().open( m_flags | Cache::OpenReadOnly );
if ( ro && root ) {
#ifndef KUBUNTU
kdDebug() << "ro && root -- Database locked." << endl;
KMessageBox::information(
m_main, i18n(
"You will not be able to change your system settings "
"in any way (install, remove or upgrade software), "
"because another process is using the packaging system database "
"(probably some other Adept application or apt-get or "
"aptitude). Please close the other application before "
"using this one." ),
i18n( "Read Only mode: Database Locked" ) );
#else
kdDebug() << "Firing off the Kubuntu dpkg database lock fixer..." << endl;
m_dpkgfixer = new DpkgFixer(this);
m_dpkgfixer->fixDpkgLock();
return;
#endif // KUBUNTU
} else if ( !root && ro ) {
kdDebug() << "!root && ro -- Need root privileges." << endl;
KMessageBox::information(
m_main, i18n(
"You will not be able to change your system settings "
"in any way (install, remove or upgrade software), "
"because this application needs special administrator "
"(root) privileges. Please run it as root or "
"through kdesu or sudo programs to be able to perform "
"these actions" ),
i18n( "Read Only mode: Need root privileges" ) );
} else if ( root && !ro ) {
#ifndef KUBUNTU
kdDebug() << "root && !ro -- Database locked." << endl;
KMessageBox::information(m_main,
i18n("Another process is using the packaging system database "
"(probably some other Adept application or apt-get or "
"aptitude). Please close the other application before "
"using this one." ),
i18n( "Read Only mode: Database Locked" ) );
#else
kdDebug() << "Firing off the Kubuntu dpkg database lock fixer..." << endl;
m_dpkgfixer = new DpkgFixer(this);
m_dpkgfixer->fixDpkgLock();
return;
#endif // KUBUNTU
} else if ( !root && !ro ) {
kdDebug() << "!root && !ro -- Needs root privileges." << endl;
KMessageBox::information(
m_main, i18n( "This application needs special administrator "
"(root) privileges. Please run it as root or "
"through kdesu or sudo programs" ),
i18n( "Need root privileges" ) );
}
if ( !ro ) {
kdDebug() << "cannot continue, exiting" << endl;
exit( 1 );
}
} catch (...) {
KMessageBox::sorry(
m_main, i18n(
"The APT Database could not be opened!"
" This may be caused by incorrect APT configuration"
" or some similar problem. Try running apt-setup and"
" apt-get update in terminal and see if it helps"
" to resolve the problem." ), i18n( "Could not open cache" ));
exit( 1 );
}
}
updateStatusbar();
cacheOpenedNowFinishInit();
}
void Application::initHistory() {
cache::Global::get().addComponent(
m_history = new History() );
}
void Application::initKDEDebconf()
{
// xxx unhardcode the package name somehow?
if (cache::Global::get().packages()
.packageByName( "libqt-perl" ).isInstalled())
putenv( "DEBIAN_FRONTEND=kde" );
}
void Application::initialize()
{
CommitProgress::initSystem();
aptFront::init();
openCache();
}
void Application::cacheOpenedNowFinishInit() {
initKDEDebconf();
initHistory();
observeComponent< component::State >();
initFinished();
}
void Application::checkpoint() {
if ( !history() ) return;
setHistoryEnabled( false );
history()->checkpoint();
setHistoryEnabled( true );
}
void Application::undo() {
if ( !history() ) return;
setHistoryEnabled( false );
history()->undo();
setHistoryEnabled( true );
}
void Application::redo() {
if ( !history() ) return;
setHistoryEnabled( false );
history()->redo();
setHistoryEnabled( true );
}
QString Application::changeString() {
component::State &s = cache().state();
return i18n( " Install %1, upgrade %2, remove %3 " )
.arg( s.newInstallCount() ).arg( s.upgradeCount() )
.arg( s.removeCount() );
}
QString Application::statusString() {
component::State &s = cache().state();
return i18n( " %1 installed, %2 upgradable, %3 available " )
.arg( s.installedCount() ).arg( s.upgradableCount() )
.arg( s.availableCount() );
}
QString Application::sizesString() {
QString dl = cache().state().downloadSizeString();
QString inst = cache().state().installSizeString();
return i18n( " download: %1, installation: %2 " ).arg( dl ).arg( inst );
}
void Application::setStatusBar( KStatusBar *s ) {
m_statusBar = s;
if ( s ) {
s->message( i18n( "Initializing..." ) );
s->insertItem( u8( "" ), 0 );
s->insertItem( u8( "" ), 1 );
s->insertItem( u8( "" ), 2 );
adjustFontSize( s, -1 );
adept::Progress *pr = new adept::Progress();
pr->setStatusBar( s );
cache::Global::get().setProgress( pr );
}
}
void Application::notifyPostChange( component::Base * )
{
updateStatusbar();
}
void Application::updateStatusbar()
{
if ( m_statusBar ) {
m_statusBar->changeItem( changeString(), 0 );
m_statusBar->changeItem( statusString(), 1 );
m_statusBar->changeItem( sizesString(), 2 );
}
}
}

102
adept/adept/application.h

@ -0,0 +1,102 @@
/** -*- C++ -*-
@file adept/application.h
@author Peter Rockai <me@mornfall.net>
*/
#include <vector>
#include <qobject.h>
#include <qprocess.h>
#include <kprogress.h>
#include <apt-front/cache/cache.h>
#include <apt-front/cache/component/state.h>
#include <apt-front/cache/component/history.h>
#ifndef EPT_APPLICATION_H
#define EPT_APPLICATION_H
#define KUBUNTU
class KStatusBar;
namespace adept {
using namespace aptFront;
using cache::Cache;
class Lister;
#ifdef KUBUNTU
class DpkgFixer : public QObject {
Q_OBJECT;
public:
DpkgFixer(struct Application* app);
~DpkgFixer();
bool done() { return m_done; };
public slots:
void fixDpkgLock();
protected slots:
void retryOpen();
void outputUpdated();
void handleStdout();
void handleStderr();
protected:
QProcess* m_fixer;
Application* m_parent;
QString m_output;
KProgressDialog* m_waiter;
bool m_done;
};
#endif // KUBUNTU
struct Application : cache::Observer {
Application();
~Application();
void setAcceptReadOnly( bool ro ) { m_acceptReadOnly = ro; }
bool writeable() { return cache::Global::get().writeable(); }
Cache &cache() { return cache::Global::get(); }
void openCache( unsigned flags = Cache::OpenDefault | Cache::OpenDebtags );
void initialize();
void cacheOpenedNowFinishInit();
void initKDEDebconf();
void initHistory();
void setMainWidget( QWidget *w ) { m_main = w; }
void setStatusBar( KStatusBar *s );
void updateStatusbar();
virtual void initFinished() { return; };
virtual void checkpoint();
virtual void undo();
virtual void redo();
int test_this_shit;
virtual void notifyPostChange( cache::component::Base * );
QString changeString();
QString statusString();
QString sizesString();
QWidget* mainWindow() { return m_main; };
unsigned openFlags() { return m_flags; };
protected:
virtual void setHistoryEnabled( bool ) {}
typedef cache::component::History< cache::component::State > History;
virtual History *history() { return m_history; }
bool m_acceptReadOnly;
unsigned m_flags;
QWidget *m_main;
KStatusBar *m_statusBar;
History *m_history;
#ifdef KUBUNTU
DpkgFixer* m_dpkgfixer;
#endif // KUBUNTU
};
}
#endif

145
adept/adept/changelog.cpp

@ -0,0 +1,145 @@
/* -*- C++ -*- */
#include <qstring.h>
#include <qstringlist.h>
#include <qhttp.h>
#include <qbuffer.h>
#include <kdebug.h>
#include <apt-front/cache/entity/entity.h>
#include <apt-front/cache/entity/package.h>
#include <adept/lister.h>
#include "changelog.h"
using namespace adept;
#ifdef KUBUNTU
ItemChangelog::ItemChangelog() {
connect(this, SIGNAL( changelogNeeded() ),
this, SLOT( requestChangelog() ));
m_http = 0;
m_content_catcher = 0;
}
ItemChangelog::~ItemChangelog() {
if (m_http != 0) {
delete m_http;
}
if (m_content_catcher != 0) {
delete m_content_catcher;
}
}
/* </