summaryrefslogtreecommitdiffstats
path: root/kworldwatch
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitae2a03c2941bf92573f89b88ef73f8aa842bea0a (patch)
tree3566563f3fb6ac3cb3496669d8f233062d3091bc /kworldwatch
downloadtdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.tar.gz
tdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kworldwatch')
-rw-r--r--kworldwatch/Makefile.am42
-rw-r--r--kworldwatch/about.ui217
-rw-r--r--kworldwatch/applet.cpp122
-rw-r--r--kworldwatch/applet.h70
-rw-r--r--kworldwatch/astro.c166
-rw-r--r--kworldwatch/astro.h42
-rw-r--r--kworldwatch/cities.cpp208
-rw-r--r--kworldwatch/cities.h87
-rw-r--r--kworldwatch/clock.ui259
-rw-r--r--kworldwatch/flags.cpp145
-rw-r--r--kworldwatch/flags.h100
-rw-r--r--kworldwatch/flow.cpp135
-rw-r--r--kworldwatch/flow.h55
-rw-r--r--kworldwatch/hi16-app-kworldclock.pngbin0 -> 933 bytes
-rw-r--r--kworldwatch/hi22-app-kworldclock.pngbin0 -> 1544 bytes
-rw-r--r--kworldwatch/hi32-app-kworldclock.pngbin0 -> 2651 bytes
-rw-r--r--kworldwatch/hi48-app-kworldclock.pngbin0 -> 4825 bytes
-rw-r--r--kworldwatch/kdeworld.desktop69
-rw-r--r--kworldwatch/kworldclock.desktop80
-rw-r--r--kworldwatch/kwwapplet.desktop107
-rw-r--r--kworldwatch/main.cpp202
-rw-r--r--kworldwatch/main.h85
-rw-r--r--kworldwatch/maploader.cpp172
-rw-r--r--kworldwatch/maploader.h81
-rw-r--r--kworldwatch/maps/Makefile.am1
-rw-r--r--kworldwatch/maps/README.maps10
-rw-r--r--kworldwatch/maps/depths/400.jpgbin0 -> 28526 bytes
-rw-r--r--kworldwatch/maps/depths/800.jpgbin0 -> 105465 bytes
-rw-r--r--kworldwatch/maps/depths/Makefile.am2
-rw-r--r--kworldwatch/maps/depths/depths.desktop64
-rw-r--r--kworldwatch/maps/flatworld/1200.jpgbin0 -> 89701 bytes
-rw-r--r--kworldwatch/maps/flatworld/1600.jpgbin0 -> 124709 bytes
-rw-r--r--kworldwatch/maps/flatworld/200.jpgbin0 -> 9330 bytes
-rw-r--r--kworldwatch/maps/flatworld/400.jpgbin0 -> 22751 bytes
-rw-r--r--kworldwatch/maps/flatworld/800.jpgbin0 -> 51623 bytes
-rw-r--r--kworldwatch/maps/flatworld/Makefile.am2
-rw-r--r--kworldwatch/maps/flatworld/flatworld.desktop53
-rw-r--r--kworldwatch/mapwidget.cpp576
-rw-r--r--kworldwatch/mapwidget.h161
-rw-r--r--kworldwatch/pics/Makefile.am2
-rw-r--r--kworldwatch/pics/flag-blue.pngbin0 -> 316 bytes
-rw-r--r--kworldwatch/pics/flag-green.pngbin0 -> 314 bytes
-rw-r--r--kworldwatch/pics/flag-mask.xpm21
-rw-r--r--kworldwatch/pics/flag-red.pngbin0 -> 313 bytes
-rw-r--r--kworldwatch/pics/flag.pngbin0 -> 289 bytes
-rw-r--r--kworldwatch/pics/world2.pngbin0 -> 5132 bytes
-rw-r--r--kworldwatch/sunclock.c164
-rw-r--r--kworldwatch/sunclock.h98
-rw-r--r--kworldwatch/zone.tab409
-rw-r--r--kworldwatch/zoneclock.cpp287
-rw-r--r--kworldwatch/zoneclock.h134
51 files changed, 4428 insertions, 0 deletions
diff --git a/kworldwatch/Makefile.am b/kworldwatch/Makefile.am
new file mode 100644
index 0000000..75901df
--- /dev/null
+++ b/kworldwatch/Makefile.am
@@ -0,0 +1,42 @@
+SUBDIRS = maps pics
+
+noinst_LTLIBRARIES = libww.la
+libww_la_SOURCES = maploader.cpp mapwidget.cpp astro.c sunclock.c about.ui cities.cpp zoneclock.cpp flags.cpp flow.cpp clock.ui
+
+KDE_ICON = kworldclock
+
+bin_PROGRAMS = kworldclock
+
+INCLUDES = $(all_includes)
+
+kworldclock_SOURCES = main.cpp
+kworldclock_LDADD = libww.la $(LIB_KDEUI)
+kworldclock_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+
+xdg_apps_DATA= kworldclock.desktop
+
+progdir=$(kde_datadir)/kdesktop/programs
+prog_DATA = kdeworld.desktop
+
+kde_module_LTLIBRARIES = ww_panelapplet.la
+
+ww_panelapplet_la_SOURCES = applet.cpp
+
+METASOURCES = main.moc zoneclock.moc applet.moc mapwidget.moc
+
+noinst_HEADERS = applet.h
+
+lnkdir = $(kde_datadir)/kicker/applets
+lnk_DATA = kwwapplet.desktop
+
+tab_DATA = zone.tab
+tabdir = $(kde_datadir)/kworldclock
+
+EXTRA_DIST = $(lnk_DATA)
+
+ww_panelapplet_la_LDFLAGS = $(KDE_PLUGIN) -module $(all_libraries)
+ww_panelapplet_la_LIBADD = libww.la $(LIB_KSYCOCA)
+
+messages: rc.cpp
+ $(XGETTEXT) rc.cpp $(kworldclock_SOURCES) $(libww_la_SOURCES) -o $(podir)/kworldclock.pot
+
diff --git a/kworldwatch/about.ui b/kworldwatch/about.ui
new file mode 100644
index 0000000..9d62a17
--- /dev/null
+++ b/kworldwatch/about.ui
@@ -0,0 +1,217 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AboutDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AboutDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>350</width>
+ <height>216</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>About KDE World Clock</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>PixmapLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>The KDE World Clock</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>This is a little toy to display the time on each place on the earth.
+
+Copyright: (c) 2000 Matthias Hoelzer-Kluepfel</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter|AlignLeft</set>
+ </property>
+ <property name="wordwrap" stdset="0">
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="875">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff610000033249444154388da59349685c7500c67f6f992533992cd3c964330d934427c1a6a624968ad2d50a31a506b522a2143caa08ea4d7b11173c288aa8f4e0418a68d21244424911d21a43036d206d69d298669b26992493996c7df3f25edef6f76283209efccedff73b7d3ff89f910094a3bdf2eb2f263bdb1a4bdfc6710e20498e27cb0303c30b9f777df2d6ef6843e23f01be7dddf29b6fecffac3551f06e755057caa37e6459663e63b0b01d11b34b6b7659b4703bbb698ff60f672e0c0dce7ecfc82bda0ea1e3bd1b9d9f76a59da9991591cf6f09db76846d3be2fe7d5d8c8e2f8b8fba97c4d0ad6591d56c7137678b33ddf3e98617fa0e3ed82bcd1d1f7cf7c4437a9deaac1289848944c2c8803fe0c3ef83b9058deb33263555616cdba3a12a14318b4a5fce99ad03eb933d736a6ad93dd0f27c98faba04a9549ad9d9797cd915446515959565d497092e5cb738d89ac7a72a9896c323bbac8289c7933f4df7b734a91e8a9000455148d6d7b0327213fdd1466a6bab711c8fc97b065bdb2ef9cd35f286453abbc9b94bb7089454d63477bc735a2d2ef25f9d5ed48fefaeb120354dd963cdc4030184101886c9dc1aa8f60a67bbee309bceb1aabb6c990678d33c7bece4736aee9ef1d5cd6ce4c89ed169359a28a74056c076318c6d1697746e64824cce8cb1aee700f007c2ec7df21021552009a75ec96ebe3aa554c4a440ace0b06ce9e4359df5f52d52f39bfc3117e2cf9c8d1492d958d35094206d479fa1be2141c5ae307edb5a950048ce48475e72c763412bf970652192a29036fde41c8592aa5216a7ee327eed1ad589dd3cdd7e8891abc30415814f5bbfa8023051272cf9f6d9156de3cb9aa63845b118e536445df004c49a1b087a16ad6d495c43a3a9ae024337f9f597de1e69e751ed7de1d74e26c79289686d3c5e8ce982ed821020cbe09721a842812a280d499cef1ebcf3c3fbc7f7ab3b80be76fd7251cfa97d0d87fbab8b88980e38dedf00095405820a840312bf5d99583df7f517a7615b57fe298636767e7178217e295252fa5438541c9fcf38d89687a6bbc40a653cdbe2c79f0747befdf8c35322d33bb263e3bfa2467dd5c7ce74ee69d97b4256028d8ee37adac6eac4e8d095defce8371701f341f52fe03c715325d17f970000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="4795">89504e470d0a1a0a0000000d49484452000000300000003008060000005702f98700001282494441546881ed99696c5cd775c77f6f9f8db371df298a12455114452d9663cb9becd88ee578411cc771e2264d53f4430bb41f02044d8b368b5104481314598a342d92268ed338889d7889bcca966c6d942c895a4d52dc49911c92b3706638db5b6e3f0c4991b2e42869d27ee9010ede9d8737effdfff77fceb9e7be07ff6fffb7265dd755f7bdaabbdd6a7373adaf335ca2dfe5f6a83b035eb5de63a80147082b993167d20b567f266bbd333a9b3d3015c9bc275eba7bea8f8c1db81e02f7bcdcb6bec9ffe97b6facf9c8c6e69296b5552e5f65d090dc868c224b08c0341d52599b89b99cd337918d9ce88d9d7be5c8e44f52f1dc8bbc79fffcff3e815b5f9014552a6d5d137cfcf69d357f7bdf4dd565f5e5869acf9acc4573cccd665848e628e42d6459c2f0e804421e2aca5d04832e1c49e2785f32f7e29bbda74f1c3af2a5e9e3cf1e217538fbc720a05ceda4bbf993755b37557ce3b1fbd6fed5c76eaf0b5b1672f7914b0c9fbf04a9792adc260d65321e698ebab04ca95b6026938c0c4439df9b209d97d9dc56aa6e6bafa92bc8c13be30bba9d98374e91edb7fed004562bd0f98ce4f5e94d5d5babbffbf9c7daef6ea8f2a83d67a3c42f0ed3d522b179531d1e8f8eaaa9288accc8c830c16008bf3f80e3d814f23673d114478e4f306556d0bab58eca3237af1e9e143ff9d9be4c520a652c474a59596b82bc791687c328d221ba1f1dfd8310d0ba9e29efda5afbedcf3edef1485585573d7674926675965d3794313337ce86d63674dd4096419665161616d0750d55d51042e038824824423a9da450f0f3ead179026d2db4adf5f3c63b6314126374ed68239185d1a905fa86e3f40ecccd8e8d258e8aacf90cbafc02473e91fafd0834fea7bcbeb3fa8b8f3ed6f90f1b5acb5cdd8727d81a9ee7ae5baa71b90d6cdbc2e5d251550d599690240959968022f025cfe5f208211042108ba6f9e9de39b4e6665aea7dec7fe30c4fdcee65d78debc90a88666168164ef427387064948347c686e391f4b731947fe3e827ae2b679673400e3fd475e77d1bbfb76d6753e0c889189dee08f7eeaec5ed31505505b7db40d735344d41d314545541516414455e319650d562788184cba5d3542171e4e834595f98fafa725e7da587dbb757e0d674bc8aa0ce0f1beadd747454b1b9ab29a41bcabdc323f1fbadf043034c3f3b747d042a7ee05adb5ef985bb1fdc72db584cc8b9bef3ec58bf40281cc0ef2f4155e515a095650556ba2c4bcbe7579a6e28b010e1ad330e55cde524922ae9e97e1ad6d4923505054ba0490ee586a0d4af51df5ac9a64db5559148f2891971b744e4b9fdbf9580a7fce18e1befdaf4c5706365f9f95397f8c4f602b1e814bdbd23388e4528e4c3ebf5a22832d207ac1c4522f22289e2787c7c8c50482531b5c0a9a89fc6c600a7bb2fb2715d09bacb8d650bf29620670a3caa4d48139886872d3b9a244958b7f7256e6da5e1e3bf61f2d9ab563005a066fd13f7b7ed5cfbf88ced5683a9293e7647051bdad6e0f1189c3d7b91d1d129745d5954e3aa957795c9b28410e03802afd787df1f44c3e4b5d305029521e6a766a92d85505910cb11cb9eb70408877297cdc09cc39a4d755485f48e5327273653bde739a65fb0af4aa0a2f1537fd770436b47dfa4cd3d7571badac3b83d2e6a6bab686f6f269fcf73e2442fc3c313188686cfe74655d5cb778944c03040511042502814c866738bb920e338025d85a367934c4961b45c0ead30cd9a963a2c87556edae0084195c7e695b3f3acd9d8407da9abb5a7fbbd46e65ef9f5d509343ff14fdeb6f5e1c94b291ed994a3b13180aa2aa8aa8cc7e3a2a9a9968a8a10f178929e9e3e1289141e8f816118303888fdeb5f916959cf4c2cc9e0e03867ce5ca4a7a797b2b2003e9f17db16086173e1628a9e5490a0622312036cec5cbb4a81252fd8024596680e49fc60ff3437ee6cc150b4ce81212343ead8e195045400ddedaa99c9aad8991c019f8c6ddb08a12ec732483434d4505d5dcec4c434dddde778e9a5039496fa49bf7b9c4053330baf1f2793c962182aa5a501b66edd4069690800c7b1912441a957303bed501b76138b67c8158a612d844000f28a04cb015e43e64fba0cbefe4a2f7ffde056fafb269f1cdcfbe67e72e78faf222069ba2b5990706c9bf9f92823c369aa6b6a70b92a5625ada669ac59534f7575056f1d38467f6f1f318f0fff428e5d5b6aa9ae2ea3a2a21497cb00246cdb219bcd31353549727e9e425e502840ce51c9176c32d91c8e00af4bc3ebd288255797fe6c0edaaa0d6eaecaf2cbee513ef3b93bf52f9f79f83bce40ef2d609b003280694a195512785c2ac16019cd6b5b080482804088f727a9cbb6b861668ced9d1bd9f5a1ed6cdbba911d3b3a6868a8c5e572b1b43e0a219024999a9a5a9a1a9b71bbbcb85d60db0eb22c8363e377ab844b0ce2f30b64b37972b92b3c6f52ed753872e02805afce1d0f3db21357e727572990cbdae3a5aab5c1f4bb984fa5966bb9e31457d4551d473e8ff5e28b7843016ebc652792242faec8abadb81a83102049328e80541e4a030a4a2e4945d8c3a6e672e61259666349e2f3e9c5672d0253657455e1f98343fcc7cb17b01732bc7ce0241fbf772b077ef3e017acf74e3d03222f03580571d270f278836ea6a216a6692df7368ee35cbeb1e3e01c3c8829cb6877deb9bca85dcd8a65d4599e844cc6249e5509f934c8a4b1b13978f222a7de1b62787c8a6c66815c368359c8210b8b99b904dffec541bef7f3b7c9a7a220329c397618c780adbbeeec4069b8638502ce5e733ef350b831e4198e2aa49279344d45924055156459a0081ba7bb9b7c2482fee8a3282bcbe855c0dbb68d6d3b140a058480d1891429b58450894c743e82bf4a21168b21c9128a2c232932aaaa323397a0fbdc08fbde1d603e960643652911cde40ca7ce9ee7e65b3771ecb91b1e253afa8a0a9088e47ad291cc60ed86f28e742e406fff2ce1d0284d4dcd4522aa8c3430487e7010f5fefb3f107c512807cb2a2a373131412e97e16caf8cbba281859c89484d110ee9e0985896436c21cff87494ded119866716b8343802ba068a0c66fef28dcd1ca78f7773d3e737e3aedf766b36facba00a5028c8fdc327675eaaebac6e6b68ac564f0fccf0c01d15b8dd1e4cdb411a9bc03c72186dcf1ed450e803665e60db0e9665635936a669535555cde14343a43c9568010f53ef0e63c8031cef2f259a1c667a2ec9742c492a9505d3a4b4be818ab52dcc4c8c21cb0a8e6d175b1445c1d65d4c8e8d826cd3d0d2d6d0d713682f4e65f45e33a6bef9e3a193339faeafabafaf5cd7ccc99e6102a112024e01eb9db7716edb8d1a0c6359f672bfb354628bc95a04bf44c0346d6cdb667c3cc158cc85bba992e98b167dc75e256e8dc150a4f8475942566434971b0c37e9f9245b6ede4d3a99c6711c02655500cc8c0d000a0ba9052291299a9a1bb43eb5aafd7263e3ffb39865c959e1d2efa86f09e8259ac4e45084c68933d8edede4822124014bf57d294157cfb8433abd80695a388ec3e4e43c474f26f1b7aee5dcaccea1170e138d1f46f3f950350d552bee2f14454596156459c1b62c54dd85dbeb47313cecbcef63c4a6a6b00b79dab6ec607a6c94b6f6565c5a88d3fbf79ebf4c20fd23b2f2e72e66338409b83b5bdb43aa4f96b83099c7a80e331d19251c2a03a4e5cd4b3c9ec0b6c53229db7688c5a24c4e5e6262c2e25c6f9adaae755c487b39f0fa04a44f30978da21a2e2459b9aa2b9a4e3a116721994092548465130806b8e3a30fb3ae6d13f1e81c6bd6d4e3d6021cdff75aefead672fedff359edcfdf8d47ed9ab4a16fa96f09d2b226c0853333d8a6444989812489e5b27ae9d204b22ca3aa1a8582492693271acd73f6ec3cb23b487d67136f8d1bbcf1da1cb5be21da6f6ee7c2857e64f9f28cbfdf556cdba6b2b195adbbf7606653b46fdd86c75039fef601da3b36515916c0cecb1c7bf5a573ef2b274e7fc7ecac72f16f8e1f1afb4c6cae8e8fde15e0d63b37635e8a70ee5c1cc7b1f07a15dc6e95542ac3ecac842c2f90c958e472e0f1bad872730753aa9fff3a0987f70d52571665e3ad5d0845275456c17c2c8ea25ca52d97c0324dcaeb9ad9f5c023f8bc6e366c68e4e59fff024512cc2712dc74d376ea6a435c9899010457ad87e2bd7589c2f643f34da5e5811ffc2846f78e72eede59cdd69de59492c7cc1648a7f21886174906af4fc7e333700c9d918cc1f3c312fb0fa5490c5fa4adcb43ddba0e4cc58da241454d3df3f124b2aabfffb98e83dbebe143f73d4c20e0461182a1f3bd6ceaec606278981d3bba686aaca4b404d2a91c58e9f4350b7a3a5f186b6d533a8e9deae68d67658ebdb396caa672d6afada0b5c14b7508fc7eb01d989b87b101e81bc972697c0a3395a1ba3acd8df737e1f2873001d30255064fa01459d15194d5041c21300b599ada36505119407600cb4495a06b7b1bbb6e6e4316c5955797612e9a824274fa9a04ccac79269db13bea6a03446343141666193de365ac47639fa4a3e80164c540d50c5c1e1955b5f0043d54d606099485f006d7e2283259f3f23d15c0464155f4550a08c7c16db858dbdec1a61ddbd0005d87543a43dff97e540992f104f7dd7b23b95c0ebc6e26c6230ed6ccc8b59754cb393016497faaa5a99ad3e7c7d15d4b0f34719c3c9619c741e296fb1f2450514aa150dc51398b6d53410057ec6215c0132c47d50d144505248410a8ba4ae3865602c100a1801b55025d82f2b01fd3b4d9f7fa61745d636c3c42677b23d5bbbb181b1a9a434407ae4d4091de387d319af8ecbd0d41c3e54156e4a2d48e83c7e7a2bdb31545d3a9ae2ac512a0a8608b22017bb10b75ae68c565010d2d8d44861a894e4da3682ab66513282b27bf90a1a96b036e4d4295c0d04058129a66a0e96e244566727a9ec71faa61706481e4684f2f5843f23509bc74cff0c5d1f8215577d1da528b2d6414554792356ebb6307bb6ed9c896ae165c2ab815706b8bae82472d8e3d57b85b8512176ce86c4792351c474637dc34aea9e7869bb65051e6c590415826a9780a8f21613b32020d49d2a8a92aa77d5d25070e0ec2dcb17780b90feccaec9cf5d4e1b3337beeb9a58d8b23716c07d6afafa373531db90228a208ca12e038971570161510707943241577158a043535a554d7d7e05836ad1bd7d0ded180244012e076c1e874826422454b4309db363771be6f8a9189380f7c781df91c1cd97f2846e1c23ec0fee0b652555e78f5c8d8c09e0fddd4d2d956cf99de6976ed5c87470361832a15c1db4be09d1504b84c62113f48c52da0dba3b1e7a3bb509562d329ec62e3a9ca60c830311e65dbe63a34e0e17bdab8657b13672e4cf2d05d6bf9e12f4648bff7e26b609e866bbc5e5fb6bea72cb3feb1b4234b0f3efae1751cee89d0541ba4b1c6877040968b33aa2c1e55f90a57405be1ba7c796c68c5dfaa04ba527443014d8670d0454db90f5d2ee64dd8afb1b323cce8258b6f7ee3d98439f4fdaf82751a16f7c41f68baf293bd6f8f1e9a4b16787ccf46de3a3a463663e1358ae1b3ecda8aa3b63a27569d5ffced5228e68f0a2ead385ef235353e3c5a712fe35abcb660c2f79f3a43e6dc0f9f86eca12578bffd355bdf5342b47cfad8d991d467fef481f57a366b93c95ab4d47b61850a2b675e5b9afd952ac857a871a5ab4505f4c56b97cebb55f079e1e917a7f9d5f7bff32ed1e79e04965ffafe760200177f3a93766d9f189c773ffc978faca3a9da0342425e0a9fc55058153a8b477505e025124ba1f43e12ca6512faa2427e1fbc7e34c9b7befed36967e09b7f0fe6dbc0f22bc6eb230030fed2e9a9394d9e90d6df765b5718efe2bab69403578bff25224bae5f9107575341578ba1b334f36f9d48f3d5af3d379febf9ca577062bf02322b615d3f0180b9eefda363194f7f61c3cddbdac254f88b5bb2950a185a11ec5258ad0c9be5305aa180b612fce2d8a381e682e70f2478f2c967e39977fff16b58977e06c4ae84f4bb1100889f7ce3d2e068e6e8cc9add0df515724b8d8abe08d8e7826cce419521e09170eb45604b2babd75824a95e2661ac2062a8e076432207fffaf331befbcf3f1e36cf7cedcb5893cf00b35783f3bb130048f51f9e1fe83eb1afdfbb332eaac26b6b7d94b825fac62c9e3990229d71c89b8291298b822928f32be4f30e839326652532a625087a243cfa65a55c0698c081530b3cf92fddecfbf1b75e63f83b5f4624f702f16b41b9be2ff5d7fcb7ab92ba87bf547ee3a73eb7e7eeedbe8dcd211229189ab2b8346791ca382832d484153279413465535fa6b29017b4d6e9d496a96c6951f17ba0fb429ae75f19e0e06b7bfb1878fa6972179e052e52e4756d08ff23024ba686b75075cf5f043a3ef2e0f61bbaaa3bda6a290d784052c99912d93c588b754320d014701c8b7c2ecf4c2446cfa97e73f0e4dbe7197b792f9993bf01ce03d7f585ff0f4360d9b426bcadbb29ddb25bafddd4515ed35453565eeef7f93cba6168d896432693b793f1786e6e7a321ebdd43fc2f4e9b324cf1dc58e9c044681dff333eb1fde2ac0a84709d422bbca4032001056163b1d43242320a629569605c0f97d1ef2df5c025013d9e7bdc30000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>PushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>AboutDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">kseparator.h</include>
+</includes>
+<slots>
+ <slot>PushButton2_clicked()</slot>
+ <slot>accept()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kworldwatch/applet.cpp b/kworldwatch/applet.cpp
new file mode 100644
index 0000000..a12a987
--- /dev/null
+++ b/kworldwatch/applet.cpp
@@ -0,0 +1,122 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <qlayout.h>
+
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <krun.h>
+#include <kglobalsettings.h>
+
+
+#include "mapwidget.h"
+#include "applet.moc"
+
+
+extern "C"
+{
+ KDE_EXPORT KPanelApplet *init(QWidget *parent, const QString& configFile)
+ {
+ KGlobal::locale()->insertCatalogue("kworldclock");
+ KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation
+ return new KWWApplet(configFile, KPanelApplet::Normal,
+ 0,
+ parent, "kwwapplet");
+ }
+}
+
+
+KWWApplet::KWWApplet(const QString& configFile, Type type, int actions,
+ QWidget *parent, const char *name)
+ : KPanelApplet(configFile, type, actions, parent, name)
+{
+ // make use of the icons installed for ksaferppp
+ KGlobal::iconLoader()->addAppDir("kworldwatch");
+
+ QVBoxLayout *vbox = new QVBoxLayout(this, 0,0);
+
+ map = new MapWidget(true, true, this);
+ map->load(config());
+ vbox->addWidget(map);
+ setCustomMenu(map->contextMenu());
+
+ map->installEventFilter(this);
+}
+
+
+KWWApplet::~KWWApplet()
+{
+ map->save(config());
+}
+
+
+int KWWApplet::widthForHeight(int height) const
+{
+ return height*2;
+}
+
+
+int KWWApplet::heightForWidth(int width) const
+{
+ return width/2;
+}
+
+
+// catch the mouse clicks of our child widgets
+bool KWWApplet::eventFilter( QObject *o, QEvent *e )
+{
+ if ((e->type() == QEvent::MouseButtonPress) || (e->type() == QEvent::MouseButtonDblClick))
+ {
+ mousePressEvent(static_cast<QMouseEvent*>(e));
+ return true;
+ }
+
+ return KPanelApplet::eventFilter(o, e);
+}
+
+
+void KWWApplet::mousePressEvent(QMouseEvent *e)
+{
+ bool clicked = false;
+
+ if (KGlobalSettings::singleClick())
+ {
+ clicked = e->type() == QMouseEvent::MouseButtonPress;
+ }
+ else
+ {
+ clicked = e->type() == QMouseEvent::MouseButtonDblClick;
+ }
+
+ if (clicked && e->button() == QMouseEvent::LeftButton)
+ {
+ KRun::run("kworldclock", KURL::List());
+ }
+}
diff --git a/kworldwatch/applet.h b/kworldwatch/applet.h
new file mode 100644
index 0000000..7965b8f
--- /dev/null
+++ b/kworldwatch/applet.h
@@ -0,0 +1,70 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef KWW_applet_h
+#define KWW_applet_h
+
+
+#include <qstring.h>
+#include <qpixmap.h>
+
+
+#include <kpanelapplet.h>
+
+
+class MapWidget;
+
+
+class KWWApplet : public KPanelApplet
+{
+ Q_OBJECT
+
+public:
+
+ KWWApplet(const QString& configFile, Type t = Normal, int actions = 0,
+ QWidget *parent = 0, const char *name = 0);
+ ~KWWApplet();
+
+ int widthForHeight(int height) const;
+ int heightForWidth(int width) const;
+
+
+protected:
+
+ void mousePressEvent(QMouseEvent *ev);
+ bool eventFilter(QObject *, QEvent *);
+
+
+private:
+
+ MapWidget *map;
+
+
+};
+
+
+#endif
diff --git a/kworldwatch/astro.c b/kworldwatch/astro.c
new file mode 100644
index 0000000..3423119
--- /dev/null
+++ b/kworldwatch/astro.c
@@ -0,0 +1,166 @@
+/*
+ * Sun clock - astronomical routines.
+ */
+
+#include "sunclock.h"
+
+long jdate(struct tm *);
+double jtime(struct tm *);
+double kepler(double m, double ecc);
+void sunpos(double jd, int apparent, double *ra, double *dec, double *rv, double *slong);
+double gmst(double jd);
+
+/* JDATE -- Convert internal GMT date and time to Julian day
+ and fraction. */
+
+long
+jdate(t)
+struct tm *t;
+{
+ long c, m, y;
+
+ y = t->tm_year + 1900;
+ m = t->tm_mon + 1;
+ if (m > 2)
+ m = m - 3;
+ else {
+ m = m + 9;
+ y--;
+ }
+ c = y / 100L; /* Compute century */
+ y -= 100L * c;
+ return t->tm_mday + (c * 146097L) / 4 + (y * 1461L) / 4 +
+ (m * 153L + 2) / 5 + 1721119L;
+}
+
+/* JTIME -- Convert internal GMT date and time to astronomical
+ Julian time (i.e. Julian date plus day fraction,
+ expressed as a double). */
+
+double
+jtime(t)
+struct tm *t;
+{
+ return (jdate(t) - 0.5) +
+ (((long) t->tm_sec) +
+ 60L * (t->tm_min + 60L * t->tm_hour)) / 86400.0;
+}
+
+/* KEPLER -- Solve the equation of Kepler. */
+
+double
+kepler(m, ecc)
+double m, ecc;
+{
+ double e, delta;
+#define EPSILON 1E-6
+
+ e = m = dtr(m);
+ do {
+ delta = e - ecc * sin(e) - m;
+ e -= delta / (1 - ecc * cos(e));
+ } while (abs(delta) > EPSILON);
+ return e;
+}
+
+/* SUNPOS -- Calculate position of the Sun. JD is the Julian date
+ of the instant for which the position is desired and
+ APPARENT should be nonzero if the apparent position
+ (corrected for nutation and aberration) is desired.
+ The Sun's co-ordinates are returned in RA and DEC,
+ both specified in degrees (divide RA by 15 to obtain
+ hours). The radius vector to the Sun in astronomical
+ units is returned in RV and the Sun's longitude (true
+ or apparent, as desired) is returned as degrees in
+ SLONG. */
+
+void
+sunpos(jd, apparent, ra, dec, rv, slong)
+double jd;
+int apparent;
+double *ra, *dec, *rv, *slong;
+{
+ double t, t2, t3, l, m, e, ea, v, theta, omega,
+ eps;
+
+ /* Time, in Julian centuries of 36525 ephemeris days,
+ measured from the epoch 1900 January 0.5 ET. */
+
+ t = (jd - 2415020.0) / 36525.0;
+ t2 = t * t;
+ t3 = t2 * t;
+
+ /* Geometric mean longitude of the Sun, referred to the
+ mean equinox of the date. */
+
+ l = fixangle(279.69668 + 36000.76892 * t + 0.0003025 * t2);
+
+ /* Sun's mean anomaly. */
+
+ m = fixangle(358.47583 + 35999.04975*t - 0.000150*t2 - 0.0000033*t3);
+
+ /* Eccentricity of the Earth's orbit. */
+
+ e = 0.01675104 - 0.0000418 * t - 0.000000126 * t2;
+
+ /* Eccentric anomaly. */
+
+ ea = kepler(m, e);
+
+ /* True anomaly */
+
+ v = fixangle(2 * rtd(atan(sqrt((1 + e) / (1 - e)) * tan(ea / 2))));
+
+ /* Sun's true longitude. */
+
+ theta = l + v - m;
+
+ /* Obliquity of the ecliptic. */
+
+ eps = 23.452294 - 0.0130125 * t - 0.00000164 * t2 + 0.000000503 * t3;
+
+ /* Corrections for Sun's apparent longitude, if desired. */
+
+ if (apparent) {
+ omega = fixangle(259.18 - 1934.142 * t);
+ theta = theta - 0.00569 - 0.00479 * sin(dtr(omega));
+ eps += 0.00256 * cos(dtr(omega));
+ }
+
+ /* Return Sun's longitude and radius vector */
+
+ *slong = theta;
+ *rv = (1.0000002 * (1 - e * e)) / (1 + e * cos(dtr(v)));
+
+ /* Determine solar co-ordinates. */
+
+ *ra =
+ fixangle(rtd(atan2(cos(dtr(eps)) * sin(dtr(theta)), cos(dtr(theta)))));
+ *dec = rtd(asin(sin(dtr(eps)) * sin(dtr(theta))));
+}
+
+/* GMST -- Calculate Greenwich Mean Siderial Time for a given
+ instant expressed as a Julian date and fraction. */
+
+double
+gmst(jd)
+double jd;
+{
+ double t, theta0;
+
+
+ /* Time, in Julian centuries of 36525 ephemeris days,
+ measured from the epoch 1900 January 0.5 ET. */
+
+ t = ((floor(jd + 0.5) - 0.5) - 2415020.0) / 36525.0;
+
+ theta0 = 6.6460656 + 2400.051262 * t + 0.00002581 * t * t;
+
+ t = (jd + 0.5) - (floor(jd + 0.5));
+
+ theta0 += (t * 24.0) * 1.002737908;
+
+ theta0 = (theta0 - 24.0 * (floor(theta0 / 24.0)));
+
+ return theta0;
+}
diff --git a/kworldwatch/astro.h b/kworldwatch/astro.h
new file mode 100644
index 0000000..2c6a561
--- /dev/null
+++ b/kworldwatch/astro.h
@@ -0,0 +1,42 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+
+#ifndef ASTRO_H
+#define ASTRO_H
+
+#include <time.h>
+
+extern "C" {
+double jtime(struct tm *t);
+double kepler(double m, double ecc);
+void sunpos(double jd, int apparent, double *ra, double *dec, double *rv, double *slong);
+void projillum(short *wtab, int xdots, int ydots, double dec);
+}
+
+#endif // ASTRO_H
+
diff --git a/kworldwatch/cities.cpp b/kworldwatch/cities.cpp
new file mode 100644
index 0000000..624c814
--- /dev/null
+++ b/kworldwatch/cities.cpp
@@ -0,0 +1,208 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qregexp.h>
+#include <qpainter.h>
+
+
+#include <kglobal.h>
+#include <kstandarddirs.h>
+
+
+#include "cities.h"
+
+
+CityList::CityList()
+{
+ readCityLists();
+}
+
+CityList::~CityList()
+{
+ _cities.setAutoDelete(true);
+ _cities.clear();
+}
+
+void CityList::readCityLists()
+{
+ QStringList lists = KGlobal::dirs()->findAllResources("data", "kworldclock/*.tab");
+ for (QStringList::Iterator it = lists.begin(); it != lists.end(); ++it)
+ readCityList(*it);
+}
+
+
+double coordinate(QString c)
+{
+ int neg;
+ int d=0, m=0, s=0;
+
+ neg = c.left(1) == "-";
+ c.remove(0,1);
+
+ switch (c.length())
+ {
+ case 4:
+ d = c.left(2).toInt();
+ m = c.mid(2).toInt();
+ break;
+ case 5:
+ d = c.left(3).toInt();
+ m = c.mid(3).toInt();
+ break;
+ case 6:
+ d = c.left(2).toInt();
+ m = c.mid(2,2).toInt();
+ s = c.right(2).toInt();
+ break;
+ case 7:
+ d = c.left(3).toInt();
+ m = c.mid(3,2).toInt();
+ s = c.right(2).toInt();
+ break;
+ default:
+ break;
+ }
+
+ if (neg)
+ return - (d + m/60.0 + s/3600.0);
+ else
+ return d + m/60.0 + s/3600.0;
+}
+
+
+void CityList::readCityList(const QString &fname)
+{
+ QFile f(fname);
+
+ if (f.open(IO_ReadOnly))
+ {
+ QTextStream is(&f);
+
+ QString line;
+ QStringList tags;
+ QRegExp coord("[+-]\\d+[+-]\\d+");
+ QRegExp name("[^\\s]+/[^\\s]+");
+ int pos;
+ while (!is.eof())
+ {
+ line = is.readLine().stripWhiteSpace();
+ if (line.isEmpty() || line.left(1) == "#")
+ continue;
+
+ QString c, n;
+
+ pos = coord.search(line, 0);
+ if (pos >= 0)
+ c = line.mid(pos, coord.matchedLength());
+
+ pos = name.search(line, pos);
+ if (pos > 0)
+ n = line.mid(pos, name.matchedLength()).stripWhiteSpace();
+
+ if (!c.isEmpty() && !n.isEmpty())
+ {
+ double la, lo;
+ pos = c.find("+", 1);
+ if (pos < 0)
+ pos = c.find("-", 1);
+ if (pos > 0)
+ {
+ la = coordinate(c.left(pos));
+ lo = coordinate(c.mid(pos));
+ _cities.append(new City(n.latin1(), la, lo));
+ }
+ }
+ }
+
+ f.close();
+ }
+}
+
+
+QPoint CityList::getPosition(double la, double lo, int w, int h, int offset)
+{
+ int x = (int)((double)w * (180.0 + lo) / 360.0);
+ int y = (int)((double)h * (90.0 - la) / 180.0);
+ x = (x + offset + w/2) % w;
+
+ return QPoint(x,y);
+}
+
+
+void CityList::paint(QPainter *p, int width, int height, int offset)
+{
+ p->setPen(Qt::black);
+
+ QPtrListIterator<City> it(_cities);
+ for ( ; it.current(); ++it)
+ {
+ QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset);
+
+ if (width > 100)
+ p->drawEllipse(pos.x(), pos.y(), 3,3);
+ else
+ p->drawPoint(pos);
+ }
+}
+
+
+City *CityList::getNearestCity(int w, int h, int offset, int x, int y, QPoint &where)
+{
+ City *result = 0;
+ double dist = 1.0e10;
+
+ QPtrListIterator<City> it(_cities);
+ for ( ; it.current(); ++it)
+ {
+ QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset);
+
+ double d = (pos.x()-x)*(pos.x()-x) + (pos.y()-y)*(pos.y()-y);
+ if (d < dist)
+ {
+ dist = d;
+ where = pos;
+ result = it.current();
+ }
+ }
+
+ return result;
+}
+
+
+QStringList CityList::timezones()
+{
+ QStringList r;
+
+ QPtrListIterator<City> it(_cities);
+ for ( ; it.current(); ++it)
+ r << it.current()->name();
+ r.sort();
+
+ return r;
+}
diff --git a/kworldwatch/cities.h b/kworldwatch/cities.h
new file mode 100644
index 0000000..9c55c37
--- /dev/null
+++ b/kworldwatch/cities.h
@@ -0,0 +1,87 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef CITIES_H
+#define CITIES_H
+
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qptrlist.h>
+
+
+class QPainter;
+
+
+class City
+{
+public:
+
+ City(const QString &n, double la, double lo) : _name(n), _latitude(la), _longitude(lo) {};
+ QString name() { return _name; };
+
+ double latitude() { return _latitude; };
+ double longitude() { return _longitude; };
+
+
+private:
+
+ QString _name;
+ double _latitude, _longitude;
+
+};
+
+
+class CityList
+{
+public:
+
+ CityList();
+ ~CityList();
+ void paint(QPainter *p, int width, int height, int offset);
+
+ City *getNearestCity(int w, int h, int offset, int x, int y, QPoint &where);
+
+ QStringList timezones();
+
+
+private:
+
+ void readCityLists();
+ void readCityList(const QString &fname);
+
+ QPoint getPosition(double la, double lo, int w, int h, int offset);
+
+
+private:
+
+ QPtrList<City> _cities;
+
+};
+
+
+#endif
diff --git a/kworldwatch/clock.ui b/kworldwatch/clock.ui
new file mode 100644
index 0000000..faae5e7
--- /dev/null
+++ b/kworldwatch/clock.ui
@@ -0,0 +1,259 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>ClockDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ClockDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>173</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Edit Clock Settings</string>
+ </property>
+ <property name="icon">
+ <pixmap>clockimage0</pixmap>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>PixmapLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="pixmap">
+ <pixmap>clockimage1</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="1" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>ClockZone</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Please enter the settings for the clock.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Caption:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ClockCaption</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>ClockCaption</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Timezone:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ClockZone</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>PushButton2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="clockimage0">
+ <data format="XPM.GZ" length="620">789c65d0c14e84301006e03b4fd130376258711717637c048d4713e3613a6db7651748743d18e3bbcb7468ece21f0efdfe740a6553a997e747556d8a8f339e0329f2f8ae2af3390c5faf6f0fdf45d9dc2a7ef6aa29af8ab256a49ea6d1f21ae6355cc7300db3db264ec2ae11dac46ecb3c3071870dee982393da344bc2f64ed80be946e813a9651e99cea5592d446c913908d366141a8bc40c429e669e1265b34b742ede5d024beabf0e50d31c6320eb88ac739608f2598aa72fb3cb41790787184bde39bfee20f4903af92c7fd91de77077f259e7867fdd5c71e743efc7d5be10fa69759ee6ceacde6b439fee063ec66a9dfd03b8485dfedc17bfee6d99a3</data>
+ </image>
+ <image name="clockimage1">
+ <data format="XPM.GZ" length="8222">789ccd995b53e3481285dffb57109d6f1d1b39bedb8a8d7de08eb998fb75621eb224199b8b31c6806162fffb962a4f0ad3d8189ade88690d813f57294f669e524962fef83177b2b335f7e38f6f77431976e3b9b82383b91fc9fdf5f5d39f7ffde7ef6fdf2b8d39ff5fa9589c2b7dffd7b7efbbc3b978ae75d34b3360f24085f02f633acfb814796c642cf31957c498ae94cb0dcc7f54aec415097c9771b55489ab418c86cad502789071bd5c2fd6cb417f27b02b148a211e9f822baac7abc618df0537945daa5c8fea2ec45f0127ca1c65dc28db7c5e03c7887f668c7837ca45d4cb4bc6184fc0c8c7b5954d8fd68c1ba13eba556e149525e4d7c8f3e745658bc7057003fa3db0e5db34c6fcba7209f949c837aa583c5905dbfc05659bcfeb60eb77d118e3f360cbe7da18f1831f516cf1654fd9ce9735b0cdaf82ad9e2be5b2f57bcf18facf60eb770f8c7ce45e39aaea7a94fd8ca562f3a506b67e3f814dff52b962fa1b60ebc705d8f446ca5184eb61019c80ef95a5289530bf04ae82cb39c7810f02c765eb5f5dd9f271d760cbe7d818fde880adbf15b0d5373246fd9a4f5cb5eb19f1fdfa0ceb576e95a58a7a87c6885f3446fe8719bb4aaedf005b3d47caa6c75d30e2f33e18fd74b7c6c8b703467fdd9572ada87e73d87f5c62e3726c8cf35bca7ebeea3d804dbf0c8e10ef3c67ed0f2bd78bb5b0bfc98272de2fcd277125d4fb0cae29d372ce1a6f152cca12f6a7b86a7abc09463ddc56ae5bbd0739ebf81618ebdff573d6f11a18f549139cd4743fee294b8afd6a5ed9f2a307657fc156c3f93be01af8247062f93a56cef3bb07231f4760ebf74ace3a7f084e707f69e7ace315e506fa215a6f1297d04f675cd2f14b700dbc6d1c27215e58bf49d5e2cb96b2c5e73467cd5fc0d6df048c7a28cd59e73bb0d5d355b6fd809e95e314f95d2827c89fc3fd34491b567f5539b2fe0ec0b6ff9de6ace331d8fa7d94b3faabf9a722580f1d705a8ac2fc13e372318c2f29fbfcc2b8dc806b6031c6fc8671559f0f6cbe3fc2fc70ff4d6b969f8b73d6fc2ec1e89f7b61adcf290bfc72dd9cd5cf16d8fab30946bddc005b7da41ca7babea9af9ca4692dcc0ffb539ae6fb63012ce8af8053f0b2b2bf41abfea2725cc3f300c663c17ab8504e4a91eeafebc6ba5ee55139b5fe778d357fa19cc338d58db17f3d81cd9f3258743f7741bfedfb81f57baeecf3d77ef7c135d47703b6fab7c1a85f369413413f6370aaf5d093722ac8ff0e6c7e548c71ffec28b7512f158d11af609ca8debe711ad61b9d806bea27ed19b79535dfb63d0fcb3918f75fda02e37980d695edf9908e954b055ccfd7e08afa459be00678171c835bcaf6fc2c8972b50a6e836dff3e536e54b19ee29cf5797447392a46babe9ae048d71745e004fded29e7f7f70118eb838ec029b86aecf4fc54d9d5c00f60bb9e0e956dffa51258c0ba7eda89f9770016dd2fa8a6ec2f30dd3f58b96deb7d04ae814f8de1bf18c3ef45b060be03fb7f19ef0effbfc73f5b8369faf13b34422461c731279c729bcfb9c35dbee04bbee26beebdd6f9150d1fe186fb5ee396077cc743bee7077ef41a237ee2679ee7055ee4a51795cf6b04851b5ee6159ff52aaf7193d77de40dafd1e14ddee296575af4dfaf9aca2f696cfbdc77fcb1cabb3e5a93f77cd411effb6a0ef8d077efc877f1f82b1a4165874f7c474ef98c0b5cf41e6c70c977abecbb56e12ad7b8eeebfc42afa0d1f0ce46bce4cd251272fe108a29a19407d4f6b5f5bfa6b13ba473eaf85c77a91ba28f1f1774e9eb58a0ab97d9bfbc761bdca4eb370ad9d1f375f4beba768386f7836e266af4831fbf43c3fb3151213b323f7e8346e6c7348dcc8f5fd178bd17c18fe9757cc28f97c8746b4776b6fae1bf9d54057dc48f4991c78e4118cbae8f291ab3fd9812794c83eed48f90c5db2a68b61f1fd0801fd33466fb3151e39e1ea88f38037a343fc2ec913f9ee899e609dfccf6031af753ae30e74786e64798ed68d16b2cd1725645f866861f937dfc4963c5fcc0195ac76abeae67f8f1218d35f3233f23abc3e53cc38f571a4d5aa78d706cfe5c87f9f172ce0bcdf2634c43a36fe177eb4d1dbd691a1ff6633344def69f76c2a7dd77fc70b447fb2fbd7adf8fb12a0ee8908ec2a7e3a071f8ae1f2774fa513fde387e864e1dd2143f7046818ad6af597ebcd1d8c88fd2643f7046992a2f1aeffbf146a34ab57c6d4df0239f5fa7067d70bf9a7875446f34d65eef57c242fe9de743fbd58b82c492d086a4e1733b5390f3497e041e4947ba72219772059577fcf8f9da10ffdc213d7ceebda9a387bd6ae4ebe8ca8df469596e67dd3fc6ea188cb9fdfa0a1cf323ab213be4ceea90a1dcbf7f3f1f77634ce5581e5ef993fb1134b48e47ab4346f4eefdfc03fbe12b3fc6ea780a753ce7754cf1e3830a637ef8bbd6e8673f7c1d37d3fdf884c68acc677e082a411d2ef3c3777971ba1f9faa237b6e6fca5278a61eabc32b2c537bba1f9faa6325f34356654d9ab26eef06b2219bb2e5dfdebc1fd29af46ec024dbb233fb27d4b128bbb227fb7220877224c7dc9213ff7e93522aa772c6b75298f6fee1558a529232dd4bd1ffd8ef92b11f535e09ff7fa7267569f8b7c096448eb3e5ee9c8be9d2c717afd076c9a477352697d2dad8cf8afe76ed9fbfe7be3be74dd7e14789fc7be68a7f7fbee381eb4acb5df0811cf9f867d3de07df7baf7f752cfb68973e6ff1efb19bee8af7a5e2ae5dcfbf7dae73d3dd8c2b7ce56f009982ebfb2a5aee562a7c1c1416fc95b1e415befc3780d935bf9ef9cffe9bcc2734fefbef6fff031b478c7d</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>PushButton1</sender>
+ <signal>clicked()</signal>
+ <receiver>ClockDialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>PushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>ClockDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>ClockZone</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>ClockCaption</receiver>
+ <slot>setText(const QString&amp;)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">kseparator.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kworldwatch/flags.cpp b/kworldwatch/flags.cpp
new file mode 100644
index 0000000..dd60330
--- /dev/null
+++ b/kworldwatch/flags.cpp
@@ -0,0 +1,145 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <limits.h>
+
+
+#include <kstandarddirs.h>
+
+
+#include "flags.h"
+
+
+FlagList::FlagList()
+{
+ _flags.setAutoDelete(true);
+
+ _flagPixmap = QPixmap(locate("data", "kworldclock/pics/flag.png"));
+ _flagMask = QPixmap(locate("data", "kworldclock/pics/flag-mask.xpm"), 0, QPixmap::ThresholdDither);
+ _flagMask.setMask(_flagMask.createHeuristicMask());
+}
+
+
+void FlagList::addFlag(Flag *f)
+{
+ _flags.append(f);
+}
+
+
+QPoint FlagList::getPosition(double la, double lo, int w, int h, int offset)
+{
+ int x = (int)((double)w * (180.0 + lo) / 360.0);
+ int y = (int)((double)h * (90.0 - la) / 180.0);
+ x = (x + offset + w/2) % w;
+
+ return QPoint(x,y);
+}
+
+
+void FlagList::paint(QPainter *p, int width, int height, int offset)
+{
+ p->setPen(Qt::black);
+
+ QPtrListIterator<Flag> it(_flags);
+ for ( ; it.current(); ++it)
+ {
+ QPoint pos = getPosition(it.current()->latitude(), it.current()->longitude(), width, height, offset);
+
+ p->setPen(it.current()->color());
+ p->setBrush(it.current()->color());
+
+ if (width > 100)
+ {
+ pos -= QPoint(5,15);
+
+ p->drawPixmap(pos,_flagMask);
+ p->drawPixmap(pos,_flagPixmap);
+ }
+ else
+ p->drawEllipse(pos.x()-1, pos.y()-1, 3, 3);
+ }
+}
+
+
+void FlagList::removeNearestFlag(const QPoint &target, int w, int h, int offset)
+{
+ Flag *flag = 0;
+
+ QPoint diff;
+
+ int dist = INT_MAX;
+ QPtrListIterator<Flag> it(_flags);
+ for ( ; it.current(); ++it)
+ {
+ diff = getPosition(it.current()->latitude(), it.current()->longitude(), w, h, offset);
+ diff -= target;
+ if (diff.manhattanLength() < dist)
+ {
+ dist = diff.manhattanLength();
+ flag = it.current();
+ }
+ }
+
+ if (flag)
+ _flags.remove(flag);
+}
+
+void FlagList::removeAllFlags()
+{
+ _flags.clear();
+}
+
+void FlagList::save(KConfig *config)
+{
+ config->writeEntry("Flags", _flags.count());
+
+ QPtrListIterator<Flag> it(_flags);
+ int cnt=0;
+ for ( ; it.current(); ++it)
+ {
+ config->writeEntry(QString("Flag_%1_Color").arg(cnt), it.current()->color());
+ config->writeEntry(QString("Flag_%1_Latitude").arg(cnt), it.current()->latitude());
+ config->writeEntry(QString("Flag_%1_Longitude").arg(cnt), it.current()->longitude());
+ cnt++;
+ }
+}
+
+
+void FlagList::load(KConfig *config)
+{
+ _flags.clear();
+ int num = config->readNumEntry("Flags", 0);
+
+ for (int i=0; i<num; ++i)
+ {
+ addFlag(new Flag(config->readDoubleNumEntry(QString("Flag_%1_Longitude").arg(i)),
+ config->readDoubleNumEntry(QString("Flag_%1_Latitude").arg(i)),
+ config->readColorEntry(QString("Flag_%1_Color").arg(i))));
+ }
+}
+
+
diff --git a/kworldwatch/flags.h b/kworldwatch/flags.h
new file mode 100644
index 0000000..7a444db
--- /dev/null
+++ b/kworldwatch/flags.h
@@ -0,0 +1,100 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef FLAGS_H
+#define FLAGS_H
+
+
+#include <qstring.h>
+#include <qcolor.h>
+#include <qptrlist.h>
+#include <qpoint.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qbitmap.h>
+
+
+#include <kconfig.h>
+
+
+class Flag
+{
+public:
+
+ Flag(double lo, double la, const QColor &col)
+ : _lo(lo), _la(la), _col(col) {};
+
+ double longitude() const { return _lo; };
+ double latitude() const { return _la; };
+
+ QColor color() const { return _col; };
+
+ QString annotation() const { return _ann; };
+ void setAnnotation(const QString &ann) { _ann = ann; };
+
+
+private:
+
+ double _lo, _la;
+
+ QColor _col;
+
+ QString _ann;
+
+};
+
+
+class FlagList
+{
+public:
+
+ FlagList();
+
+ void paint(QPainter *p, int w, int h, int offset);
+
+ void addFlag(Flag *f);
+
+ void removeNearestFlag(const QPoint &target, int w, int h, int offset);
+ void removeAllFlags();
+
+ void save(KConfig *config);
+ void load(KConfig *config);
+
+
+private:
+
+ QPoint getPosition(double la, double lo, int w, int h, int offset);
+
+ QPtrList<Flag> _flags;
+
+ QPixmap _flagPixmap;
+ QBitmap _flagMask;
+
+};
+
+
+#endif
diff --git a/kworldwatch/flow.cpp b/kworldwatch/flow.cpp
new file mode 100644
index 0000000..ca06d16
--- /dev/null
+++ b/kworldwatch/flow.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+** $Id$
+**
+** Implementing your own layout: flow example
+**
+** Copyright (C) 1996 by Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include "flow.h"
+
+class SimpleFlowIterator :public QGLayoutIterator
+{
+public:
+ SimpleFlowIterator( QPtrList<QLayoutItem> *l ) :idx(0), list(l) {}
+ uint count() const;
+ QLayoutItem *current();
+ QLayoutItem *next();
+ QLayoutItem *takeCurrent();
+
+private:
+ int idx;
+ QPtrList<QLayoutItem> *list;
+
+};
+
+uint SimpleFlowIterator::count() const
+{
+ return list->count();
+}
+
+QLayoutItem *SimpleFlowIterator::current()
+{
+ return idx < int(count()) ? list->at(idx) : 0;
+}
+
+QLayoutItem *SimpleFlowIterator::next()
+{
+ idx++; return current();
+}
+
+QLayoutItem *SimpleFlowIterator::takeCurrent()
+{
+ return idx < int(count()) ? list->take( idx ) : 0;
+}
+
+SimpleFlow::~SimpleFlow()
+{
+ deleteAllItems();
+}
+
+
+int SimpleFlow::heightForWidth( int w ) const
+{
+ if ( cached_width != w ) {
+ //Not all C++ compilers support "mutable" yet:
+ SimpleFlow * mthis = (SimpleFlow*)this;
+ int h = mthis->doLayout( QRect(0,0,w,0), TRUE );
+ mthis->cached_hfw = h;
+ mthis->cached_width = w;
+ return h;
+ }
+ return cached_hfw;
+}
+
+void SimpleFlow::addItem( QLayoutItem *item)
+{
+ list.append( item );
+}
+
+bool SimpleFlow::hasHeightForWidth() const
+{
+ return TRUE;
+}
+
+QSize SimpleFlow::sizeHint() const
+{
+ return minimumSize();
+}
+
+QSizePolicy::ExpandData SimpleFlow::expanding() const
+{
+ return QSizePolicy::NoDirection;
+}
+
+QLayoutIterator SimpleFlow::iterator()
+{
+ return QLayoutIterator( new SimpleFlowIterator( &list ) );
+}
+
+void SimpleFlow::setGeometry( const QRect &r )
+{
+ QLayout::setGeometry( r );
+ doLayout( r );
+}
+
+int SimpleFlow::doLayout( const QRect &r, bool testonly )
+{
+ int x = r.x();
+ int y = r.y();
+ int h = 0; //height of this line so far.
+ QPtrListIterator<QLayoutItem> it(list);
+ QLayoutItem *o;
+ while ( (o=it.current()) != 0 ) {
+ ++it;
+ int nextX = x + o->sizeHint().width() + spacing();
+ if ( nextX - spacing() > r.right() && h > 0 ) {
+ x = r.x();
+ y = y + h + spacing();
+ nextX = x + o->sizeHint().width() + spacing();
+ h = 0;
+ }
+ if ( !testonly )
+ o->setGeometry( QRect( QPoint( x, y ), o->sizeHint() ) );
+ x = nextX;
+ h = QMAX( h, o->sizeHint().height() );
+ }
+ return y + h - r.y();
+}
+
+QSize SimpleFlow::minimumSize() const
+{
+ QSize s(0,0);
+ QPtrListIterator<QLayoutItem> it(list);
+ QLayoutItem *o;
+ while ( (o=it.current()) != 0 ) {
+ ++it;
+ s = s.expandedTo( o->minimumSize() );
+ }
+ return s;
+}
+
diff --git a/kworldwatch/flow.h b/kworldwatch/flow.h
new file mode 100644
index 0000000..950c7e5
--- /dev/null
+++ b/kworldwatch/flow.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of simple flow layout for custom layout example
+**
+** Created : 979899
+**
+** Copyright (C) 1997 by Trolltech AS. All rights reserved.
+**
+** This file is part of an example program for Qt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#ifndef FLOW_H
+#define FLOW_H
+
+#include <qlayout.h>
+#include <qptrlist.h>
+
+class SimpleFlow : public QLayout
+{
+public:
+ SimpleFlow( QWidget *parent, int border=0, int space=-1,
+ const char *name=0 )
+ : QLayout( parent, border, space, name ),
+ cached_width(0), cached_hfw(0) {}
+ SimpleFlow( QLayout* parent, int space=-1, const char *name=0 )
+ : QLayout( parent, space, name ),
+ cached_width(0), cached_hfw(0) {}
+ SimpleFlow( int space=-1, const char *name=0 )
+ : QLayout( space, name ),
+ cached_width(0), cached_hfw(0) {}
+
+ ~SimpleFlow();
+
+ void addItem( QLayoutItem *item);
+ bool hasHeightForWidth() const;
+ int heightForWidth( int ) const;
+ QSize sizeHint() const;
+ QSize minimumSize() const;
+ QLayoutIterator iterator();
+ QSizePolicy::ExpandData expanding() const;
+
+protected:
+ void setGeometry( const QRect& );
+
+private:
+ int doLayout( const QRect&, bool testonly = FALSE );
+ QPtrList<QLayoutItem> list;
+ int cached_width;
+ int cached_hfw;
+};
+
+#endif
diff --git a/kworldwatch/hi16-app-kworldclock.png b/kworldwatch/hi16-app-kworldclock.png
new file mode 100644
index 0000000..4b86bb5
--- /dev/null
+++ b/kworldwatch/hi16-app-kworldclock.png
Binary files differ
diff --git a/kworldwatch/hi22-app-kworldclock.png b/kworldwatch/hi22-app-kworldclock.png
new file mode 100644
index 0000000..9b377f1
--- /dev/null
+++ b/kworldwatch/hi22-app-kworldclock.png
Binary files differ
diff --git a/kworldwatch/hi32-app-kworldclock.png b/kworldwatch/hi32-app-kworldclock.png
new file mode 100644
index 0000000..96ebfc3
--- /dev/null
+++ b/kworldwatch/hi32-app-kworldclock.png
Binary files differ
diff --git a/kworldwatch/hi48-app-kworldclock.png b/kworldwatch/hi48-app-kworldclock.png
new file mode 100644
index 0000000..76ee01d
--- /dev/null
+++ b/kworldwatch/hi48-app-kworldclock.png
Binary files differ
diff --git a/kworldwatch/kdeworld.desktop b/kworldwatch/kdeworld.desktop
new file mode 100644
index 0000000..b13cea1
--- /dev/null
+++ b/kworldwatch/kdeworld.desktop
@@ -0,0 +1,69 @@
+[KDE Desktop Program]
+Comment=KDE WorldClock by Matthias Hoelzer-Kluepfel
+Comment[af]=Kde Wêreld horlosie deur Matthias Hoelzer-kluepfel
+Comment[ar]=ساعة عالمية Ù„KDE من ماتياس هولتسر-كلوبÙÙ„
+Comment[az]=Matthias Hoelzer-Kluepfel'den KDE Dünya Saatı
+Comment[be]=СуÑветны гадзіннік KDE (аўтар Matthias Hoelzer-Kluepfel)
+Comment[bg]=ЧаÑовник, който показва чаÑа в различни точки на Ñвета
+Comment[bn]=কে.ডি.ই. বিশà§à¦¬à¦˜à§œà¦¿, তৈরি করেছেন মà§à¦¯à¦¾à¦¥à¦¿à§Ÿà¦¾à¦¸ হোলজার-কà§à¦²à§à¦ªà¦«à§‡à¦²
+Comment[br]=Eurier bedel KDE gant Matthias Hoelzer-Kluepfel
+Comment[ca]=Rellotge mundial KDE per Matthias Hoelzer-Kluepfel
+Comment[cs]=KDE WorldClock od Matthiase Hoelzer-Kluepfela
+Comment[cy]=Cloc y Byd KDE gan Matthias Hoelzer-Kluepfel
+Comment[da]=KDE Verdensur af Matthias Hoelzer-Kluepfel
+Comment[de]=KDE-Weltzeituhr
+Comment[el]=Παγκόσμιο Ïολόι του KDE από τον Matthias Hoelzer-Kluepfel
+Comment[eo]=KDE-mondhorloÄo
+Comment[es]=El reloj mundial de KDE por Matthias Hoelzer-Kluepfel
+Comment[et]=KDE maailma kell - Matthias Hoelzer-Kluepfel
+Comment[eu]=KDE WorldWatch Matthias Hoelzer-Kluepfelek egina
+Comment[fa]=ساعت جهانی KDE توسط ماتیوز هولزر-کلوپÙÙ„
+Comment[fi]=Maailmankello, tehnyt Matthias Hoelzer-Kluepfel
+Comment[fr]=L'horloge planétaire de KDE par Matthias Hoelzer-Kluepfel
+Comment[ga]=KDE WorldClock le Matthias Hoelzer-Kluepfel
+Comment[gl]=Reloxo Mundial de KDE por Matthias Hoelzer-Kluepfel
+Comment[he]=השעון העולמי של KDE מ×ת מתי×ס הולצר-קליפפל
+Comment[hi]=केडीई विशà¥à¤µ घड़ी- मैथियास होलà¥à¤œà¤¼à¤°-कà¥à¤²à¥‚पफेल दà¥à¤µà¤¾à¤°à¤¾
+Comment[hr]=KDE svjetski sat, autor Matthias Hoelzer-Kluepfel
+Comment[hu]=KDE világóra (készítette: Matthias Hoelzer-Kluepfel)
+Comment[is]=Heimsklukka KDE, eftir Matthias Hoelzer-Kluepfel
+Comment[it]=Orologio mondiale di KDE scritto da Matthias Hoelzer-Kluepfel
+Comment[km]=នាឡិកា​ពិភពលោក KDE ដោយ Matthias Hoelzer-Kluepfel
+Comment[ko]=Matthias Hoelzer-Kluepfelì´ ë§Œë“  KDE 세계 시계
+Comment[lt]=Matthias Hoelzer-Kluepfelio darytas KDE Pasaulio Laikrodis
+Comment[lv]=KDE pasaules pulkstens no Matthias Hoelzer-Kluepfel
+Comment[mk]=СветÑки чаÑовник во KDE од Matthias Hoelzer-Kluepfel
+Comment[ms]=Jam Dunia KDE oleh Matthias Hoelzer-Kluepfel
+Comment[mt]=KDE WorldClock ta' Matthias Hoelzer-Kluepfel
+Comment[nb]=KDE Verdensur av Matthias Hoelzer-Kluepfel
+Comment[nds]=KDE-Weltklock vun Matthias Hoelzer-Kluepfel
+Comment[ne]=माथà¥à¤¯à¤¿à¤¸ होइलà¥à¤œà¤° कà¥à¤²à¥‚पà¥à¤«à¥‡à¤²à¤¦à¥à¤µà¤¾à¤°à¤¾ केडीई विशà¥à¤µà¤µà¥à¤¯à¤¾à¤ªà¥€ घडी
+Comment[nl]=KDE WorldClock door Matthias Hoelzer-Kluepfel
+Comment[nn]=Verdsur for KDE av Matthias Hoelzer-Kluepfel
+Comment[pl]=Czas uniwersalny w KDE autorstwa Matthiasa Hoelzera-Kluepfela
+Comment[pt]=Relógio Global do KDE de Matthias Hoelzer-Kluepfel
+Comment[pt_BR]=Relógio Mundial KDE criado por Matthias Hoelzer-Kluepfel
+Comment[ro]=Ceas mondial KDE de Matthias Hoelzer-Kluepfel
+Comment[ru]=Ð’Ñемирные чаÑÑ‹ KDE от Matthias Hoelzer-Kluepfel
+Comment[sk]=KDE svetové hodiny od Matthiasa Hoelzer-Kluepfela
+Comment[sl]=KDE WorldClock avtorja Matthiasa Hoelzer-Kluepfela
+Comment[sr]=KDE WorldClock од МатијаÑа Хелцера-Клипфела (Matthias Hölzer-Klüpfel)
+Comment[sr@Latn]=KDE WorldClock od Matijasa Helcera-Klipfela (Matthias Hölzer-Klüpfel)
+Comment[sv]=KDE:s världsklocka av Matthias Hoelzer-Kluepfel
+Comment[ta]= KDE உலக கடிகாரம௠by Matthias Hoelzer-Kluepfel
+Comment[tg]=KDE Соати Ҷаҳон аз ÐœÐ°Ñ‚Ñ‚Ð¸Ð°Ñ Ð¥Ð¾Ð»Ð·ÐµÑ€-Клупфел
+Comment[th]=นาฬิà¸à¸²à¸—ั่วโลà¸à¸‚อง KDE โดย Matthias Hoelzer-Kluepfel
+Comment[tr]=Matthias Hoelzer-Kluepfel'den KDE Dünya Saati
+Comment[uk]=Ð’ÑеÑвітній годинник KDE від Matthias Hoelzer-Kluepfel
+Comment[uz]=Matias Hoʻlser-Klyupfel (Matthias Hoelzer-Kluepfel) yaratgan KDE dunyo soati
+Comment[uz@cyrillic]=ÐœÐ°Ñ‚Ð¸Ð°Ñ Ò²ÑžÐ»Ñ†ÐµÑ€-Клюпфел (Matthias Hoelzer-Kluepfel) Ñратган KDE дунё Ñоати
+Comment[ven]=Tshifhinga tsha lifhasi nga Matthias Hoelzer-Kluepfel
+Comment[wa]=Ôrlodje daegnrece po KDE, sicrît pa Matthias Hoelzer-Kluepfel
+Comment[xh]=Ukhangelo lwehlabathi lwe KDE ngu Matthias Hoelzer-Kluepfel
+Comment[zh_CN]=KDE 世界时钟(作者:Matthias Hoelzer-Kluepfel)
+Comment[zh_TW]=KDE 世界表 (Matthias Hoelzer-Kluepfel)
+Comment[zu]=Iwashi Lomhlaba lwe KDE ngu Matthias Hoelzer-Kluepfel
+Executable=kworldclock
+Command=kworldclock --dump --size %xx%y -o %f
+PreviewCommand=kworldclock --dump --size %xx%y -o %f
+Refresh=10
diff --git a/kworldwatch/kworldclock.desktop b/kworldwatch/kworldclock.desktop
new file mode 100644
index 0000000..156d62e
--- /dev/null
+++ b/kworldwatch/kworldclock.desktop
@@ -0,0 +1,80 @@
+[Desktop Entry]
+Name=KWorldClock
+Name[bn]=কে-ওয়ারà§à¦²à§à¦¡-কà§à¦²à¦•
+Name[de]=Weltzeituhr
+Name[el]=Παγκόσμιο Ïολόι
+Name[fi]=Maailmankello
+Name[fr]=Horloge planétaire
+Name[he]=שעון עולמי
+Name[hr]=KSvjetski sat
+Name[mk]=КСветÑкиЧаÑовник
+Name[nb]=Verdensklokke
+Name[ne]=केडीई विशà¥à¤µà¤µà¥à¤¯à¤¾à¤ªà¥€ घडी
+Name[pa]=ਕੇ-ਸੰਸਾਰ ਘੜੀ
+Name[pl]=Zegar światowy
+Name[sk]=Svetové hodiny
+Name[sl]=Svetovna ura
+Name[sv]=Världsklocka
+Name[ta]=கே உலக கடிகாரமà¯
+Name[tg]=Соати Ҷаҳонӣ
+Name[tr]=KDünyaSaati
+Name[wa]=Ôrlodje daegnrece
+GenericName=World Clock
+GenericName[be]=СуÑветны гадзіннік
+GenericName[bg]=Световен чаÑовник
+GenericName[bn]=বিশà§à¦¬ ঘড়ি
+GenericName[br]=Eurier bedel
+GenericName[ca]=Rellotge mundial
+GenericName[cs]=Světové hodiny
+GenericName[cy]=Cloc Byd
+GenericName[da]=Verdensur
+GenericName[de]=Weltzeituhr
+GenericName[el]=Παγκόσμιο Ïολόι
+GenericName[eo]=MondhorloÄo
+GenericName[es]=Reloj mundial
+GenericName[et]=Maailma kell
+GenericName[fa]=ساعت جهانی
+GenericName[fi]=Maailmankello
+GenericName[fr]=Horloge planétaire
+GenericName[gl]=Relóxio Global
+GenericName[he]=שעון עולמי
+GenericName[hr]=Svjetski sat
+GenericName[hu]=Világóra
+GenericName[is]=Heimsklukka
+GenericName[it]=Orologio mondiale
+GenericName[ja]=世界時計
+GenericName[km]=នាឡិកា​ពិភពលោក
+GenericName[ko]=세계 시계
+GenericName[lv]=Pasaules pulkstenis
+GenericName[mk]=СветÑки чаÑовник
+GenericName[mt]=Arloġġ Dinji
+GenericName[nb]=Verdensklokke
+GenericName[nds]=Weltklock
+GenericName[ne]=विशà¥à¤µà¤µà¥à¤¯à¤¾à¤ªà¥€ घडी
+GenericName[nl]=Wereldklok
+GenericName[nn]=Verdsur
+GenericName[pa]=ਸੰਸਾਰ ਘੜੀ
+GenericName[pl]=Zegar światowy
+GenericName[pt]=Relógio Global
+GenericName[pt_BR]=Relógio Mundial
+GenericName[ro]=Ceas mondial
+GenericName[ru]=Ð’Ñемирные чаÑÑ‹
+GenericName[sk]=Svetové hodiny
+GenericName[sl]=Svetovna ura
+GenericName[sr]=СветÑки чаÑовник
+GenericName[sr@Latn]=Svetski Äasovnik
+GenericName[sv]=Världsklocka
+GenericName[ta]=உலக கடிகாரமà¯
+GenericName[tg]=Соати Ҷаҳонӣ
+GenericName[tr]=Dünya Saati
+GenericName[uk]=Ð’ÑеÑвітній годинник
+GenericName[wa]=Ôrlodje daegnrece
+GenericName[zh_CN]=世界时钟
+GenericName[zh_TW]=世界時é˜
+DocPath=kworldclock/index.html
+Exec=kworldclock
+Icon=kworldclock
+Type=Application
+X-KDE-StartupNotify=true
+X-DCOP-ServiceType=Unique
+Categories=Qt;KDE;Utility;Amusement;
diff --git a/kworldwatch/kwwapplet.desktop b/kworldwatch/kwwapplet.desktop
new file mode 100644
index 0000000..54669f8
--- /dev/null
+++ b/kworldwatch/kwwapplet.desktop
@@ -0,0 +1,107 @@
+[Desktop Entry]
+Type=Plugin
+Icon=kworldclock
+Name=World Wide Watch
+Name[af]=Wêreld Wye Waarneem
+Name[az]=Dünya Saatı
+Name[be]=СуÑветны гадзіннік
+Name[bg]=Световен чаÑовник
+Name[bn]=বিশà§à¦¬à¦¬à§à¦¯à¦¾à¦ªà§€ নজর
+Name[br]=Eurier bedel
+Name[ca]=Rellotge de tot el món mundial
+Name[cs]=Světové hodiny
+Name[cy]=Oriawr Fyd-Eang
+Name[da]=Verdensur
+Name[de]=Weltzeituhr
+Name[el]=Παγκόσμιος χάÏτης
+Name[eo]=MondhorloÄo
+Name[es]=Reloj mundial
+Name[et]=Maailma kell
+Name[eu]=Mundu Osoko Ikuspena
+Name[fa]=ساعت گستردۀ جهانی
+Name[fi]=Maailmankello
+Name[fr]=Applet horloge planétaire
+Name[gl]=Relóxio Mundial
+Name[he]=צג עולמי
+Name[hi]=वरà¥à¤²à¥à¤¡ वाइड वाच
+Name[hr]=Sat Å¡irom svijeta
+Name[hu]=Világóra
+Name[is]=Heimsklukka
+Name[it]=Orologio globale
+Name[ja]=世界時計
+Name[km]=នាឡិកា​ពិភពលោក
+Name[ko]=세계 시간 보기
+Name[lt]=Pasaulio vaizdas
+Name[nb]=Verdensur
+Name[nds]=Weltkieker
+Name[ne]=विशà¥à¤µà¤µà¥à¤¯à¤¾à¤ªà¥€ घडी
+Name[pl]=Czas uniwersalny
+Name[pt]=Relógio Global
+Name[pt_BR]=Relógio Mundial
+Name[ro]=Hartă mondială
+Name[ru]=Ð’Ñемирные чаÑÑ‹
+Name[sl]=Svetovna ura
+Name[sv]=Världsklocka
+Name[ta]= உலகளாவிய கடிகாரமà¯
+Name[tg]=Соати Ҷаҳони Кушод
+Name[th]=ดูเวลาทั่วโลà¸
+Name[tr]=Dünya Saati
+Name[uk]=Тенета чаÑових поÑÑів Ñвіту
+Name[ven]=U sedza lifhasi lothe
+Name[wa]=Eure eyet loumaedje sol Daegne
+Name[xh]=Ukhangelo ngokubanzi kwehlabathi
+Name[zh_CN]=世界时钟
+Name[zh_TW]=世界表
+Name[zu]=UKubheka Okubanzi Komhlaba Wonke
+Comment=Displays time and sunshine on a world map
+Comment[ar]=يعرض الوقت و وقت شروق الشمس على خريطة عالمية
+Comment[be]=Паказвае Ñ‡Ð°Ñ Ñ– Ñонечны Ñвет на карце Ñвету
+Comment[bg]=Показване на чаÑа и времето от денонощието на Ñветовната карта
+Comment[bn]=বিশà§à¦¬ মানচিতà§à¦° বà§à¦¯à¦¬à¦¹à¦¾à¦° করে সময় ও সূরà§à¦¯à¦¾à¦²à§‹à¦• দেখায়
+Comment[ca]=Mostra l'hora i la llum del sol a un mapa del món
+Comment[cs]=Zobrazuje Äas a sluneÄní svit na svÄ›tové mapÄ›
+Comment[cy]=Dangos amser ac heulwen ar fap y byd
+Comment[da]=Viser tid og solskin på et verdenskort
+Comment[de]=Zeigt die Zeit- und Sonnenzonen auf einer Weltkarte
+Comment[el]=Εμφανίζει την ÏŽÏα και την ηλιοφάνεια σε ένα παγκόσμιο χάÏτη
+Comment[eo]=Montru tempon kaj sunleviÄon sur monda mapo
+Comment[es]=Muestra la hora y la luz diurna en un mapamundi
+Comment[et]=Kellaaeg ja päikesetõus maailma kaardil
+Comment[eu]=Bistaratu ordua eta eguzki izpiak munduko mapan
+Comment[fa]=زمان Ùˆ طلوع Ø¢Ùتاب را در نگاشت جهانی نمایش می‌دهد
+Comment[fi]=Näyttää ajan ja auringonvalon maailmankartalla
+Comment[fr]=Affiche l'avancement de la journée sur un planisphère
+Comment[ga]=Taispeáin an t-am agus suíomh na gréine ar léarscáil an domhain
+Comment[gl]=Mostra a hora e a luz solar nun mapa-mundi
+Comment[he]=מציג ×ת הזמן והזריחה במפת העול×
+Comment[hr]=Prikazuje vrijeme i sunce na karti svijeta
+Comment[hu]=Megmutatja a világtérképen az időzónákat és a nappal-éjszaka állapotokat
+Comment[is]=Sýnir tíma og sólskin á heimskorti
+Comment[it]=Mostra l'ora e la luce solare in una mappa del mondo
+Comment[ja]=世界地図ã§æ™‚刻ã¨æ—¥ç…§ã‚’表示
+Comment[km]=បង្ហាញ​ពáŸáž›ážœáŸáž›áž¶ និង​ពន្លឺ​ព្រះ​អាទិážáŸ’យ​លើ​ផែនទី​ពិភពលោក
+Comment[ko]=시간과 í•´ ìƒíƒœë¥¼ 세계 지ë„ì—ì„œ 보기
+Comment[lv]=RÄda laiku un saules apspÄ«dÄ“to teritoriju uz pasaules kartes
+Comment[mk]=Прикажува време и Ñончева Ñветлина на карта на Ñветот
+Comment[nb]=Vis tid og steder med solskinn på et verdenskart
+Comment[nds]=Wiest Tiet un Sünnschien op'n Weltkoort
+Comment[ne]=विशà¥à¤µ मानचितà¥à¤°à¤®à¤¾ समय र सूरà¥à¤¯à¥‹à¤¦à¤¯ पà¥à¤°à¤¦à¤°à¥à¤¶à¤¨ गरà¥à¤¦à¤›
+Comment[nl]=Toont de tijd en zonneschijn op een wereldkaart
+Comment[nn]=Viser tid og solskin på eit verdskart
+Comment[pl]=Pokazuje czas i zasięg słońca na mapie świata
+Comment[pt]=Mostra a hora e luz solar num mapa mundo
+Comment[pt_BR]=Mostra a hora e a linha do dia/noite num mapa mundial
+Comment[ro]=Afişează timpul şi răsăritul soarelului pe o hartă mondială
+Comment[ru]=Ð’Ñ€ÐµÐ¼Ñ Ð¸ ÑÐ¾Ð»Ð½ÐµÑ‡Ð½Ð°Ñ Ñторона на карте мира
+Comment[sk]=Zobrazí Äas a slneÄný svit na mape sveta
+Comment[sl]=Prikazuje Äas in sonÄno svetlobo na zemljevidu sveta
+Comment[sr]=Приказује време и оÑунчаноÑÑ‚ на мапи Ñвета
+Comment[sr@Latn]=Prikazuje vreme i osunÄanost na mapi sveta
+Comment[sv]=Visar tid och solsken på en världskarta
+Comment[tg]=Ðамоиши вақти рузона ва шабона дар харитаи ҷаҳонӣ
+Comment[tr]=Bir dünya haritası üzerinde zamanı ve gün ışığını gösterir
+Comment[uk]=Показує Ñ‡Ð°Ñ Ñ– ÑонÑчний бік на карті Ñвіту
+Comment[wa]=Mostere l' eure eyet l' loumire do djoû so ene mape daegnrece
+Comment[zh_CN]=在世界地图上显示时间和阳光
+Comment[zh_TW]=在世界地圖上顯示時間與日光
+X-KDE-Library=ww_panelapplet
diff --git a/kworldwatch/main.cpp b/kworldwatch/main.cpp
new file mode 100644
index 0000000..622dc73
--- /dev/null
+++ b/kworldwatch/main.cpp
@@ -0,0 +1,202 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <stdlib.h>
+
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qwidget.h>
+
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+
+#include "main.moc"
+#include "mapwidget.h"
+#include "zoneclock.h"
+
+
+WorldWideWatch::WorldWideWatch(bool restore, QWidget *parent, const char *name)
+ : KMainWindow(parent, name)
+{
+ KGlobal::locale()->insertCatalogue("timezones"); // For time zone translation
+
+ QWidget *w = new QWidget(this);
+ setCentralWidget(w);
+
+ setPlainCaption(i18n("KDE World Clock"));
+
+ QVBoxLayout *vbox = new QVBoxLayout(w, 0,0);
+
+ _map = new MapWidget(false, restore, w);
+ vbox->addWidget(_map,1);
+
+ _clocks = new ZoneClockPanel(w);
+ vbox->addWidget(_clocks);
+
+ connect(_map, SIGNAL(addClockClicked(const QString &)), _clocks, SLOT(addClock(const QString &)));
+ connect(_map, SIGNAL(saveSettings()), this, SLOT(doSave()));
+
+ if (restore)
+ load(kapp->config());
+}
+
+
+void WorldWideWatch::load(KConfig *config)
+{
+ _map->load(config);
+ _clocks->load(config);
+
+ resize(config->readNumEntry("Width", 320),
+ config->readNumEntry("Height", 200));
+}
+
+
+void WorldWideWatch::save(KConfig *config)
+{
+ _map->save(config);
+ _clocks->save(config);
+
+ config->writeEntry("Width", width());
+ config->writeEntry("Height", height());
+}
+
+
+void WorldWideWatch::doSave()
+{
+ save(kapp->config());
+}
+
+
+void WatchApplication::dumpMap()
+{
+ // guess some default parameters
+ QSize mapSize(kapp->desktop()->size());
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ QCString themeName = args->getOption("theme");
+ QCString outName = args->getOption("o");
+
+ QCString ssize = args->getOption("size");
+ if (!ssize.isEmpty())
+ {
+ int w,h;
+ if (sscanf(ssize.data(), "%dx%d", &w, &h) == 2)
+ mapSize = QSize(w,h);
+ }
+
+ kdDebug() << "theme=" << themeName << " out=" << outName << " size=" << mapSize.width() << "x" << mapSize.height() << endl;
+
+ MapWidget *w = new MapWidget(false, true, 0);
+ w->setTheme(themeName);
+ w->setSize(mapSize.width(), mapSize.height());
+
+ QPixmap pm = w->calculatePixmap();
+ QPainter p(&pm);
+ w->paintContents(&p);
+ pm.save(outName, "PPM");
+
+ delete w;
+}
+
+
+int WatchApplication::newInstance()
+{
+ // dump mode, used for background drawing
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ if (args->isSet("dump"))
+ {
+ dumpMap();
+ return 0;
+ }
+
+ if (!restoringSession())
+ {
+ WorldWideWatch *www = new WorldWideWatch(true);
+ www->show();
+ }
+
+ return 0;
+}
+
+static void listThemes()
+{
+ QPtrList<MapTheme> _themes = MapLoader::themes();
+ QPtrListIterator<MapTheme> it(_themes);
+ for ( ; it.current(); ++it)
+ {
+ printf("%s\n", it.current()->tag().local8Bit().data());
+ }
+}
+
+static KCmdLineOptions options[] =
+{
+ { "dump", I18N_NOOP("Write out a file containing the actual map"), 0 },
+ { "theme <file>", I18N_NOOP("The name of the theme to use"), "depths"},
+ { "themes", I18N_NOOP("List available themes"), 0 },
+ { "o <file>", I18N_NOOP("The name of the file to write to"), "dump.ppm" },
+ { "size <WxH>", I18N_NOOP("The size of the map to dump"), 0 },
+ KCmdLineLastOption
+};
+
+
+int main(int argc, char *argv[])
+{
+ KAboutData about("kworldclock", I18N_NOOP("KDE World Clock"), "1.5");
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KUniqueApplication::addCmdLineOptions();
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ if (args->isSet("themes"))
+ {
+ KInstance app(&about);
+ listThemes();
+ return 0;
+ }
+
+ if (!KUniqueApplication::start())
+ return 0;
+
+ WatchApplication app;
+ if (args->isSet("dump"))
+ app.disableSessionManagement();
+
+ if (app.isRestored())
+ RESTORE(WorldWideWatch)
+
+ return app.exec();
+}
diff --git a/kworldwatch/main.h b/kworldwatch/main.h
new file mode 100644
index 0000000..7b4c3c6
--- /dev/null
+++ b/kworldwatch/main.h
@@ -0,0 +1,85 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+#ifndef MAIN_H
+#define MAIN_H
+
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <kuniqueapplication.h>
+#include <kmainwindow.h>
+
+
+class MapWidget;
+class ZoneClockPanel;
+
+
+class WorldWideWatch : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+
+ WorldWideWatch(bool restore=false, QWidget *parent=0, const char *name=0);
+
+ void save(KConfig *config);
+ void load(KConfig *load);
+
+
+protected:
+
+ void readProperties(KConfig *sc) { load(sc); };
+ void saveProperties(KConfig *sc) { save(sc); };
+
+
+private slots:
+
+ void doSave();
+
+
+private:
+
+ MapWidget *_map;
+ ZoneClockPanel *_clocks;
+
+};
+
+
+class WatchApplication : public KUniqueApplication
+{
+ Q_OBJECT
+
+public:
+
+ WatchApplication() : KUniqueApplication() {};
+
+ int newInstance();
+
+ void dumpMap();
+
+};
+#endif
+
diff --git a/kworldwatch/maploader.cpp b/kworldwatch/maploader.cpp
new file mode 100644
index 0000000..236abd3
--- /dev/null
+++ b/kworldwatch/maploader.cpp
@@ -0,0 +1,172 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include <time.h>
+
+#include <qvaluelist.h>
+#include <qdir.h>
+#include <qimage.h>
+#include <qpainter.h>
+#include <qtl.h>
+#include <qstringlist.h>
+
+
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <kdesktopfile.h>
+#include <kimageeffect.h>
+
+
+#include "astro.h"
+#include "maploader.h"
+
+
+QPtrList<MapTheme> MapLoader::themes()
+{
+ QPtrList<MapTheme> result;
+
+ QStringList files = KGlobal::dirs()->findAllResources("data", "kworldclock/maps/*/*.desktop");
+ for (QStringList::Iterator it=files.begin(); it != files.end(); ++it)
+ {
+ KDesktopFile conf(*it);
+ conf.setGroup("Theme");
+ result.append(new MapTheme(conf.readName(), conf.readEntry("Theme")));
+ }
+
+ return result;
+}
+
+
+QStringList MapLoader::maps(const QString &theme)
+{
+ return KGlobal::dirs()->findAllResources("data", QString("kworldclock/maps/%1/*.jpg").arg(theme));
+}
+
+
+void MapLoader::load(unsigned int width, const QString &theme, unsigned int height, float opacity)
+{
+ // find the maps available
+ QValueList<uint> sizes;
+ QStringList files = maps(theme);
+ for (uint i=0; i<files.count(); ++i)
+ {
+ QString f = files[i];
+ int pos = f.findRev("/");
+ if (pos >= 0)
+ f = f.mid(pos+1);
+ pos = f.findRev(".");
+ if (pos >= 0)
+ f = f.left(pos);
+ sizes.append(f.toInt());
+ }
+ qHeapSort(sizes);
+
+ // find the closest (bigger) size
+ uint size=0;
+ for (uint i=0; i<sizes.count(); ++i)
+ {
+ size = sizes[i];
+ if (size >= width)
+ break;
+ }
+
+ QImage image;
+ if (size == 0)
+ {
+ image = QImage(locate("data", "kworldclock/maps/depths/800.jpg"));
+ size = 800;
+ }
+ else
+ image = QImage(locate("data", QString("kworldclock/maps/%1/%2.jpg").arg(theme).arg(size)));
+
+ if (height == 0)
+ height = width/2;
+
+ if ((image.width() != (int)width) || (image.height() != (int)height))
+ image = image.smoothScale(width, height);
+
+ // convert to light map
+ _light.convertFromImage(image);
+
+ // calculate dark map
+ _dark.convertFromImage(KImageEffect::blend(Qt::black, image, opacity));
+}
+
+
+QBitmap MapLoader::darkMask(int width, int height)
+{
+ time_t t;
+ struct tm *tmp;
+ double jt, sunra, sundec, sunrv, sunlong;
+ short *wtab;
+
+ QBitmap illuMask(width, height);
+
+ // calculate the position of the sun
+ t = time(NULL);
+ tmp = gmtime(&t);
+ jt = jtime(tmp);
+ sunpos(jt,FALSE, &sunra, &sundec, &sunrv, &sunlong);
+
+ int sec = tmp->tm_hour*60*60 + tmp->tm_min*60 + tmp->tm_sec;
+ int gmt_position = width * sec / 86400; // note: greenwich is in the middle!
+
+ // calculate the illuminated area
+ wtab = new short[height];
+ projillum(wtab,width,height,sundec);
+
+ // draw illumination
+ illuMask.fill(Qt::black);
+ QPainter p;
+ p.begin(&illuMask);
+
+ int start, stop;
+ int middle = width - gmt_position;
+ for (int y=0; y<height; y++)
+ if (wtab[y]>0)
+ {
+ start = middle - wtab[y];
+ stop = middle + wtab[y];
+ if (start < 0)
+ {
+ p.drawLine(0,y,stop,y);
+ p.drawLine(width+start,y,width,y);
+ }
+ else
+ if (stop > width)
+ {
+ p.drawLine(start,y,width,y);
+ p.drawLine(0,y,stop-width,y);
+ }
+ else
+ p.drawLine(start,y,stop,y);
+ }
+ p.end();
+ delete [] wtab;
+ return illuMask;
+}
+
diff --git a/kworldwatch/maploader.h b/kworldwatch/maploader.h
new file mode 100644
index 0000000..efce45f
--- /dev/null
+++ b/kworldwatch/maploader.h
@@ -0,0 +1,81 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef MAP_LOADER_H
+#define MAP_LOADER_H
+
+#include <qpixmap.h>
+#include <qbitmap.h>
+#include <qptrlist.h>
+
+
+class MapTheme
+{
+public:
+
+ MapTheme() : _name(""), _tag(""), _id(0) {};
+ MapTheme(const QString &name, const QString &tag) : _name(name), _tag(tag), _id(0) {};
+
+ QString tag() { return _tag; };
+ QString name() { return _name; };
+
+ void setID(int i) { _id = i; };
+ int ID() { return _id; };
+
+
+private:
+
+ QString _name, _tag;
+ int _id;
+
+};
+
+
+class MapLoader
+{
+public:
+
+ static QPtrList<MapTheme> themes();
+
+ void load(unsigned int width=400, const QString &theme = "earth", unsigned int height=0, float opacity=0.5);
+
+ QPixmap lightMap() { return _light; };
+ QPixmap darkMap() { return _dark; };
+
+ QBitmap darkMask(int width, int height);
+
+
+private:
+
+ QStringList maps(const QString &theme);
+
+ QPixmap _light, _dark;
+
+};
+
+
+#endif
diff --git a/kworldwatch/maps/Makefile.am b/kworldwatch/maps/Makefile.am
new file mode 100644
index 0000000..5d3d86e
--- /dev/null
+++ b/kworldwatch/maps/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = depths flatworld
diff --git a/kworldwatch/maps/README.maps b/kworldwatch/maps/README.maps
new file mode 100644
index 0000000..fc35886
--- /dev/null
+++ b/kworldwatch/maps/README.maps
@@ -0,0 +1,10 @@
+A nice collection of maps to be used with KWorldWatch
+can be found at:
+
+http://www.radcyberzine.com/xglobe
+
+If you want to use your own map, you should make sure
+that Greenwich is exactly in the middle of the map.
+
+Bye,
+Matthias.
diff --git a/kworldwatch/maps/depths/400.jpg b/kworldwatch/maps/depths/400.jpg
new file mode 100644
index 0000000..1447b3d
--- /dev/null
+++ b/kworldwatch/maps/depths/400.jpg
Binary files differ
diff --git a/kworldwatch/maps/depths/800.jpg b/kworldwatch/maps/depths/800.jpg
new file mode 100644
index 0000000..38866b6
--- /dev/null
+++ b/kworldwatch/maps/depths/800.jpg
Binary files differ
diff --git a/kworldwatch/maps/depths/Makefile.am b/kworldwatch/maps/depths/Makefile.am
new file mode 100644
index 0000000..d543382
--- /dev/null
+++ b/kworldwatch/maps/depths/Makefile.am
@@ -0,0 +1,2 @@
+maps_DATA = depths.desktop 400.jpg 800.jpg
+mapsdir = $(kde_datadir)/kworldclock/maps/depths
diff --git a/kworldwatch/maps/depths/depths.desktop b/kworldwatch/maps/depths/depths.desktop
new file mode 100644
index 0000000..33a11a5
--- /dev/null
+++ b/kworldwatch/maps/depths/depths.desktop
@@ -0,0 +1,64 @@
+[Theme]
+Name=Surface Depth
+Name[af]=Oppervlakte Diepte
+Name[ar]=عمق السطح
+Name[az]=Səth Dərinliyi
+Name[be]=Ð“Ð»Ñ‹Ð±Ñ–Ð½Ñ Ð¿Ð°Ð²ÐµÑ€Ñ…Ð½Ñ–
+Name[bg]=Релеф на земната повърхноÑÑ‚
+Name[bn]=পৃষà§à¦ à§‡à¦° গভীরতা
+Name[br]=Krogad en egor
+Name[ca]=Extensió de la superfície
+Name[cs]=Plocha do hloubky
+Name[cy]=Dyfnder Arwyneb
+Name[da]=Overfladedybde
+Name[de]=Oberflächenstruktur
+Name[el]=Βάθος επιφάνειας
+Name[eo]=Surfacprofundo
+Name[es]=Profundidad de superficie
+Name[et]=Pinnasügavus
+Name[eu]=Azalaren Sakona
+Name[fa]=عمق سطح
+Name[fi]=Pinnan syvyys
+Name[fr]=Relief
+Name[ga]=Doimhneacht an Dromchla
+Name[gl]=Profundidade da Superfície
+Name[he]=מעמקי×
+Name[hi]=सतह गहराई
+Name[hr]=Površinska dubina
+Name[hu]=Felületmélység
+Name[is]=Yfirborðsdýpt
+Name[it]=Profondità superficie
+Name[ja]=表é¢ã®æ·±ã•
+Name[km]=ជម្រៅ​ផ្ទៃ
+Name[ko]=표면 깊ì´
+Name[lt]=Paviršiaus gylis
+Name[lv]=Virsmas dziļums
+Name[mk]=Длабочина на површина
+Name[mt]=Fond tal-wiċċ
+Name[nb]=Overflate-dybde
+Name[nds]=Böversiet-Deepde
+Name[ne]=धरातलिय गहिराइ
+Name[nl]=Oppervlaktediepte
+Name[nn]=Overflatedjupne
+Name[pl]=Głębokość powierzchni
+Name[pt]=Profundidade da Superfície
+Name[pt_BR]=Profundidade de superfície
+Name[ro]=Suprafaţă de adîncimi
+Name[ru]=Глубина поверхноÑти
+Name[sk]=Hĺbka povrchu
+Name[sl]=Globina ploskve
+Name[sr]=Дубина рељефа
+Name[sr@Latn]=Dubina reljefa
+Name[sv]=Ytdjup
+Name[ta]= தள ஆழமà¯
+Name[tg]=Қаъри Сатҳ
+Name[th]=ความลึà¸à¸žà¸·à¹‰à¸™à¸œà¸´à¸§
+Name[tr]=Yüzey Derinliği
+Name[uk]=Глибина поверхні
+Name[ven]=Vhulapfu uya fhasi
+Name[wa]=Surface e relief
+Name[xh]=Ubunzulu Bomphezulu
+Name[zh_CN]=表é¢çºµæ·±
+Name[zh_TW]=表é¢æ·±åº¦
+Name[zu]=Ubunzulu Baphezulu
+Theme=depths
diff --git a/kworldwatch/maps/flatworld/1200.jpg b/kworldwatch/maps/flatworld/1200.jpg
new file mode 100644
index 0000000..40a086d
--- /dev/null
+++ b/kworldwatch/maps/flatworld/1200.jpg
Binary files differ
diff --git a/kworldwatch/maps/flatworld/1600.jpg b/kworldwatch/maps/flatworld/1600.jpg
new file mode 100644
index 0000000..c0209af
--- /dev/null
+++ b/kworldwatch/maps/flatworld/1600.jpg
Binary files differ
diff --git a/kworldwatch/maps/flatworld/200.jpg b/kworldwatch/maps/flatworld/200.jpg
new file mode 100644
index 0000000..a603671
--- /dev/null
+++ b/kworldwatch/maps/flatworld/200.jpg
Binary files differ
diff --git a/kworldwatch/maps/flatworld/400.jpg b/kworldwatch/maps/flatworld/400.jpg
new file mode 100644
index 0000000..3dc3dac
--- /dev/null
+++ b/kworldwatch/maps/flatworld/400.jpg
Binary files differ
diff --git a/kworldwatch/maps/flatworld/800.jpg b/kworldwatch/maps/flatworld/800.jpg
new file mode 100644
index 0000000..895faf4
--- /dev/null
+++ b/kworldwatch/maps/flatworld/800.jpg
Binary files differ
diff --git a/kworldwatch/maps/flatworld/Makefile.am b/kworldwatch/maps/flatworld/Makefile.am
new file mode 100644
index 0000000..5feb5be
--- /dev/null
+++ b/kworldwatch/maps/flatworld/Makefile.am
@@ -0,0 +1,2 @@
+maps_DATA = flatworld.desktop 200.jpg 400.jpg 800.jpg 1200.jpg 1600.jpg
+mapsdir = $(kde_datadir)/kworldclock/maps/flatworld
diff --git a/kworldwatch/maps/flatworld/flatworld.desktop b/kworldwatch/maps/flatworld/flatworld.desktop
new file mode 100644
index 0000000..56ff332
--- /dev/null
+++ b/kworldwatch/maps/flatworld/flatworld.desktop
@@ -0,0 +1,53 @@
+[Theme]
+Name=Flat World
+Name[be]=ПлоÑкі Ñвет
+Name[bg]=Без релеф на земната повърхноÑÑ‚
+Name[bn]=সমতল বিশà§à¦¬
+Name[br]=Bed kompez
+Name[cs]=Plochý svět
+Name[cy]=Byd Gwastad
+Name[da]=Flad verden
+Name[de]=Flache Welt
+Name[el]=Επίπεδος κόσμος
+Name[eo]=Plana Mondo
+Name[es]=Mundo plano
+Name[et]=Lame maailm
+Name[eu]=Mundu zabal
+Name[fa]=جهان مسطح
+Name[fi]=Laakea maailma
+Name[fr]=Monde plat
+Name[ga]=Domhan Cothrom
+Name[gl]=Mundo Chao
+Name[he]=×¢×•×œ× ×©×˜×•×—
+Name[hr]=Pljosnati svijet
+Name[hu]=Lapos világ
+Name[is]=Flatur heimur
+Name[it]=Mondo piatto
+Name[ja]=å¹³å¦ãªä¸–界図
+Name[km]=ពិភពលោក​សំប៉ែáž
+Name[ko]=í‰í‰í•œ 세계
+Name[lv]=Plakana pasaule
+Name[mk]=Рамен Ñвет
+Name[mt]=Dinja ÄŠatta
+Name[nb]=Flat verden
+Name[nds]=Platte Welt
+Name[ne]=फराकिलो संसार
+Name[nl]=Vlakke wereld
+Name[pl]=Płaski świat
+Name[pt]=Mundo Plano
+Name[pt_BR]=Mundo Plano
+Name[ro]=Suprafaţă plată
+Name[ru]=ПлоÑкий мир
+Name[sk]=Plochý svet
+Name[sl]=PloÅ¡Äati svet
+Name[sr]=Раван Ñвет
+Name[sr@Latn]=Ravan svet
+Name[sv]=Platt värld
+Name[ta]=படிமான உலகமà¯
+Name[tg]=Ҷаҳони ҳамворӣ
+Name[tr]=Düz Dünya
+Name[uk]=ПлоÑкий Ñвіт
+Name[wa]=Plate Daegne
+Name[zh_CN]=å¹³é¢ä¸–ç•Œ
+Name[zh_TW]=å¹³é¢ä¸–ç•Œ
+Theme=flatworld
diff --git a/kworldwatch/mapwidget.cpp b/kworldwatch/mapwidget.cpp
new file mode 100644
index 0000000..2dac883
--- /dev/null
+++ b/kworldwatch/mapwidget.cpp
@@ -0,0 +1,576 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hözer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include "config.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#include <qdatetime.h>
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kcolordialog.h>
+#include <kconfig.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+
+#include <qcursor.h>
+#include <qpainter.h>
+#include <qpopupmenu.h>
+#include <qregexp.h>
+#include <qiconset.h>
+#include <qtooltip.h>
+
+
+#include "cities.h"
+#include "about.h"
+#include "flags.h"
+#include "mapwidget.moc"
+
+
+MapWidget::MapWidget(bool applet, bool restore, QWidget *parent, const char *name)
+ : QWidget(parent, name), _loader(), _illumination(true), _cities(true), _flags(true), _cityList(0),
+ _applet(applet), _width(0), _height(0)
+{
+ // this ugly construction is necessary so we don't load
+ // the map twice.
+ _theme = "depths";
+
+ if (restore)
+ {
+ KConfig *config = kapp->config();
+ if (applet)
+ config = new KConfig("kwwwappletrc");
+ _theme = config->readEntry("Theme", "depths");
+ if (applet)
+ delete config;
+ }
+
+ setBackgroundMode(QWidget::NoBackground);
+
+ gmt_position = 0;
+ time_t t = time(NULL);
+ setTime(gmtime(&t));
+
+ _flagList = new FlagList;
+
+ int id;
+ _flagPopup = new QPopupMenu(this);
+ QPixmap flag = QPixmap(locate("data", "kworldclock/pics/flag-red.png"));
+ id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Red"), this, SLOT(addFlag(int)));
+ _flagPopup->setItemParameter(id, 0);
+ flag = QPixmap(locate("data", "kworldclock/pics/flag-green.png"));
+ id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Green"), this, SLOT(addFlag(int)));
+ _flagPopup->setItemParameter(id, 1);
+ flag = QPixmap(locate("data", "kworldclock/pics/flag-blue.png"));
+ id = _flagPopup->insertItem(QIconSet(flag), i18n("Add &Blue"), this, SLOT(addFlag(int)));
+ _flagPopup->setItemParameter(id, 2);
+ id = _flagPopup->insertItem(i18n("Add &Custom..."), this, SLOT(addFlag(int)));
+ _flagPopup->setItemParameter(id, 3);
+ _flagPopup->insertSeparator();
+ _flagPopup->insertItem(i18n("&Remove Flag"), this, SLOT(removeFlag()));
+ _flagPopup->insertItem(i18n("&Remove All Flags"), this, SLOT(removeAllFlags()));
+
+ _themePopup = new QPopupMenu(this);
+ _themes = MapLoader::themes();
+ int cnt=0;
+ QPtrListIterator<MapTheme> it(_themes);
+ for ( ; it.current(); ++it)
+ {
+ int id = _themePopup->insertItem(it.current()->name(), this, SLOT(themeSelected(int)));
+ _themePopup->setItemParameter(id, cnt++);
+ it.current()->setID(id);
+ }
+
+ QPopupMenu *_clocksPopup = new QPopupMenu(this);
+ _clocksPopup->insertItem(i18n("&Add..."), this, SLOT(addClock()));
+
+ _popup = new QPopupMenu(this);
+ _popup->insertItem(i18n("&Flags"), _flagPopup);
+
+ if (!applet)
+ _popup->insertItem(i18n("&Clocks"), _clocksPopup);
+
+ _popup->insertSeparator();
+ _popup->insertItem(i18n("&Map Theme"), _themePopup);
+ _illuminationID = _popup->insertItem(i18n("Show &Daylight"), this, SLOT(toggleIllumination()));
+ _citiesID = _popup->insertItem(i18n("Show &Cities"), this, SLOT(toggleCities()));
+ _flagsID = _popup->insertItem(i18n("Show F&lags"), this, SLOT(toggleFlags()));
+
+ if (!applet)
+ {
+ _popup->insertSeparator();
+ _popup->insertItem(i18n("&Save Settings"), this, SLOT(slotSaveSettings()));
+ }
+
+ _popup->insertSeparator();
+ _popup->insertItem(i18n("&About"), this, SLOT(about()));
+
+ QTimer *timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
+ timer->start(1000);
+
+ _cityIndicator = new QLabel(0,0, WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM );
+ _cityIndicator->setMargin(1);
+ _cityIndicator->setIndent(0);
+ _cityIndicator->setAutoMask(false);
+ _cityIndicator->setLineWidth(1);
+ _cityIndicator->setAlignment(QLabel::AlignAuto | QLabel::AlignTop);
+ _cityIndicator->setAutoResize(true);
+ _cityIndicator->setFrameStyle(QFrame::Box | QFrame::Plain);
+ _cityIndicator->setPalette(QToolTip::palette());
+
+ if (restore && !applet)
+ load(kapp->config());
+
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateCityIndicator()));
+}
+
+
+MapWidget::~MapWidget()
+{
+ if (_applet)
+ {
+ KConfig *conf = new KConfig("kwwwappletrc");
+ save(conf);
+ delete conf;
+ }
+ delete _cityList;
+ delete _flagList;
+}
+
+
+void MapWidget::load(KConfig *config)
+{
+ setCities(config->readBoolEntry("Cities", true));
+ setIllumination(config->readBoolEntry("Illumination", true));
+ setFlags(config->readBoolEntry("Flags", true));
+
+ if ( !_applet )
+ {
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ if (args->isSet("theme"))
+ setTheme(QString::fromLocal8Bit(args->getOption("theme")));
+ else
+ setTheme(config->readEntry("Theme", "depths"));
+
+ _flagList->load(config);
+ }
+}
+
+
+void MapWidget::save(KConfig *config)
+{
+ config->writeEntry("Cities", _cities);
+ config->writeEntry("Illumination", _illumination);
+ config->writeEntry("Flags", _flags);
+
+ config->writeEntry("Theme", _theme);
+
+ _flagList->save(config);
+}
+
+
+void MapWidget::slotSaveSettings()
+{
+ emit saveSettings();
+}
+
+
+void MapWidget::addClock()
+{
+ if (!_cityList)
+ _cityList = new CityList;
+
+ QPoint where;
+ City *c = _cityList->getNearestCity(_width, _height, gmt_position, _flagPos.x(), _flagPos.y(), where);
+
+ QString zone = "";
+ if (c)
+ zone = c->name();
+
+ emit addClockClicked(zone);
+}
+
+
+void MapWidget::addFlag(int index)
+{
+ QColor col = Qt::red;
+
+ switch (index)
+ {
+ case 0:
+ col = Qt::red;
+ break;
+ case 1:
+ col = Qt::green;
+ break;
+ case 2:
+ col = Qt::blue;
+ break;
+ case 3:
+ if (KColorDialog::getColor(col, this) != KColorDialog::Accepted)
+ return;
+ break;
+ }
+
+ int x = _flagPos.x() - gmt_position + width()/2;
+ if (x>width())
+ x -= width();
+ double la = 90.0 - 180.0 * ((double)_flagPos.y()) / ((double)_height);
+ double lo = 360.0 * ((double)x) / ((double)_width) - 180.0;
+
+ _flagList->addFlag(new Flag(lo, la, col));
+
+ update();
+}
+
+
+void MapWidget::removeFlag()
+{
+ _flagList->removeNearestFlag(_flagPos, _width, _height, gmt_position);
+ update();
+}
+
+void MapWidget::removeAllFlags()
+{
+ if ( KMessageBox::warningContinueCancel( this, i18n( "Do you really want to remove all flags?" ), QString::null, KStdGuiItem::del() ) == KMessageBox::Continue )
+ _flagList->removeAllFlags();
+
+ update();
+}
+
+void MapWidget::setCities(bool c)
+{
+ _cities = c;
+ _popup->setItemChecked(_citiesID, c);
+
+ if (c && !_cityList)
+ _cityList = new CityList;
+
+ setMouseTracking(c);
+ if (!c)
+ {
+ _cityIndicator->hide();
+ m_timer.stop();
+ }
+
+ update();
+}
+
+
+void MapWidget::toggleCities()
+{
+ setCities(!_popup->isItemChecked(_citiesID));
+}
+
+
+void MapWidget::toggleIllumination()
+{
+ setIllumination(!_popup->isItemChecked(_illuminationID));
+}
+
+
+void MapWidget::setFlags(bool f)
+{
+ _flags = f;
+ _popup->setItemChecked(_flagsID, f);
+
+ update();
+}
+
+
+void MapWidget::toggleFlags()
+{
+ setFlags(!_popup->isItemChecked(_flagsID));
+}
+
+
+void MapWidget::updateBackground()
+{
+ if (!_height)
+ return;
+ _pixmap = calculatePixmap();
+ setBackgroundPixmap(_pixmap);
+
+ update();
+}
+
+
+QPixmap MapWidget::getPixmap()
+{
+ return _pixmap;
+}
+
+
+void MapWidget::setIllumination(bool i)
+{
+ _illumination = i;
+ _popup->setItemChecked(_illuminationID, i);
+
+ updateBackground();
+}
+
+
+void MapWidget::timeout()
+{
+ time_t t = time(NULL);
+ setTime(gmtime(&t));
+
+ if (_cities && !_currentCity.isEmpty())
+ _cityIndicator->setText(cityTime(_currentCity));
+}
+
+
+QString MapWidget::cityTime(const QString &city)
+{
+ QString result = i18n(city.latin1()); // Time zone translation
+ int pos = result.find("/");
+ if (pos >= 0)
+ result = result.mid(pos+1);
+ result.replace(QRegExp("_"), " ");
+ result.append(": ");
+
+ char *initial_TZ = getenv("TZ");
+ setenv("TZ", city.latin1(), 1);
+ tzset();
+
+ time_t t = time(NULL);
+ QDateTime dt;
+ dt.setTime_t(t);
+ result.append(QString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true)));
+
+ if (initial_TZ != 0)
+ setenv("TZ", initial_TZ, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+ return result;
+}
+
+
+void MapWidget::enterEvent(QEvent *)
+{
+ if ( _cities )
+ updateCityIndicator();
+}
+
+void MapWidget::leaveEvent(QEvent *)
+{
+ _cityIndicator->hide();
+ m_timer.stop();
+}
+
+
+void MapWidget::about()
+{
+ AboutDialog dlg(this, 0, true);
+ dlg.exec();
+}
+
+
+void MapWidget::themeSelected(int index)
+{
+ QString t = _themes.at(index)->tag();
+ if (!t.isEmpty())
+ setTheme(t);
+}
+
+
+void MapWidget::mousePressEvent(QMouseEvent *ev)
+{
+ if (ev->button() == QMouseEvent::RightButton)
+ {
+ _flagPos = ev->pos();
+ _popup->exec(ev->globalPos());
+ }
+}
+
+
+void MapWidget::mouseMoveEvent(QMouseEvent *)
+{
+ if (!_cities)
+ return;
+
+ if (!m_timer.isActive())
+ m_timer.start(25, true);
+}
+
+void MapWidget::updateCityIndicator()
+{
+ QPoint where;
+ QPoint pos = mapFromGlobal(QCursor::pos());
+
+ if (!_cityList)
+ _cityList = new CityList;
+ City *c = _cityList->getNearestCity(_width, _height, gmt_position, pos.x(), pos.y(), where);
+
+ if (c)
+ {
+ _currentCity = c->name();
+ showIndicator(QCursor::pos());
+ }
+ else
+ _cityIndicator->hide();
+}
+
+
+void MapWidget::showIndicator(const QPoint &pos)
+{
+ _cityIndicator->setText(cityTime(_currentCity));
+
+ int w = _cityIndicator->width();
+ int h = _cityIndicator->height();
+
+ QRect desk = KGlobalSettings::desktopGeometry(pos);
+
+ QPoint newPos;
+
+ if (pos.x()+w+10 > desk.right())
+ newPos.setX(pos.x()-w-5);
+ else
+ newPos.setX(pos.x()+10);
+
+ if (pos.y()+h+10 > desk.bottom())
+ newPos.setY(pos.y()-h-5);
+ else
+ newPos.setY(pos.y()+10);
+
+ _cityIndicator->move(newPos);
+
+ _cityIndicator->show();
+
+}
+
+
+void MapWidget::setTheme(const QString &theme)
+{
+ _theme = theme;
+
+ QPtrListIterator<MapTheme> it(_themes);
+ for ( ; it.current(); ++it)
+ _themePopup->setItemChecked(it.current()->ID(), theme == it.current()->tag());
+
+ if (_height)
+ setSize(_width, _height);
+}
+
+
+void MapWidget::setTime(struct tm *time)
+{
+ sec = time->tm_hour*60*60 + time->tm_min*60 + time->tm_sec;
+
+ if (isVisible())
+ {
+ int old_position = gmt_position;
+ gmt_position = width() * sec / 86400; // note: greenwich is in the middle!
+
+ if (old_position != gmt_position)
+ updateBackground();
+ }
+}
+
+void MapWidget::setSize(int w, int h)
+{
+ _width = w;
+ _height = h;
+ _loader.load(_width, _theme, _height);
+
+ gmt_position = width() * sec / 86400; // note: greenwich is in the middle!
+
+ updateBackground();
+}
+
+void MapWidget::resizeEvent(QResizeEvent *ev)
+{
+ setSize(width(), height());
+ QWidget::resizeEvent(ev);
+}
+
+void MapWidget::paintContents(QPainter *p)
+{
+ if (_cities)
+ _cityList->paint(p, _width, _height, gmt_position);
+ if (_flags)
+ _flagList->paint(p, _width, _height, gmt_position);
+}
+
+void MapWidget::paintEvent(QPaintEvent *ev)
+{
+ QWidget::paintEvent(ev);
+
+ if (_cities || _flags)
+ {
+ QPainter p(this);
+
+ p.setClipping(true);
+ p.setClipRegion(ev->region());
+
+ paintContents(&p);
+ }
+}
+
+
+QPixmap MapWidget::calculatePixmap()
+{
+ QPixmap map;
+
+ if (_illumination)
+ {
+ map = _loader.darkMap();
+ QPixmap clean = _loader.lightMap();
+
+ QPainter mp(&map);
+ clean.setMask(_loader.darkMask(map.width(), map.height()));
+ mp.drawPixmap(0,0, clean);
+ }
+ else
+ map = _loader.lightMap();
+
+ int greenwich = map.width()/2;
+
+ QPixmap pm(_width, _height);
+ QPainter p;
+ p.begin(&pm);
+
+ if (gmt_position >= greenwich)
+ {
+ p.drawPixmap(gmt_position-greenwich, 0, map, 0, 0, map.width()-gmt_position+greenwich);
+ p.drawPixmap(0,0, map, map.width()-gmt_position+greenwich, 0, gmt_position-greenwich);
+ }
+ else
+ {
+ p.drawPixmap(0,0, map, greenwich-gmt_position, 0, map.width()+gmt_position-greenwich);
+ p.drawPixmap(map.width()+gmt_position-greenwich, 0, map, 0, 0, greenwich-gmt_position);
+ }
+
+ return pm;
+}
diff --git a/kworldwatch/mapwidget.h b/kworldwatch/mapwidget.h
new file mode 100644
index 0000000..54e4f58
--- /dev/null
+++ b/kworldwatch/mapwidget.h
@@ -0,0 +1,161 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef MAP_WIDGET_H
+#define MAP_WIDGET_H
+
+
+#include <time.h>
+
+
+#include <qwidget.h>
+#include <qpixmap.h>
+#include <qstringlist.h>
+#include <qlabel.h>
+#include <qpoint.h>
+#include <qtimer.h>
+
+
+class QPopupMenu;
+
+
+#include <kconfig.h>
+
+
+class CityList;
+class FlagList;
+
+
+#include "maploader.h"
+
+
+class MapWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ MapWidget(bool applet=false, bool restore=false, QWidget *parent=0, const char *name=0);
+ ~MapWidget();
+
+ void setTheme(const QString &theme);
+ void setTime(struct tm *time);
+ void setIllumination(bool i);
+ void setCities(bool c);
+ void setFlags(bool f);
+ void setSize(int w, int h);
+
+ void save(KConfig *config);
+ void load(KConfig *config);
+
+ void updateBackground();
+
+ QPixmap getPixmap();
+ QPopupMenu* contextMenu() const { return _popup; }
+
+ void paintContents(QPainter *p);
+ QPixmap calculatePixmap();
+
+signals:
+
+ void addClockClicked(const QString &zone);
+ void saveSettings();
+
+
+protected slots:
+
+ void timeout();
+ void updateCityIndicator();
+
+public slots:
+
+ void about();
+
+ void toggleIllumination();
+ void toggleCities();
+ void toggleFlags();
+
+ void removeFlag();
+ void removeAllFlags();
+
+ void slotSaveSettings();
+
+
+protected:
+
+ void resizeEvent(QResizeEvent *ev);
+ void paintEvent(QPaintEvent *ev);
+ void mousePressEvent(QMouseEvent *ev);
+ void mouseMoveEvent(QMouseEvent *ev);
+ void enterEvent(QEvent *ev);
+ void leaveEvent(QEvent *ev);
+
+
+private slots:
+
+ void themeSelected(int index);
+ void addFlag(int index);
+ void addClock();
+
+
+private:
+
+ void updateMap();
+ QString cityTime(const QString &city);
+ void showIndicator(const QPoint &pos);
+
+ MapLoader _loader;
+
+ QString _theme;
+
+ QPixmap _pixmap;
+
+ int gmt_position;
+
+ time_t sec;
+
+ QPopupMenu *_popup, *_themePopup, *_flagPopup;
+ QPtrList<MapTheme> _themes;
+
+ bool _illumination, _cities, _flags;
+ int _illuminationID, _citiesID, _flagsID;
+
+ CityList *_cityList;
+ QLabel *_cityIndicator;
+ QString _currentCity;
+
+ FlagList *_flagList;
+ QPoint _flagPos;
+
+ bool _applet;
+ QTimer m_timer;
+
+ int _width, _height;
+};
+
+
+#endif
diff --git a/kworldwatch/pics/Makefile.am b/kworldwatch/pics/Makefile.am
new file mode 100644
index 0000000..b0cbcf9
--- /dev/null
+++ b/kworldwatch/pics/Makefile.am
@@ -0,0 +1,2 @@
+pics_DATA = flag.png flag-mask.xpm flag-red.png flag-blue.png flag-green.png
+picsdir = $(kde_datadir)/kworldclock/pics
diff --git a/kworldwatch/pics/flag-blue.png b/kworldwatch/pics/flag-blue.png
new file mode 100644
index 0000000..b0d41dc
--- /dev/null
+++ b/kworldwatch/pics/flag-blue.png
Binary files differ
diff --git a/kworldwatch/pics/flag-green.png b/kworldwatch/pics/flag-green.png
new file mode 100644
index 0000000..dba9c2d
--- /dev/null
+++ b/kworldwatch/pics/flag-green.png
Binary files differ
diff --git a/kworldwatch/pics/flag-mask.xpm b/kworldwatch/pics/flag-mask.xpm
new file mode 100644
index 0000000..d7ceb66
--- /dev/null
+++ b/kworldwatch/pics/flag-mask.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char * flag_xpm[] = {
+"16 16 2 1",
+" c #ffffff",
+". c #000000",
+" ",
+" ...... ",
+" ....... ",
+" ......... ",
+" ............. ",
+" ............. ",
+" ............ ",
+" ............ ",
+" .. ........ ",
+" .. .......",
+" .. .... ",
+" .. ",
+" .. ",
+" .. ",
+" .. ",
+" "};
diff --git a/kworldwatch/pics/flag-red.png b/kworldwatch/pics/flag-red.png
new file mode 100644
index 0000000..ef05d3b
--- /dev/null
+++ b/kworldwatch/pics/flag-red.png
Binary files differ
diff --git a/kworldwatch/pics/flag.png b/kworldwatch/pics/flag.png
new file mode 100644
index 0000000..3aaa788
--- /dev/null
+++ b/kworldwatch/pics/flag.png
Binary files differ
diff --git a/kworldwatch/pics/world2.png b/kworldwatch/pics/world2.png
new file mode 100644
index 0000000..20b4a05
--- /dev/null
+++ b/kworldwatch/pics/world2.png
Binary files differ
diff --git a/kworldwatch/sunclock.c b/kworldwatch/sunclock.c
new file mode 100644
index 0000000..46058ac
--- /dev/null
+++ b/kworldwatch/sunclock.c
@@ -0,0 +1,164 @@
+/*
+ * Sun clock. X11 version by John Mackin.
+ *
+ * This program was derived from, and is still in part identical with, the
+ * Suntools Sun clock program whose author's comment appears immediately
+ * below. Please preserve both notices.
+ *
+ * The X11R3/4 version of this program was written by John Mackin, at the
+ * Basser Department of Computer Science, University of Sydney, Sydney,
+ * New South Wales, Australia; <john@cs.su.oz.AU>. This program, like
+ * the one it was derived from, is in the public domain: `Love is the
+ * law, love under will.'
+ */
+
+/*
+
+ Sun clock
+
+ Designed and implemented by John Walker in November of 1988.
+
+ Version for the Sun Workstation.
+
+ The algorithm used to calculate the position of the Sun is given in
+ Chapter 18 of:
+
+ "Astronomical Formulae for Calculators" by Jean Meeus, Third Edition,
+ Richmond: Willmann-Bell, 1985. This book can be obtained from:
+
+ Willmann-Bell
+ P.O. Box 35025
+ Richmond, VA 23235
+ USA
+ Phone: (804) 320-7016
+
+ This program was written by:
+
+ John Walker
+ Autodesk, Inc.
+ 2320 Marinship Way
+ Sausalito, CA 94965
+ USA
+ Fax: (415) 389-9418
+ Voice: (415) 332-2344 Ext. 2829
+ Usenet: {sun,well,uunet}!acad!kelvin
+ or: kelvin@acad.uu.net
+
+ modified for interactive maps by
+
+ Stephen Martin
+ Fujitsu Systems Business of Canada
+ smartin@fujitsu.ca
+
+ This program is in the public domain: "Do what thou wilt shall be the
+ whole of the law". I'd appreciate receiving any bug fixes and/or
+ enhancements, which I'll incorporate in future versions of the
+ program. Please leave the original attribution information intact so
+ that credit and blame may be properly apportioned.
+
+ Revision history:
+
+ 1.0 12/21/89 Initial version.
+ 8/24/89 Finally got around to submitting.
+
+ 1.1 8/31/94 Version with interactive map.
+ 1.2 10/12/94 Fixes for HP and Solaris, new icon bitmap
+ 1.3 11/01/94 Timezone now shown in icon
+ 1.4 03/29/98 Fixed city drawing, added icon animation
+
+*/
+
+#include "sunclock.h"
+
+void projillum(short *wtab, int xdots, int ydots, double dec);
+
+/* PROJILLUM -- Project illuminated area on the map. */
+
+void
+projillum(wtab, xdots, ydots, dec)
+short *wtab;
+int xdots, ydots;
+double dec;
+{
+ int i, ftf = 1, ilon, ilat, lilon = 0, lilat = 0, xt;
+ double m, x, y, z, th, lon, lat, s, c;
+
+ /* Clear unoccupied cells in width table */
+
+ for (i = 0; i < ydots; i++)
+ wtab[i] = -1;
+
+ /* Build transformation for declination */
+
+ s = sin(-dtr(dec));
+ c = cos(-dtr(dec));
+
+ /* Increment over a semicircle of illumination */
+
+ for (th = -(PI / 2); th <= PI / 2 + 0.001;
+ th += PI / TERMINC) {
+
+ /* Transform the point through the declination rotation. */
+
+ x = -s * sin(th);
+ y = cos(th);
+ z = c * sin(th);
+
+ /* Transform the resulting co-ordinate through the
+ map projection to obtain screen co-ordinates. */
+
+ lon = (y == 0 && x == 0) ? 0.0 : rtd(atan2(y, x));
+ lat = rtd(asin(z));
+
+ ilat = ydots - (lat + 90) * (ydots / 180.0);
+ ilon = lon * (xdots / 360.0);
+
+ if (ftf) {
+
+ /* First time. Just save start co-ordinate. */
+
+ lilon = ilon;
+ lilat = ilat;
+ ftf = 0;
+ } else {
+
+ /* Trace out the line and set the width table. */
+
+ if (lilat == ilat) {
+ wtab[(ydots - 1) - ilat] = ilon == 0 ? 1 : ilon;
+ } else {
+ m = ((double) (ilon - lilon)) / (ilat - lilat);
+ for (i = lilat; i != ilat; i += sgn(ilat - lilat)) {
+ xt = lilon + floor((m * (i - lilat)) + 0.5);
+ wtab[(ydots - 1) - i] = xt == 0 ? 1 : xt;
+ }
+ }
+ lilon = ilon;
+ lilat = ilat;
+ }
+ }
+
+ /* Now tweak the widths to generate full illumination for
+ the correct pole. */
+
+ if (dec < 0.0) {
+ ilat = ydots - 1;
+ lilat = -1;
+ } else {
+ ilat = 0;
+ lilat = 1;
+ }
+
+ for (i = ilat; i != ydots / 2; i += lilat) {
+ if (wtab[i] != -1) {
+ while (1) {
+ wtab[i] = xdots / 2;
+ if (i == ilat)
+ break;
+ i -= lilat;
+ }
+ break;
+ }
+ }
+}
+
diff --git a/kworldwatch/sunclock.h b/kworldwatch/sunclock.h
new file mode 100644
index 0000000..1787506
--- /dev/null
+++ b/kworldwatch/sunclock.h
@@ -0,0 +1,98 @@
+/*
+ * Sun clock. X11 version by John Mackin.
+ *
+ * This program was derived from, and is still in part identical with, the
+ * Suntools Sun clock program whose author's comment appears immediately
+ * below. Please preserve both notices.
+ *
+ * The X11R3/4 version of this program was written by John Mackin, at the
+ * Basser Department of Computer Science, University of Sydney, Sydney,
+ * New South Wales, Australia; <john@cs.su.oz.AU>. This program, like
+ * the one it was derived from, is in the public domain: `Love is the
+ * law, love under will.'
+ */
+
+/*
+
+ Sun clock
+
+ Designed and implemented by John Walker in November of 1988.
+
+ Version for the Sun Workstation.
+
+ The algorithm used to calculate the position of the Sun is given in
+ Chapter 18 of:
+
+ "Astronomical Formulae for Calculators" by Jean Meeus, Third Edition,
+ Richmond: Willmann-Bell, 1985. This book can be obtained from:
+
+ Willmann-Bell
+ P.O. Box 35025
+ Richmond, VA 23235
+ USA
+ Phone: (804) 320-7016
+
+ This program was written by:
+
+ John Walker
+ Autodesk, Inc.
+ 2320 Marinship Way
+ Sausalito, CA 94965
+ USA
+ Fax: (415) 389-9418
+ Voice: (415) 332-2344 Ext. 2829
+ Usenet: {sun,well,uunet}!acad!kelvin
+ or: kelvin@acad.uu.net
+
+ modified for interactive maps by
+
+ Stephen Martin
+ Fujitsu Systems Business of Canada
+ smartin@fujitsu.ca
+
+ This program is in the public domain: "Do what thou wilt shall be the
+ whole of the law". I'd appreciate receiving any bug fixes and/or
+ enhancements, which I'll incorporate in future versions of the
+ program. Please leave the original attribution information intact so
+ that credit and blame may be properly apportioned.
+
+ Revision history:
+
+ 1.0 12/21/89 Initial version.
+ 8/24/89 Finally got around to submitting.
+
+ 1.1 8/31/94 Version with interactive map.
+ 1.2 10/12/94 Fixes for HP and Solaris, new icon bitmap
+ 1.3 11/01/94 Timezone now shown in icon
+ 1.4 03/29/98 Fixed city drawing, added icon animation
+
+*/
+
+#ifndef SUNCLOCK_H
+#define SUNCLOCK_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+
+#ifndef E
+#define E 2.7182818284590452354
+#endif
+
+#define abs(x) ((x) < 0 ? (-(x)) : x) /* Absolute value */
+#define sgn(x) (((x) < 0) ? -1 : ((x) > 0 ? 1 : 0)) /* Extract sign */
+#define dtr(x) ((x) * (PI / 180.0)) /* Degree->Radian */
+#define rtd(x) ((x) / (PI / 180.0)) /* Radian->Degree */
+#define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0))) /* Fix angle */
+
+#define TERMINC 100 /* Circle segments for terminator */
+
+#define PROJINT (60 * 10) /* Frequency of seasonal recalculation */
+
+#endif
+
diff --git a/kworldwatch/zone.tab b/kworldwatch/zone.tab
new file mode 100644
index 0000000..e3c8e39
--- /dev/null
+++ b/kworldwatch/zone.tab
@@ -0,0 +1,409 @@
+# @(#)zone.tab 1.30
+#
+# TZ zone descriptions
+#
+# From Paul Eggert <eggert@twinsun.com> (1996-08-05):
+#
+# This file contains a table with the following columns:
+# 1. ISO 3166 2-character country code. See the file `iso3166.tab'.
+# 2. Latitude and longitude of the zone's principal location
+# in ISO 6709 sign-degrees-minutes-seconds format,
+# either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
+# first latitude (+ is north), then longitude (+ is east).
+# 3. Zone name used in value of TZ environment variable.
+# 4. Comments; present if and only if the country has multiple rows.
+#
+# Columns are separated by a single tab.
+# The table is sorted first by country, then an order within the country that
+# (1) makes some geographical sense, and
+# (2) puts the most populous zones first, where that does not contradict (1).
+#
+# Lines beginning with `#' are comments.
+#
+#country-
+#code coordinates TZ comments
+AD +4230+00131 Europe/Andorra
+AE +2518+05518 Asia/Dubai
+AF +3431+06912 Asia/Kabul
+AG +1703-06148 America/Antigua
+AI +1812-06304 America/Anguilla
+AL +4120+01950 Europe/Tirane
+AM +4011+04430 Asia/Yerevan
+AN +1211-06900 America/Curacao
+AO -0848+01314 Africa/Luanda
+AQ -7750+16636 Antarctica/McMurdo McMurdo Station, Ross Island
+AQ -9000+00000 Antarctica/South_Pole Amundsen-Scott Station, South Pole
+AQ -6734-06808 Antarctica/Rothera Rothera Station, Adelaide Island
+AQ -6448-06406 Antarctica/Palmer Palmer Station, Anvers Island
+AQ -6736+06253 Antarctica/Mawson Mawson Station, Holme Bay
+AQ -6835+07758 Antarctica/Davis Davis Station, Vestfold Hills
+AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
+AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
+AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Base, Terre Adelie
+AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
+AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF)
+AR -3124-06411 America/Argentina/Cordoba most locations (CB, CC, CN, ER, FM, LP, MN, NQ, RN, SA, SE, SF, SL)
+AR -2411-06518 America/Argentina/Jujuy Jujuy (JY)
+AR -3124-06411 America/Argentina/Tucuman Tucuman (TM)
+AR -2828-06547 America/Argentina/Catamarca Catamarca (CT)
+AR -2926-06651 America/Argentina/La_Rioja La Rioja (LR)
+AR -3132-06831 America/Argentina/San_Juan San Juan (SJ)
+AR -3253-06849 America/Argentina/Mendoza Mendoza (MZ)
+AR -4552-06730 America/Argentina/ComodRivadavia Chubut (CH)
+AR -5138-06913 America/Argentina/Rio_Gallegos Santa Cruz (SC)
+AR -5448-06818 America/Argentina/Ushuaia Tierra del Fuego (TF)
+AS -1416-17042 Pacific/Pago_Pago
+AT +4813+01620 Europe/Vienna
+AU -3133+15905 Australia/Lord_Howe Lord Howe Island
+AU -4253+14719 Australia/Hobart Tasmania
+AU -3749+14458 Australia/Melbourne Victoria
+AU -3352+15113 Australia/Sydney New South Wales - most locations
+AU -3157+14127 Australia/Broken_Hill New South Wales - Yancowinna
+AU -2728+15302 Australia/Brisbane Queensland - most locations
+AU -2016+14900 Australia/Lindeman Queensland - Holiday Islands
+AU -3455+13835 Australia/Adelaide South Australia
+AU -1228+13050 Australia/Darwin Northern Territory
+AU -3157+11551 Australia/Perth Western Australia
+AW +1230-06858 America/Aruba
+AX +6006+01957 Europe/Mariehamn
+AZ +4023+04951 Asia/Baku
+BA +4352+01825 Europe/Sarajevo
+BB +1306-05937 America/Barbados
+BD +2343+09025 Asia/Dhaka
+BE +5050+00420 Europe/Brussels
+BF +1222-00131 Africa/Ouagadougou
+BG +4241+02319 Europe/Sofia
+BH +2623+05035 Asia/Bahrain
+BI -0323+02922 Africa/Bujumbura
+BJ +0629+00237 Africa/Porto-Novo
+BM +3217-06446 Atlantic/Bermuda
+BN +0456+11455 Asia/Brunei
+BO -1630-06809 America/La_Paz
+BR -0351-03225 America/Noronha Atlantic islands
+BR -0127-04829 America/Belem Amapa, E Para
+BR -0343-03830 America/Fortaleza NE Brazil (MA, PI, CE, RN, PB)
+BR -0803-03454 America/Recife Pernambuco
+BR -0712-04812 America/Araguaina Tocantins
+BR -0940-03543 America/Maceio Alagoas, Sergipe
+BR -1259-03831 America/Bahia Bahia
+BR -2332-04637 America/Sao_Paulo S & SE Brazil (GO, DF, MG, ES, RJ, SP, PR, SC, RS)
+BR -2027-05437 America/Campo_Grande Mato Grosso do Sul
+BR -1535-05605 America/Cuiaba Mato Grosso
+BR -0846-06354 America/Porto_Velho W Para, Rondonia
+BR +0249-06040 America/Boa_Vista Roraima
+BR -0308-06001 America/Manaus E Amazonas
+BR -0640-06952 America/Eirunepe W Amazonas
+BR -0958-06748 America/Rio_Branco Acre
+BS +2505-07721 America/Nassau
+BT +2728+08939 Asia/Thimphu
+BW -2545+02555 Africa/Gaborone
+BY +5354+02734 Europe/Minsk
+BZ +1730-08812 America/Belize
+CA +4734-05243 America/St_Johns Newfoundland Island
+CA +4439-06336 America/Halifax Atlantic Time - Nova Scotia (most places), NB, W Labrador, E Quebec & PEI
+CA +4612-05957 America/Glace_Bay Atlantic Time - Nova Scotia - places that did not observe DST 1966-1971
+CA +5320-06025 America/Goose_Bay Atlantic Time - E Labrador
+CA +4531-07334 America/Montreal Eastern Time - Quebec - most locations
+CA +4339-07923 America/Toronto Eastern Time - Ontario - most locations
+CA +4901-08816 America/Nipigon Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
+CA +4823-08915 America/Thunder_Bay Eastern Time - Thunder Bay, Ontario
+CA +6608-06544 America/Pangnirtung Eastern Standard Time - Pangnirtung, Nunavut
+CA +6344-06828 America/Iqaluit Eastern Standard Time - east Nunavut
+CA +6245-09210 America/Rankin_Inlet Eastern Standard Time - central Nunavut
+CA +4953-09709 America/Winnipeg Central Time - Manitoba & west Ontario
+CA +4843-09429 America/Rainy_River Central Time - Rainy River & Fort Frances, Ontario
+CA +6903-10505 America/Cambridge_Bay Central Time - west Nunavut
+CA +5024-10439 America/Regina Central Standard Time - Saskatchewan - most locations
+CA +5017-10750 America/Swift_Current Central Standard Time - Saskatchewan - midwest
+CA +5333-11328 America/Edmonton Mountain Time - Alberta, east British Columbia & west Saskatchewan
+CA +6227-11421 America/Yellowknife Mountain Time - central Northwest Territories
+CA +6825-11330 America/Inuvik Mountain Time - west Northwest Territories
+CA +5946-12014 America/Dawson_Creek Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
+CA +4916-12307 America/Vancouver Pacific Time - west British Columbia
+CA +6043-13503 America/Whitehorse Pacific Time - south Yukon
+CA +6404-13925 America/Dawson Pacific Time - north Yukon
+CC -1210+09655 Indian/Cocos
+CD -0418+01518 Africa/Kinshasa west Dem. Rep. of Congo
+CD -1140+02728 Africa/Lubumbashi east Dem. Rep. of Congo
+CF +0422+01835 Africa/Bangui
+CG -0416+01517 Africa/Brazzaville
+CH +4723+00832 Europe/Zurich
+CI +0519-00402 Africa/Abidjan
+CK -2114-15946 Pacific/Rarotonga
+CL -3327-07040 America/Santiago most locations
+CL -2710-10927 Pacific/Easter Easter Island & Sala y Gomez
+CM +0403+00942 Africa/Douala
+CN +3114+12128 Asia/Shanghai east China - Beijing, Guangdong, Shanghai, etc.
+CN +4545+12641 Asia/Harbin Heilongjiang
+CN +2934+10635 Asia/Chongqing central China - Gansu, Guizhou, Sichuan, Yunnan, etc.
+CN +4348+08735 Asia/Urumqi Tibet & most of Xinjiang Uyghur
+CN +3929+07559 Asia/Kashgar southwest Xinjiang Uyghur
+CO +0436-07405 America/Bogota
+CR +0956-08405 America/Costa_Rica
+CS +4450+02030 Europe/Belgrade
+CU +2308-08222 America/Havana
+CV +1455-02331 Atlantic/Cape_Verde
+CX -1025+10543 Indian/Christmas
+CY +3510+03322 Asia/Nicosia
+CZ +5005+01426 Europe/Prague
+DE +5230+01322 Europe/Berlin
+DJ +1136+04309 Africa/Djibouti
+DK +5540+01235 Europe/Copenhagen
+DM +1518-06124 America/Dominica
+DO +1828-06954 America/Santo_Domingo
+DZ +3647+00303 Africa/Algiers
+EC -0210-07950 America/Guayaquil mainland
+EC -0054-08936 Pacific/Galapagos Galapagos Islands
+EE +5925+02445 Europe/Tallinn
+EG +3003+03115 Africa/Cairo
+EH +2709-01312 Africa/El_Aaiun
+ER +1520+03853 Africa/Asmera
+ES +4024-00341 Europe/Madrid mainland
+ES +3553-00519 Africa/Ceuta Ceuta & Melilla
+ES +2806-01524 Atlantic/Canary Canary Islands
+ET +0902+03842 Africa/Addis_Ababa
+FI +6010+02458 Europe/Helsinki
+FJ -1808+17825 Pacific/Fiji
+FK -5142-05751 Atlantic/Stanley
+FM +0931+13808 Pacific/Yap Yap
+FM +0725+15147 Pacific/Truk Truk (Chuuk)
+FM +0658+15813 Pacific/Ponape Ponape (Pohnpei)
+FM +0519+16259 Pacific/Kosrae Kosrae
+FO +6201-00646 Atlantic/Faeroe
+FR +4852+00220 Europe/Paris
+GA +0023+00927 Africa/Libreville
+GB +512830-0001845 Europe/London Great Britain
+GB +5435-00555 Europe/Belfast Northern Ireland
+GD +1203-06145 America/Grenada
+GE +4143+04449 Asia/Tbilisi
+GF +0456-05220 America/Cayenne
+GH +0533-00013 Africa/Accra
+GI +3608-00521 Europe/Gibraltar
+GL +6411-05144 America/Godthab most locations
+GL +7646-01840 America/Danmarkshavn east coast, north of Scoresbysund
+GL +7030-02215 America/Scoresbysund Scoresbysund / Ittoqqortoormiit
+GL +7634-06847 America/Thule Thule / Pituffik
+GM +1328-01639 Africa/Banjul
+GN +0931-01343 Africa/Conakry
+GP +1614-06132 America/Guadeloupe
+GQ +0345+00847 Africa/Malabo
+GR +3758+02343 Europe/Athens
+GS -5416-03632 Atlantic/South_Georgia
+GT +1438-09031 America/Guatemala
+GU +1328+14445 Pacific/Guam
+GW +1151-01535 Africa/Bissau
+GY +0648-05810 America/Guyana
+HK +2217+11409 Asia/Hong_Kong
+HN +1406-08713 America/Tegucigalpa
+HR +4548+01558 Europe/Zagreb
+HT +1832-07220 America/Port-au-Prince
+HU +4730+01905 Europe/Budapest
+ID -0610+10648 Asia/Jakarta Java & Sumatra
+ID -0002+10920 Asia/Pontianak west & central Borneo
+ID -0507+11924 Asia/Makassar east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor
+ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas
+IE +5320-00615 Europe/Dublin
+IL +3146+03514 Asia/Jerusalem
+IN +2232+08822 Asia/Calcutta
+IO -0720+07225 Indian/Chagos
+IQ +3321+04425 Asia/Baghdad
+IR +3540+05126 Asia/Tehran
+IS +6409-02151 Atlantic/Reykjavik
+IT +4154+01229 Europe/Rome
+JM +1800-07648 America/Jamaica
+JO +3157+03556 Asia/Amman
+JP +353916+1394441 Asia/Tokyo
+KE -0117+03649 Africa/Nairobi
+KG +4254+07436 Asia/Bishkek
+KH +1133+10455 Asia/Phnom_Penh
+KI +0125+17300 Pacific/Tarawa Gilbert Islands
+KI -0308-17105 Pacific/Enderbury Phoenix Islands
+KI +0152-15720 Pacific/Kiritimati Line Islands
+KM -1141+04316 Indian/Comoro
+KN +1718-06243 America/St_Kitts
+KP +3901+12545 Asia/Pyongyang
+KR +3733+12658 Asia/Seoul
+KW +2920+04759 Asia/Kuwait
+KY +1918-08123 America/Cayman
+KZ +4315+07657 Asia/Almaty most locations
+KZ +4448+06528 Asia/Qyzylorda Qyzylorda (Kyzylorda, Kzyl-Orda)
+KZ +5017+05710 Asia/Aqtobe Aqtobe (Aktobe)
+KZ +4431+05016 Asia/Aqtau Atyrau (Atirau, Gur'yev), Mangghystau (Mankistau)
+KZ +5113+05121 Asia/Oral West Kazakhstan
+LA +1758+10236 Asia/Vientiane
+LB +3353+03530 Asia/Beirut
+LC +1401-06100 America/St_Lucia
+LI +4709+00931 Europe/Vaduz
+LK +0656+07951 Asia/Colombo
+LR +0618-01047 Africa/Monrovia
+LS -2928+02730 Africa/Maseru
+LT +5441+02519 Europe/Vilnius
+LU +4936+00609 Europe/Luxembourg
+LV +5657+02406 Europe/Riga
+LY +3254+01311 Africa/Tripoli
+MA +3339-00735 Africa/Casablanca
+MC +4342+00723 Europe/Monaco
+MD +4700+02850 Europe/Chisinau
+MG -1855+04731 Indian/Antananarivo
+MH +0709+17112 Pacific/Majuro most locations
+MH +0905+16720 Pacific/Kwajalein Kwajalein
+MK +4159+02126 Europe/Skopje
+ML +1239-00800 Africa/Bamako southwest Mali
+ML +1446-00301 Africa/Timbuktu northeast Mali
+MM +1647+09610 Asia/Rangoon
+MN +4755+10653 Asia/Ulaanbaatar most locations
+MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
+MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar
+MO +2214+11335 Asia/Macau
+MP +1512+14545 Pacific/Saipan
+MQ +1436-06105 America/Martinique
+MR +1806-01557 Africa/Nouakchott
+MS +1644-06213 America/Montserrat
+MT +3554+01431 Europe/Malta
+MU -2010+05730 Indian/Mauritius
+MV +0410+07330 Indian/Maldives
+MW -1547+03500 Africa/Blantyre
+MX +1924-09909 America/Mexico_City Central Time - most locations
+MX +2105-08646 America/Cancun Central Time - Quintana Roo
+MX +2058-08937 America/Merida Central Time - Campeche, Yucatan
+MX +2540-10019 America/Monterrey Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas
+MX +2313-10625 America/Mazatlan Mountain Time - S Baja, Nayarit, Sinaloa
+MX +2838-10605 America/Chihuahua Mountain Time - Chihuahua
+MX +2904-11058 America/Hermosillo Mountain Standard Time - Sonora
+MX +3232-11701 America/Tijuana Pacific Time
+MY +0310+10142 Asia/Kuala_Lumpur peninsular Malaysia
+MY +0133+11020 Asia/Kuching Sabah & Sarawak
+MZ -2558+03235 Africa/Maputo
+NA -2234+01706 Africa/Windhoek
+NC -2216+16530 Pacific/Noumea
+NE +1331+00207 Africa/Niamey
+NF -2903+16758 Pacific/Norfolk
+NG +0627+00324 Africa/Lagos
+NI +1209-08617 America/Managua
+NL +5222+00454 Europe/Amsterdam
+NO +5955+01045 Europe/Oslo
+NP +2743+08519 Asia/Katmandu
+NR -0031+16655 Pacific/Nauru
+NU -1901+16955 Pacific/Niue
+NZ -3652+17446 Pacific/Auckland most locations
+NZ -4357-17633 Pacific/Chatham Chatham Islands
+OM +2336+05835 Asia/Muscat
+PA +0858-07932 America/Panama
+PE -1203-07703 America/Lima
+PF -1732-14934 Pacific/Tahiti Society Islands
+PF -0900-13930 Pacific/Marquesas Marquesas Islands
+PF -2308-13457 Pacific/Gambier Gambier Islands
+PG -0930+14710 Pacific/Port_Moresby
+PH +1435+12100 Asia/Manila
+PK +2452+06703 Asia/Karachi
+PL +5215+02100 Europe/Warsaw
+PM +4703-05620 America/Miquelon
+PN -2504-13005 Pacific/Pitcairn
+PR +182806-0660622 America/Puerto_Rico
+PS +3130+03428 Asia/Gaza
+PT +3843-00908 Europe/Lisbon mainland
+PT +3238-01654 Atlantic/Madeira Madeira Islands
+PT +3744-02540 Atlantic/Azores Azores
+PW +0720+13429 Pacific/Palau
+PY -2516-05740 America/Asuncion
+QA +2517+05132 Asia/Qatar
+RE -2052+05528 Indian/Reunion
+RO +4426+02606 Europe/Bucharest
+RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
+RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
+RU +5312+05009 Europe/Samara Moscow+01 - Caspian Sea
+RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
+RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
+RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
+RU +5601+09250 Asia/Krasnoyarsk Moscow+04 - Yenisei River
+RU +5216+10420 Asia/Irkutsk Moscow+05 - Lake Baikal
+RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
+RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
+RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
+RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
+RU +5301+15839 Asia/Kamchatka Moscow+09 - Kamchatka
+RU +6445+17729 Asia/Anadyr Moscow+10 - Bering Sea
+RW -0157+03004 Africa/Kigali
+SA +2438+04643 Asia/Riyadh
+SB -0932+16012 Pacific/Guadalcanal
+SC -0440+05528 Indian/Mahe
+SD +1536+03232 Africa/Khartoum
+SE +5920+01803 Europe/Stockholm
+SG +0117+10351 Asia/Singapore
+SH -1555-00542 Atlantic/St_Helena
+SI +4603+01431 Europe/Ljubljana
+SJ +7800+01600 Arctic/Longyearbyen Svalbard
+SJ +7059-00805 Atlantic/Jan_Mayen Jan Mayen
+SK +4809+01707 Europe/Bratislava
+SL +0830-01315 Africa/Freetown
+SM +4355+01228 Europe/San_Marino
+SN +1440-01726 Africa/Dakar
+SO +0204+04522 Africa/Mogadishu
+SR +0550-05510 America/Paramaribo
+ST +0020+00644 Africa/Sao_Tome
+SV +1342-08912 America/El_Salvador
+SY +3330+03618 Asia/Damascus
+SZ -2618+03106 Africa/Mbabane
+TC +2128-07108 America/Grand_Turk
+TD +1207+01503 Africa/Ndjamena
+TF -492110+0701303 Indian/Kerguelen
+TG +0608+00113 Africa/Lome
+TH +1345+10031 Asia/Bangkok
+TJ +3835+06848 Asia/Dushanbe
+TK -0922-17114 Pacific/Fakaofo
+TL -0833+12535 Asia/Dili
+TM +3757+05823 Asia/Ashgabat
+TN +3648+01011 Africa/Tunis
+TO -2110+17510 Pacific/Tongatapu
+TR +4101+02858 Europe/Istanbul
+TT +1039-06131 America/Port_of_Spain
+TV -0831+17913 Pacific/Funafuti
+TW +2503+12130 Asia/Taipei
+TZ -0648+03917 Africa/Dar_es_Salaam
+UA +5026+03031 Europe/Kiev most locations
+UA +4837+02218 Europe/Uzhgorod Ruthenia
+UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk
+UA +4457+03406 Europe/Simferopol central Crimea
+UG +0019+03225 Africa/Kampala
+UM +1700-16830 Pacific/Johnston Johnston Atoll
+UM +2813-17722 Pacific/Midway Midway Islands
+UM +1917+16637 Pacific/Wake Wake Island
+US +404251-0740023 America/New_York Eastern Time
+US +421953-0830245 America/Detroit Eastern Time - Michigan - most locations
+US +381515-0854534 America/Louisville Eastern Time - Kentucky - Louisville area
+US +364947-0845057 America/Kentucky/Monticello Eastern Time - Kentucky - Wayne County
+US +394606-0860929 America/Indianapolis Eastern Standard Time - Indiana - most locations
+US +382232-0862041 America/Indiana/Marengo Eastern Standard Time - Indiana - Crawford County
+US +411745-0863730 America/Indiana/Knox Eastern Standard Time - Indiana - Starke County
+US +384452-0850402 America/Indiana/Vevay Eastern Standard Time - Indiana - Switzerland County
+US +415100-0873900 America/Chicago Central Time
+US +450628-0873651 America/Menominee Central Time - Michigan - Wisconsin border
+US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
+US +394421-1045903 America/Denver Mountain Time
+US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon
+US +364708-1084111 America/Shiprock Mountain Time - Navajo
+US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona
+US +340308-1181434 America/Los_Angeles Pacific Time
+US +611305-1495401 America/Anchorage Alaska Time
+US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle
+US +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
+US +643004-1652423 America/Nome Alaska Time - west Alaska
+US +515248-1763929 America/Adak Aleutian Islands
+US +211825-1575130 Pacific/Honolulu Hawaii
+UY -3453-05611 America/Montevideo
+UZ +3940+06648 Asia/Samarkand west Uzbekistan
+UZ +4120+06918 Asia/Tashkent east Uzbekistan
+VA +4154+01227 Europe/Vatican
+VC +1309-06114 America/St_Vincent
+VE +1030-06656 America/Caracas
+VG +1827-06437 America/Tortola
+VI +1821-06456 America/St_Thomas
+VN +1045+10640 Asia/Saigon
+VU -1740+16825 Pacific/Efate
+WF -1318-17610 Pacific/Wallis
+WS -1350-17144 Pacific/Apia
+YE +1245+04512 Asia/Aden
+YT -1247+04514 Indian/Mayotte
+ZA -2615+02800 Africa/Johannesburg
+ZM -1525+02817 Africa/Lusaka
+ZW -1750+03103 Africa/Harare
diff --git a/kworldwatch/zoneclock.cpp b/kworldwatch/zoneclock.cpp
new file mode 100644
index 0000000..7b15fbc
--- /dev/null
+++ b/kworldwatch/zoneclock.cpp
@@ -0,0 +1,287 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#include "config.h"
+
+#include <stdlib.h>
+#include <time.h>
+
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qdatetime.h>
+#include <qtimer.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qpopupmenu.h>
+
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kconfig.h>
+
+
+#include "flow.h"
+#include "clock.h"
+#include "cities.h"
+#include "zoneclock.moc"
+#include <kdebug.h>
+
+ZoneClock::ZoneClock(const QString &zone, const QString &name, QWidget *parent, const char *n)
+ : QFrame(parent, n), _zone(zone), _name(name)
+{
+ setFrameStyle(QFrame::Panel | QFrame::Raised);
+ QHBoxLayout *hbox = new QHBoxLayout(this, 2,2);
+
+ _name.append(":");
+ _nameLabel = new QLabel(_name, this);
+ hbox->addWidget(_nameLabel, 1);
+ hbox->addSpacing(4);
+
+ _timeLabel = new QLabel(this);
+ hbox->addWidget(_timeLabel, 0, Qt::AlignRight);
+
+ _popup = new QPopupMenu(this);
+ _popup->insertItem(i18n("&Edit..."), this, SLOT(editClock()));
+ _popup->insertItem(i18n("&Add..."), this, SLOT(slotAddClock()));
+ _popup->insertItem(i18n("&Remove"), this, SLOT(slotRemoveClock()));
+
+ _nameLabel->installEventFilter(this);
+ _timeLabel->installEventFilter(this);
+
+ updateTime();
+}
+
+
+void ZoneClock::slotRemoveClock()
+{
+ // Note: this is stupid, but we can't get us deleted
+ // from this slot, as we would return and crash.
+ // So instead we fire up an idle event triggering the delete
+ // after the return.
+
+ QTimer::singleShot(0, this, SLOT(removeTimeout()));
+}
+
+
+void ZoneClock::removeTimeout()
+{
+ emit removeMe(this);
+}
+
+
+void ZoneClock::slotAddClock()
+{
+ emit addClock(_zone);
+}
+
+
+void ZoneClock::editClock()
+{
+ ClockDialog *_dlg = new ClockDialog(this, 0, true);
+ CityList cities;
+ QStringList timezones = cities.timezones();
+ for (QStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
+ _dlg->ClockZone->insertItem(i18n((*it).utf8()));
+
+ _dlg->ClockCaption->setText(_nameLabel->text().left(_nameLabel->text().length()-1));
+ for (int i=0; i<_dlg->ClockZone->count(); ++i)
+ if (_dlg->ClockZone->text(i) == i18n(_zone.utf8()))
+ {
+ _dlg->ClockZone->setCurrentItem(i);
+ break;
+ }
+
+ if (_dlg->exec() == QDialog::Accepted)
+ {
+ _zone = timezones[_dlg->ClockZone->currentItem()];
+ _name = _dlg->ClockCaption->text().append(":");
+ _nameLabel->setText(_dlg->ClockCaption->text().append(":"));
+ updateTime();
+ layout()->invalidate();
+ emit changed();
+ }
+
+ delete _dlg;
+}
+
+
+bool ZoneClock::eventFilter(QObject *obj, QEvent *ev)
+{
+ if (ev->type() == QEvent::MouseButtonPress)
+ {
+ QMouseEvent *e = (QMouseEvent*)ev;
+ if (e->button() == QMouseEvent::RightButton)
+ _popup->exec(e->globalPos());
+ }
+
+ return QFrame::eventFilter(obj, ev);
+}
+
+
+void ZoneClock::updateTime()
+{
+ char *initial_TZ = getenv("TZ");
+ setenv("TZ", _zone.latin1(), 1);
+ tzset();
+
+ time_t t = time(NULL);
+ QDateTime dt;
+ dt.setTime_t(t);
+ _timeLabel->setText(QString("%1, %2").arg(KGlobal::locale()->formatTime(dt.time(), true)).arg(KGlobal::locale()->formatDate(dt.date(), true)));
+
+ if (initial_TZ != 0)
+ setenv("TZ", initial_TZ, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+}
+
+
+ZoneClockPanel::ZoneClockPanel(QWidget *parent, const char *name)
+ : QFrame(parent, name), _dlg(0)
+{
+ _flow = new SimpleFlow(this,1,1);
+
+ QTimer *t = new QTimer(this);
+
+ connect(t, SIGNAL(timeout()), this, SLOT(updateTimer()));
+ t->start(500);
+
+ _clocks.setAutoDelete(true);
+}
+
+
+void ZoneClockPanel::createDialog()
+{
+ if (!_dlg)
+ {
+ _dlg = new ClockDialog(this, 0, true);
+ CityList cities;
+ QStringList timezones = cities.timezones();
+ for (QStringList::iterator it = timezones.begin(); it != timezones.end(); ++it)
+ _dlg->ClockZone->insertItem(i18n((*it).utf8()));
+ }
+}
+
+
+void ZoneClockPanel::addClock(const QString &zone, const QString &name)
+{
+ // add the clocks
+ ZoneClock *zc = new ZoneClock(zone, name, this);
+ _flow->add(zc);
+ _clocks.append(zc);
+ zc->show();
+
+ realign();
+
+ connect(zc, SIGNAL(addClock(const QString &)), this, SLOT(addClock(const QString &)));
+ connect(zc, SIGNAL(changed()), this, SLOT(realign()));
+ connect(zc, SIGNAL(removeMe(ZoneClock *)), this, SLOT(removeClock(ZoneClock *)));
+}
+
+
+void ZoneClockPanel::removeClock(ZoneClock *clock)
+{
+ _clocks.remove(clock);
+ realign();
+}
+
+
+void ZoneClockPanel::realign()
+{
+ // realign the labels
+ int w = 0;
+ QPtrListIterator<ZoneClock> it(_clocks);
+ for ( ; it.current(); ++it)
+ if (it.current()->sizeHint().width() > w)
+ w = it.current()->sizeHint().width();
+ it.toFirst();
+ for ( ; it.current(); ++it)
+ it.current()->setFixedWidth(w);
+}
+
+
+void ZoneClockPanel::updateTimer()
+{
+ QPtrListIterator<ZoneClock> it(_clocks);
+ for ( ; it.current(); ++it)
+ it.current()->updateTime();
+}
+
+void ZoneClockPanel::addClock(const QString &zone)
+{
+ createDialog();
+
+ _dlg->ClockCaption->setText(i18n(zone.utf8()).section('/', -1));
+ for (int i=0; i<_dlg->ClockZone->count(); ++i)
+ if (_dlg->ClockZone->text(i) == i18n(zone.utf8()))
+ {
+ _dlg->ClockZone->setCurrentItem(i);
+ break;
+ }
+
+ if (_dlg->exec() == QDialog::Accepted)
+ {
+ CityList cities;
+ QStringList timezones = cities.timezones();
+ QString newzone = timezones[_dlg->ClockZone->currentItem()];
+ addClock(newzone, _dlg->ClockCaption->text());
+ update();
+ }
+}
+
+
+void ZoneClockPanel::save(KConfig *config)
+{
+ config->writeEntry("Clocks", _clocks.count());
+
+ QPtrListIterator<ZoneClock> it(_clocks);
+ int cnt=0;
+ for ( ; it.current(); ++it)
+ {
+ QString n = it.current()->name();
+ n = n.left(n.length()-1);
+ config->writeEntry(QString("Clock_%1_Name").arg(cnt), n);
+ config->writeEntry(QString("Clock_%1_Zone").arg(cnt), it.current()->zone());
+ cnt++;
+ }
+}
+
+
+void ZoneClockPanel::load(KConfig *config)
+{
+ _clocks.clear();
+
+ int num = config->readNumEntry("Clocks", 0);
+
+ for (int i=0; i<num; ++i)
+ {
+ addClock(config->readEntry(QString("Clock_%1_Zone").arg(i)), config->readEntry(QString("Clock_%1_Name").arg(i)));
+ }
+}
+
diff --git a/kworldwatch/zoneclock.h b/kworldwatch/zoneclock.h
new file mode 100644
index 0000000..50a6768
--- /dev/null
+++ b/kworldwatch/zoneclock.h
@@ -0,0 +1,134 @@
+/*
+**
+** Copyright (C) 1998-2001 by Matthias Hölzer-Klüpfel <hoelzer@kde.org>
+** Maintainence has ceased - send questions to kde-devel@kde.org.
+**
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to kde-devel@kde.org
+*/
+#ifndef ZONECLOCK_H
+#define ZONECLOCK_H
+
+
+#include <qwidget.h>
+#include <qstring.h>
+#include <qframe.h>
+#include <qptrlist.h>
+
+
+class QLabel;
+class SimpleFlow;
+class KConfig;
+
+
+class ClockDialog;
+
+
+class ZoneClock : public QFrame
+{
+ Q_OBJECT
+
+public:
+
+ ZoneClock(const QString &zone, const QString &name, QWidget *parent=0, const char *n=0);
+
+
+ QString zone() const { return _zone; };
+ void setZone(const QString &z) { _zone = z; updateTime(); };
+
+ QString name() const { return _name; };
+ void setName( const QString &n) { _name = n; updateTime(); };
+
+
+signals:
+
+ void removeMe(ZoneClock *t);
+ void addClock(const QString &zone);
+ void changed();
+
+
+public slots:
+
+ void updateTime();
+
+
+protected:
+
+ virtual bool eventFilter(QObject *, QEvent *);
+
+
+private slots:
+
+ void editClock();
+ void slotRemoveClock();
+ void removeTimeout();
+ void slotAddClock();
+
+
+private:
+
+ QString _zone;
+ QString _name;
+ QLabel *_timeLabel, *_nameLabel;
+ QPopupMenu *_popup;
+
+};
+
+
+class ZoneClockPanel : public QFrame
+{
+ Q_OBJECT
+
+public:
+
+ ZoneClockPanel(QWidget *parent=0, const char *name=0);
+
+ void addClock(const QString &zone, const QString &name);
+
+ void save(KConfig *config);
+ void load(KConfig *config);
+
+
+public slots:
+
+ void addClock(const QString &zone);
+
+
+private slots:
+
+ void updateTimer();
+ void realign();
+ void removeClock(ZoneClock *);
+
+
+private:
+
+ void createDialog();
+
+ SimpleFlow *_flow;
+ QPtrList<ZoneClock> _clocks;
+ ClockDialog *_dlg;
+
+};
+
+
+#endif