summaryrefslogtreecommitdiffstats
path: root/konqueror/preloader
diff options
context:
space:
mode:
Diffstat (limited to 'konqueror/preloader')
-rw-r--r--konqueror/preloader/Makefile.am21
-rw-r--r--konqueror/preloader/configure.in.in151
-rw-r--r--konqueror/preloader/konqy_preload.desktop75
-rw-r--r--konqueror/preloader/konqy_preloader.desktop146
-rw-r--r--konqueror/preloader/preloader.cc151
-rw-r--r--konqueror/preloader/preloader.h58
6 files changed, 602 insertions, 0 deletions
diff --git a/konqueror/preloader/Makefile.am b/konqueror/preloader/Makefile.am
new file mode 100644
index 000000000..8ecaba5ad
--- /dev/null
+++ b/konqueror/preloader/Makefile.am
@@ -0,0 +1,21 @@
+AM_CPPFLAGS = -DQT_NO_CAST_ASCII
+
+kde_module_LTLIBRARIES = kded_konqy_preloader.la
+
+INCLUDES= -I.. $(all_includes)
+kded_konqy_preloader_la_SOURCES = preloader.cc preloader.skel
+kded_konqy_preloader_la_LDFLAGS = $(all_libraries) -module -avoid-version
+kded_konqy_preloader_la_LIBADD = ../libkonqueror_intern.la $(LIB_KSYCOCA) $(LIB_KDECORE)
+
+METASOURCES = AUTO
+
+KonquerorIface_DIR = $(srcdir)/..
+
+servicesdir = $(kde_servicesdir)/kded
+services_DATA = konqy_preloader.desktop
+
+autostartdir = $(datadir)/autostart
+autostart_DATA = konqy_preload.desktop
+
+####### Build rules
+preloader.lo: ../konq_settingsxt.h
diff --git a/konqueror/preloader/configure.in.in b/konqueror/preloader/configure.in.in
new file mode 100644
index 000000000..315b23c97
--- /dev/null
+++ b/konqueror/preloader/configure.in.in
@@ -0,0 +1,151 @@
+dnl check whether mallinfo() is available and which fields to use to find out memory usage
+dnl it's used in konq_mainwindow.cc
+dnl warning, ugly code ahead
+dnl some implementations have mallinfo() in stdlib.h, others in malloc.h
+dnl fields showing memory usage should be hblkhd, uordblks and usmblks,
+dnl different implementations use different combinations of these (which is ok),
+dnl but some of them "reuse" fields they don't use for other purposes
+
+AC_DEFUN([KDE_MALLINFO_CHECK],
+[
+AC_MSG_CHECKING([for mallinfo() in $1])
+AC_CACHE_VAL(kde_cv_func_mallinfo_$2,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include $1],
+ [
+ struct mallinfo m;
+ int dummy;
+ m = mallinfo();
+ dummy = m.hblkhd;
+ dummy = m.uordblks;
+ dummy = m.usmblks;
+ dummy = dummy;
+ ],
+ kde_cv_func_mallinfo_$2=yes,
+ kde_cv_func_mallinfo_$2=no)
+ AC_LANG_RESTORE
+ ])
+if test "$kde_cv_func_mallinfo_$2" = "yes"; then
+ kde_mallinfo_type=$2
+fi
+AC_MSG_RESULT($kde_cv_func_mallinfo_$2)
+])
+
+
+AC_DEFUN([KDE_MALLINFO_CHECK_FIELD],
+[
+AC_MSG_CHECKING([whether to use mallinfo field $1])
+AC_CACHE_VAL(kde_cv_func_mallinfo_field_$1,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_RUN(
+ [
+
+#include <$kde_mallinfo_type.h>
+enum use_type { No, Yes, Never };
+use_type use_field = No;
+const int SIZE = 4 * 1024 * 1024;
+const int SMALL_SIZE = 4 * 1024;
+
+void dif( struct mallinfo& m1, struct mallinfo& m2, bool alloc )
+ {
+ int difval = m2.$1 - m1.$1;
+ if( alloc )
+ {
+ if( difval >= SIZE && difval < 2 * SIZE && use_field != Never )
+ use_field = Yes;
+ }
+ else // !alloc
+ {
+ difval = -difval;
+ if( difval > SMALL_SIZE && ( difval < SIZE || difval >= 2 * SIZE ) && use_field == Yes )
+ use_field = Never;
+ }
+ }
+
+int main()
+ {
+ free( malloc( SIZE * 2 )); // avoid Doug Lea's malloc feature of having total_max in usmblks
+ struct mallinfo m1 = mallinfo();
+ void* mem1 = malloc( SIZE );
+ struct mallinfo m2 = mallinfo();
+ free( mem1 );
+ struct mallinfo m3 = mallinfo();
+ void* mem2[ SIZE / 32 ];
+ for( int i = 0;
+ i < SIZE / 32;
+ ++i )
+ mem2[ i ] = malloc( 32 );
+ struct mallinfo m4 = mallinfo();
+ for( int i = 0;
+ i < SIZE / 32;
+ ++i )
+ free( mem2[ i ] );
+ struct mallinfo m5 = mallinfo();
+ void* mem3[ SIZE / 1024 ];
+ for( int i = 0;
+ i < SIZE / 1024;
+ ++i )
+ mem3[ i ] = malloc( 1024 );
+ struct mallinfo m6 = mallinfo();
+ for( int i = 0;
+ i < SIZE / 1024;
+ ++i )
+ free( mem3[ i ] );
+ struct mallinfo m7 = mallinfo();
+ dif( m1, m2, true );
+ dif( m2, m3, false );
+ dif( m3, m4, true );
+ dif( m4, m5, false );
+ dif( m5, m6, true );
+ dif( m6, m7, false );
+ return use_field == Yes ? 0 : 1;
+ }
+
+ ],
+ [kde_cv_func_mallinfo_field_$1=yes],
+ [kde_cv_func_mallinfo_field_$1=no],
+ [kde_cv_func_mallinfo_field_$1=no])
+ AC_LANG_RESTORE
+ ])
+AC_MSG_RESULT($kde_cv_func_mallinfo_field_$1)
+kde_mallinfo_$1=$kde_cv_func_mallinfo_field_$1
+if test "$kde_mallinfo_$1" = "yes"; then
+ AC_DEFINE( KDE_MALLINFO_FIELD_$1, 1, [Use mallinfo field $1])
+fi
+])
+
+
+kde_mallinfo_type=
+KDE_MALLINFO_CHECK([<stdlib.h>],stdlib)
+if test -z "$kde_mallinfo_type"; then
+ KDE_MALLINFO_CHECK([<malloc.h>],malloc)
+fi
+
+AC_TRY_LINK_FUNC(mallinfo,
+ [],
+ [ AC_CHECK_LIB(malloc,mallinfo,
+ [ AC_SUBST(LIBMALLOC,"-lmalloc") ],
+ [ kde_mallinfo_type="" ])
+ ])
+
+if test -n "$kde_mallinfo_type"; then
+ KDE_MALLINFO_CHECK_FIELD(hblkhd)
+ KDE_MALLINFO_CHECK_FIELD(uordblks)
+ KDE_MALLINFO_CHECK_FIELD(usmblks)
+ if test -z "$kde_mallinfo_hblkhd" -a \
+ -z "$kde_mallinfo_uordblks" -a \
+ -z "$kde_mallinfo_usmblks"; then
+ kde_mallinfo_type=
+ fi
+fi
+
+
+if test "$kde_mallinfo_type" = "stdlib"; then
+ AC_DEFINE(KDE_MALLINFO_STDLIB, 1, [mallinfo() is available in <stdlib.h>])
+elif test "$kde_mallinfo_type" = "malloc"; then
+ AC_DEFINE(KDE_MALLINFO_MALLOC, 1, [mallinfo() is available in <malloc.h>])
+fi
diff --git a/konqueror/preloader/konqy_preload.desktop b/konqueror/preloader/konqy_preload.desktop
new file mode 100644
index 000000000..48061a669
--- /dev/null
+++ b/konqueror/preloader/konqy_preload.desktop
@@ -0,0 +1,75 @@
+[Desktop Entry]
+Exec=konqueror --preload
+Type=Application
+Name=Konqueror Preloading During KDE startup
+Name[af]=Vroegtydige laai van Konqueror tydens KDE opstart
+Name[ar]=تحميل Konqueror التمهيدي خلال بدء تشغيل KDE
+Name[az]=KDE Başlanğıcında Konqueror-un Ön Yüklənməsi
+Name[be]=Папярэдняя загрузка Konqueror падчас запуску KDE
+Name[bg]=Зареждане на браузъра при стартиране
+Name[bn]=কে.ডি.ই. আরম্ভকালীন কনকরার প্রিলোড
+Name[bs]=Konqueror pre-učitavanje tokom pokretanja KDEa
+Name[ca]=Precàrrega del Konqueror durant l'engegada del KDE
+Name[cs]=Načtení Konqueroru dopředu během spuštění KDE
+Name[csb]=Wstãpny wladënk Konquerora przë zrëszaniu KDE
+Name[cy]=Cynlwytho Konqueror yn ystod Ymgychwyn KDE
+Name[da]=Konqueror forhåndsindlæsning ved opstart
+Name[de]=Konqueror bei KDE-Start im Hintergrund laden
+Name[el]=Προφόρτωση του Konqueror κατά την εκκίνηση του KDE
+Name[eo]=Konkeranto antaŭŝarĝante dum KDE-lanĉo
+Name[es]=Precargado de Konqueror durante el arranque de KDE
+Name[et]=Konquerori eellaadimine KDE käivitamisel
+Name[eu]=Konquerorren aurrekarga KDE abiatzen den bitartean
+Name[fa]=پیش‌بارگذاری Konqueror در طول راه‌‌‌اندازی KDE
+Name[fi]=Konquerorin esilataus KDE:n käynnistyksessä
+Name[fr]=Préchargement de Konqueror lors du démarrage de KDE
+Name[fy]=Konqueror foarlade ûnder it begjinnen fan KDE
+Name[ga]=Réamhluchtú Konqueror ag am tosaithe KDE
+Name[gl]=Precarga de Konqueror durante o início de KDE
+Name[he]=טעינה מוקדמת של Konqueror בזמן עלית KDE
+Name[hi]=केडीई चालू होने के दौरान कॉन्करर प्रीलोड हो रहा है
+Name[hr]=Konqueror pred-učitavanje tijekom podizanja KDE-a
+Name[hu]=Konqueror-gyorsbetöltő
+Name[is]=Konqueror ræsir þegar KDE ræsir
+Name[it]=Precaricamento di Konqueror durante l'avvio di KDE
+Name[ja]=KDE 起動時に Konqueror をプリロードします
+Name[ka]=Konqueror-ის წინჩატვირთვა KDE-ს გაშვებისას
+Name[kk]=KDE бастағанда Konqueror-ді алдын-ала жүктеу
+Name[km]=ប្រុងប្រៀប​ផ្ទុក Konqueror កំឡុងពេល​ចាប់ផ្ដើម KDE
+Name[ko]=KDE 시작 중 Konqueror 미리 불러오기
+Name[lt]=Įkelti Konqueror paleidžiant KDE
+Name[lv]=Iekarotāja priekšielāde KDE palaišanās laikā
+Name[mk]=Konqueror се предвчитува за време на подигањето на KDE
+Name[ms]=Prapemuatan Konqueror Semasa pemulaan KDE
+Name[mt]=Tlugħ ta' Konqueror waqt li jitla' KDE
+Name[nb]=Forhåndslast Konqueror når KDE starter
+Name[nds]=Konqueror vörladen bi't Hoochfohren vun KDE
+Name[ne]=KDE सुरुआत गर्दा पहिले लोड गरिएको कन्क्वेरर
+Name[nl]=Konqueror voorladen tijdens KDE-start
+Name[nn]=Førehandslast Konqueror når KDE startar
+Name[pa]=ਕੋਨਕਿਉਰੋਰ ਪਹਿਲਾਂ ਹੀ KDE ਦੀ ਸ਼ੁਰੂਆਤ 'ਤੇ ਹੀ ਲੋਡ ਹੋ ਜਾਦਾ ਹੈ
+Name[pl]=Wstępne wczytanie Konquerora przy uruchamianiu KDE
+Name[pt]=Pré-Carregamento do Konqueror no Arranque do KDE
+Name[pt_BR]=Pré-carregamento do Konqueror no início do KDE
+Name[ro]=Preîncărcare Konqueror la pornirea KDE
+Name[ru]=Предварительная загрузка Konqueror при запуске KDE
+Name[rw]=Ugutangirambere kwa Konqueror mu gihe cy'itangira rya KDE
+Name[se]=Viečča Konquerora ovdagihtii go KDE vuolgá johtui
+Name[sk]=Prednahratie Konquerora počas štartu KDE
+Name[sl]=Prednalaganje Konquerorja med zaganjanjem KDE
+Name[sr]=Предучитавање Konqueror-а приликом покретања KDE-а
+Name[sr@Latn]=Predučitavanje Konqueror-a prilikom pokretanja KDE-a
+Name[sv]=Förladdning av Konqueror vid start av KDE
+Name[ta]=கேடியி துவக்கத்தின்போது கான்கொரரை முன் ஏற்றுதல்
+Name[th]=ให้โหลดคอนเควอร์เรอร์ล่วงหน้า ขณะ KDE เริ่มทำงานริ่มทำงาน
+Name[tr]=KDE açılışında Konqueror Önyüklemesi
+Name[tt]=Konqueror'nı Aldan uq Yökläw
+Name[uk]=Попереднє завантаження Konqueror при старті KDE
+Name[vi]=Tải sẵn Konqueror Trong lúc Khởi động KDE
+Name[wa]=Prétcherdjî Konqueror tins l' enondaedje di KDE
+Name[zh_CN]=在 KDE 启动时预先装入 Konqueror
+Name[zh_TW]=啟動 KDE 時預先載入 Konqueror
+X-KDE-autostart-condition=konquerorrc:Reusing:PreloadOnStartup:false
+X-KDE-StartupNotify=false
+X-KDE-autostart-phase=2
+OnlyShowIn=KDE;
diff --git a/konqueror/preloader/konqy_preloader.desktop b/konqueror/preloader/konqy_preloader.desktop
new file mode 100644
index 000000000..da06b467a
--- /dev/null
+++ b/konqueror/preloader/konqy_preloader.desktop
@@ -0,0 +1,146 @@
+[Desktop Entry]
+Type=Service
+Name=KDED Konqueror Preloader Module
+Name[af]=KDED Konqueror Vroegtydige Laai Module
+Name[ar]=وحدة تمهيد التحميل لِــ KDED Konqueror
+Name[az]=KDED Konqueror Ön Yüklənmə Modulu
+Name[be]=Модуль папярэдняй загрузкі Konqueror KDED
+Name[bn]=KDED কনকরার প্রি-লোডার মডিউল
+Name[bs]=KDED modul za pre-učitavanje Konquerora
+Name[ca]=Mòdul de precàrrega del Konqueror KDED
+Name[cs]=KDED modul pro načítání Konqueroru
+Name[csb]=Mòduł wstãpnegò wladënkù Konquerora
+Name[cy]=Modiwl Cynlwytho Konqueror KDED
+Name[da]=KDED Konqueror forindlæsningsmodul
+Name[de]=Konqueror-Schnellstart
+Name[el]=KDED άρθρωμα Προφόρτωσης του Konqueror
+Name[eo]=KDED-Konkeranta antaŭŝarĝomodulo
+Name[es]=Módulo de precarga de Konqueror KDED
+Name[et]=KDED Konquerori eellaadimise moodul
+Name[eu]=KDED Konqueror aurrekargatze modulua
+Name[fa]=پیمانۀ پیش‌بارکنندۀ KDED Konqueror
+Name[fi]=Konquerorin esilatausmoduuli KDED:lle
+Name[fr]=Module KDED de préchargement de Konqueror
+Name[fy]=KDED Konqueror Foarlaad-module
+Name[ga]=Modúl Réamhluchtú Konqueror KDED
+Name[gl]=Módulo KDED de Precarga de Konqueror
+Name[he]=מודול KDED Konqueror Preloader
+Name[hi]=केडीईडी कॉन्क्वेरर प्रीलोडर मॉड्यूल
+Name[hr]=KDED Konqueror modul pred-učitavanja
+Name[hu]=KDED gyorsbetöltő modul a Konquerorhoz
+Name[is]=KDED Konqueror forræsingareining
+Name[it]=Modulo di KDED per precaricare Konqueror
+Name[ja]=KDED Konqueror プリロードモジュール
+Name[ka]=Konqueror-ის წინჩატვირთვის მოდული KDED
+Name[kk]=KDED деген Konqueror-ді алдын-ала жүктеу модулі
+Name[km]=ម៉ូឌុល​កម្មវិធី​ប្រុងប្រៀប​ផ្ទុក KDED Konqueror
+Name[ko]=KDED Konqueror 프리로더 모듈
+Name[lt]=KDED Konqueror išankstinio įkrovimo modulis
+Name[lv]=KDED Iekarotāja priekšielādēšanas modulis
+Name[mk]=Модул на KDED за предвчитување на Konqueror
+Name[ms]=Modul Pramuat Konqueror KDE
+Name[mt]=Modulu biex itella' Konqueror fil-bidu
+Name[nb]=KDED-modul for å forhåndslaste Konqueror
+Name[nds]=KDED-Moduul för't Vörladen vun Konqueror
+Name[ne]=KDED कन्क्वेरर प्रीलोडर मेनु
+Name[nl]=KDED Konqueror Preloader-module
+Name[nn]=KDED-modul for førehandslasting av Konqueror
+Name[pa]=KDED ਕੋਨਕਿਉਰੋਰ ਪਹਿਲਾਂ ਲੋਡ ਮੇਡੀਊਲ
+Name[pl]=Moduł KDED wstępnego wczytania Konquerora
+Name[pt]=Módulo KDED de Pré-Carregamento do Konqueror
+Name[pt_BR]=Módulo de Pré-carregamento do Konqueror
+Name[ro]=Modul KDED de preîncărcare Konqueror
+Name[ru]=Предварительная загрузка Konqueror
+Name[rw]=Igice Mutangizambere KDE Konqueror
+Name[sk]=Modul KDED prednahrania Konquerora
+Name[sl]=Modul KDED za prednalaganje Konquerorja
+Name[sr]=Модул за предучитавање Konqueror-а, KDED
+Name[sr@Latn]=Modul za predučitavanje Konqueror-a, KDED
+Name[sv]=KDED Konqueror-förladdningsmodul
+Name[ta]=KDED கான்கொரர் முன் ஏற்றக்கூடிய பகுதி
+Name[th]=โมดูลโหลดคอนเควอร์เรอร์ล่วงหน้าของ KDED
+Name[tr]=KDED Konqueror Önyükleme Modülü
+Name[tt]=Konqueror'nı Aldan uq Yökläw
+Name[uk]=Модуль KDED для попереднього завантаження Konqueror
+Name[vi]=Mô đun Tải sẵn Konqueror KDED
+Name[wa]=Module KDED di prétcherdjaedje di Konqueror
+Name[zh_CN]=KDED Konqueror 预装入模块
+Name[zh_TW]=KDED Konqueror 預先載入模組
+Comment=Reduces Konqueror startup time
+Comment[af]=Verminder Konqueror se opstart tyd
+Comment[ar]=Konqueror يقلّل من وقت بدء تشغيل
+Comment[az]=Konqueror-un başlanğıc sürəsini azaldır
+Comment[be]=Змяншае час запуску Konqueror
+Comment[bg]=Намаляване на времето за стартиране на браузъра
+Comment[bn]=কনকরার চালু করার সময় কমায়
+Comment[bs]=Skraćuje vrijeme za pokretanje Konquerora
+Comment[ca]=Redueix el temps d'inici del Konqueror
+Comment[cs]=Redukuje čas pro spuštění Konqueroru
+Comment[csb]=Zmiészô czas zrëszaniô Konquerora
+Comment[cy]=Lleihau amser ymgychwyn Konqueror
+Comment[da]=Reducerer Konquerors opstartstid
+Comment[de]=Lädt Konqueror im Voraus und verringert so die Ladezeit
+Comment[el]=Μειώνει το χρόνο εκκίνησης του Konqueror
+Comment[eo]=Mallongigas la Konkerantan starttempon
+Comment[es]=Reduce el tiempo de inicio de Konqueror
+Comment[et]=Kahandab Konquerori käivitamise aega
+Comment[eu]=Konquerorren abiatze denbora laburtzen du
+Comment[fa]=زمان راه‌اندازی Konqueror را کاهش می‌دهد
+Comment[fi]=Vähentää Konquerorin käynnistysaikaa
+Comment[fr]=Réduit le temps de démarrage de Konqueror
+Comment[fy]=Redusearret de begjintiid fan Konqueror
+Comment[ga]=Laghdaíonn sé seo an t-am chun Konqueror a thosú
+Comment[gl]=Reduce o tempo de início de Konqueror
+Comment[he]=מוריד את זמן הפעלת Konqueror
+Comment[hi]=कॉन्करर के चालू होने के समय को कम करता है
+Comment[hr]=Ubrzava pokretanje Konquerora
+Comment[hu]=A Konqueror elindulási idejének lecsökkentése
+Comment[is]=Dregur úr ræsingatíma Konqueror vafrans
+Comment[it]=Riduce il tempo di avvio di Konqueror
+Comment[ja]=Konqueror の起動時間を短縮します
+Comment[ka]=ამცირებს Konqueror-ის გაშვების დროს
+Comment[kk]=Konqueror-ді жүктеу уақытын қысқартады
+Comment[km]=បន្ថយ​រយៈពេល​ចាប់ផ្ដើម​របស់ Konqueror
+Comment[ko]=Konqueror 시작 시간을 줄입니다
+Comment[lt]=Sutrumpina Konqueror paleidimo laiką
+Comment[lv]=Samazina Iekarotāja palaišanas laiku
+Comment[mk]=Го намалува времето за стартување на Konqueror
+Comment[mn]=Конкюрорын эхлэх хугацааг багасгах
+Comment[ms]=Mengurangkan masa pemulaan Konqueror
+Comment[mt]=Inaqqas id-dewmien biex jitla' Konqueror
+Comment[nb]=Reduserer oppstartstida for Konqueror
+Comment[nds]=Bringt de Starttiet vun Konqueror daal
+Comment[ne]=कन्क्वेरर सुरुआत समय घटाउँछ
+Comment[nl]=Reduceert de opstarttijd van Konqueror
+Comment[nn]=Reduserer oppstartstida til Konqueror
+Comment[pa]=ਇਹ ਕੋਨਕਿਉਰੋਰ ਦਾ ਸ਼ੁਰੂਆਤੀ ਸਮਾਂ ਘਟਾਉਦਾ ਹੈ
+Comment[pl]=Zmniejsza czas uruchomienia Konquerora
+Comment[pt]=Reduz o tempo de arranque do Konqueror
+Comment[pt_BR]=Reduz o tempo de inicialização do Konqueror
+Comment[ro]=Reduce timpul de pornire al Konqueror
+Comment[ru]=Предварительная загрузка Konqueror во время запуска KDE
+Comment[rw]=Igabanya igihe cy'itangira cya Konqueror
+Comment[se]=Unnida Konquerora álggahanáiggi
+Comment[sk]=Zmenšuje dobu štartu Konquerora
+Comment[sl]=Skrajša zagonski čas Konquerorja
+Comment[sr]=Смањује време потребно за покретање Konqueror-а
+Comment[sr@Latn]=Smanjuje vreme potrebno za pokretanje Konqueror-a
+Comment[sv]=Minskar Konquerors starttid
+Comment[ta]=கான்கொரர் துவக்க நேரத்தை குறைக்கிறது
+Comment[te]=కాంకెరర్ మొదలు సమయాన్ని తగ్గించును
+Comment[th]=ลดเวลาที่ใช้เริ่มทำงานของคอนเควอร์เรอร์
+Comment[tr]=Konqueror açılış zamanını azaltır
+Comment[tt]=Konqueror cibärüen tizlätä
+Comment[uk]=Зменшує час запуску Konqueror
+Comment[uz]=Konqueror ishga tushish vaqtini kamaytirish
+Comment[uz@cyrillic]=Konqueror ишга тушиш вақтини камайтириш
+Comment[vi]=Giảm thời gian khởi động Konqueror
+Comment[wa]=Fwait enonder pus raddimint Konqueror
+Comment[zh_CN]=减少 Konqueror 启动时间
+Comment[zh_TW]=減少 Konqueror 啟動時間
+ServiceTypes=KDEDModule
+X-KDE-ModuleType=Library
+X-KDE-Library=konqy_preloader
+X-KDE-FactoryName=konqy_preloader
+X-KDE-Kded-autoload=false
+X-KDE-Kded-load-on-demand=true
diff --git a/konqueror/preloader/preloader.cc b/konqueror/preloader/preloader.cc
new file mode 100644
index 000000000..a60604e86
--- /dev/null
+++ b/konqueror/preloader/preloader.cc
@@ -0,0 +1,151 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Lubos Lunak <[email protected]>
+
+ 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; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "preloader.h"
+#include "konq_settingsxt.h"
+
+#include <kconfig.h>
+#include <dcopref.h>
+#include <kapplication.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+
+KonqyPreloader::KonqyPreloader( const QCString& obj )
+ : KDEDModule( obj )
+ {
+ reconfigure();
+ connect( kapp->dcopClient(), SIGNAL( applicationRemoved( const QCString& )),
+ SLOT( appRemoved( const QCString& )));
+ connect( &check_always_preloaded_timer, SIGNAL( timeout()),
+ SLOT( checkAlwaysPreloaded()));
+ }
+
+KonqyPreloader::~KonqyPreloader()
+ {
+ updateCount();
+ }
+
+bool KonqyPreloader::registerPreloadedKonqy( QCString id, int screen )
+ {
+ if( instances.count() >= (uint)KonqSettings::maxPreloadCount() )
+ return false;
+ instances.append( KonqyData( id, screen ));
+ return true;
+ }
+
+QCString KonqyPreloader::getPreloadedKonqy( int screen )
+ {
+ if( instances.count() == 0 )
+ return "";
+ for( InstancesList::Iterator it = instances.begin();
+ it != instances.end();
+ ++it )
+ {
+ if( (*it).screen == screen )
+ {
+ QCString ret = (*it).id;
+ instances.remove( it );
+ check_always_preloaded_timer.start( 5000, true );
+ return ret;
+ }
+ }
+ return "";
+ }
+
+void KonqyPreloader::unregisterPreloadedKonqy( QCString id_P )
+ {
+ for( InstancesList::Iterator it = instances.begin();
+ it != instances.end();
+ ++it )
+ if( (*it).id == id_P )
+ {
+ instances.remove( it );
+ return;
+ }
+ }
+
+void KonqyPreloader::appRemoved( const QCString& id )
+ {
+ unregisterPreloadedKonqy( id );
+ }
+
+void KonqyPreloader::reconfigure()
+ {
+ KonqSettings::self()->readConfig();
+ updateCount();
+ // Ignore "PreloadOnStartup" here, it's used by the .desktop file
+ // in the autostart folder, which will do 'konqueror --preload' in autostart
+ // phase 2. This will also cause activation of this kded module.
+ }
+
+void KonqyPreloader::updateCount()
+ {
+ while( instances.count() > (uint)KonqSettings::maxPreloadCount() )
+ {
+ KonqyData konqy = instances.first();
+ instances.pop_front();
+ DCOPRef ref( konqy.id, "KonquerorIface" );
+ ref.send( "terminatePreloaded" );
+ }
+ if( KonqSettings::alwaysHavePreloaded() &&
+ KonqSettings::maxPreloadCount() > 0 &&
+ instances.count() == 0 )
+ {
+ if( !check_always_preloaded_timer.isActive())
+ {
+ if( kapp->kdeinitExec( QString::fromLatin1( "konqueror" ),
+ QStringList() << QString::fromLatin1( "--preload" ), NULL, NULL, "0" ) == 0 )
+ {
+ kdDebug( 1202 ) << "Preloading Konqueror instance" << endl;
+ check_always_preloaded_timer.start( 5000, true );
+ }
+ // else do nothing, the launching failed
+ }
+ }
+ }
+
+// have 5s interval between attempts to preload a new konqy
+// in order not to start many of them at the same time
+void KonqyPreloader::checkAlwaysPreloaded()
+ {
+ // TODO here should be detection whether the system is too busy,
+ // and delaying preloading another konqy in such case
+ // but I have no idea how to do it
+ updateCount();
+ }
+
+void KonqyPreloader::unloadAllPreloaded()
+ {
+ while( instances.count() > 0 )
+ {
+ KonqyData konqy = instances.first();
+ instances.pop_front();
+ DCOPRef ref( konqy.id, "KonquerorIface" );
+ ref.send( "terminatePreloaded" );
+ }
+ // ignore 'always_have_preloaded' here
+ }
+
+extern "C"
+KDE_EXPORT KDEDModule *create_konqy_preloader( const QCString& obj )
+ {
+ return new KonqyPreloader( obj );
+ }
+
+#include "preloader.moc"
diff --git a/konqueror/preloader/preloader.h b/konqueror/preloader/preloader.h
new file mode 100644
index 000000000..2a667e462
--- /dev/null
+++ b/konqueror/preloader/preloader.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Lubos Lunak <[email protected]>
+
+ 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; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _KONQUEROR_PRELOADER_H
+#define _KONQUEROR_PRELOADER_H
+
+#include <kdedmodule.h>
+#include <qtimer.h>
+
+class KonqyPreloader
+ : public KDEDModule
+ {
+ Q_OBJECT
+ K_DCOP
+ public:
+ KonqyPreloader( const QCString& obj );
+ virtual ~KonqyPreloader();
+ k_dcop:
+ bool registerPreloadedKonqy( QCString id, int screen );
+ QCString getPreloadedKonqy( int screen );
+ ASYNC unregisterPreloadedKonqy( QCString id );
+ void reconfigure();
+ void unloadAllPreloaded();
+ private slots:
+ void appRemoved( const QCString& id );
+ void checkAlwaysPreloaded();
+ private:
+ void updateCount();
+ struct KonqyData
+ {
+ KonqyData() {}; // for QValueList
+ KonqyData( const QCString& id_P, int screen_P )
+ : id( id_P ), screen( screen_P ) {}
+ QCString id;
+ int screen;
+ };
+ typedef QValueList< KonqyData > InstancesList;
+ InstancesList instances;
+ QTimer check_always_preloaded_timer;
+ };
+
+#endif