diff options
Diffstat (limited to 'kcontrol/clock')
-rw-r--r-- | kcontrol/clock/Makefile.am | 15 | ||||
-rw-r--r-- | kcontrol/clock/clock.desktop | 250 | ||||
-rw-r--r-- | kcontrol/clock/dtime.cpp | 449 | ||||
-rw-r--r-- | kcontrol/clock/dtime.h | 125 | ||||
-rw-r--r-- | kcontrol/clock/main.cpp | 95 | ||||
-rw-r--r-- | kcontrol/clock/main.h | 47 | ||||
-rw-r--r-- | kcontrol/clock/tzone.cpp | 200 | ||||
-rw-r--r-- | kcontrol/clock/tzone.h | 55 | ||||
-rw-r--r-- | kcontrol/clock/xpm/kcmclock.xpm | 47 | ||||
-rw-r--r-- | kcontrol/clock/xpm/world.xpm | 190 |
10 files changed, 1473 insertions, 0 deletions
diff --git a/kcontrol/clock/Makefile.am b/kcontrol/clock/Makefile.am new file mode 100644 index 000000000..0348e5878 --- /dev/null +++ b/kcontrol/clock/Makefile.am @@ -0,0 +1,15 @@ +kde_module_LTLIBRARIES = kcm_clock.la + +kcm_clock_la_SOURCES = dtime.cpp tzone.cpp main.cpp + +kcm_clock_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_clock_la_LIBADD = $(LIB_KIO) + +AM_CPPFLAGS = $(all_includes) + +METASOURCES = AUTO + +messages: + $(XGETTEXT) $(kcm_clock_la_SOURCES) -o $(podir)/kcmkclock.pot + +xdg_apps_DATA = clock.desktop diff --git a/kcontrol/clock/clock.desktop b/kcontrol/clock/clock.desktop new file mode 100644 index 000000000..1c3fc755a --- /dev/null +++ b/kcontrol/clock/clock.desktop @@ -0,0 +1,250 @@ +[Desktop Entry] +Type=Application +Exec=kcmshell kde-clock.desktop +Icon=date +DocPath=kcontrol/clock/index.html + + +X-KDE-Library=clock +X-KDE-RootOnly=true +X-KDE-SubstituteUID=true +X-KDE-ParentApp=kcontrol + +Name=Date & Time +Name[af]=Datum & Tyd +Name[ar]=التاريخ و الوقت +Name[az]=Tarix və Saat +Name[be]=Дата і час +Name[bg]=Дата и час +Name[bn]=তারিখ এবং সময় +Name[br]=Deiziad hag eur +Name[bs]=Datum i vrijeme +Name[ca]=Dia i hora +Name[cs]=Datum a čas +Name[csb]=Datum ë czas +Name[cy]=Dyddiad ac Amser +Name[da]=Dato og tid +Name[de]=Datum & Zeit +Name[el]=Ημερομηνία & Ώρα +Name[eo]=Dato kaj Tempo +Name[es]=Fecha y hora +Name[et]=Kuupäev ja kellaaeg +Name[eu]=Data eta ordua +Name[fa]=تاریخ و زمان +Name[fi]=Päivämäärä ja aika +Name[fo]=Dato og tíð +Name[fr]=Date et heure +Name[fy]=Datum en Tiid +Name[ga]=Dáta agus Am +Name[gl]=Data e Hora +Name[he]=תאריך ושעה +Name[hi]=तिथि व समय +Name[hr]=Datum i vrijeme +Name[hu]=Dátum és idő +Name[id]=Tanggal & Waktu +Name[is]=Dagssetning og tími +Name[it]=Data e ora +Name[ja]=日付と時間 +Name[ka]=თარიღი და დრო +Name[kk]=Күн мен уақыт +Name[km]=កាលបរិច្ឆេទ & ពេលវេលា +Name[ko]=날짜와 시간 +Name[lo]=ວັນແລະເວລາ +Name[lt]=Data ir laikas +Name[lv]=Datums un Laiks +Name[mk]=Датум и време +Name[mn]=Огноо & Цаг +Name[ms]=Tarikh & Masa +Name[mt]=Data u Ħin +Name[nb]=Dato og klokkeslett +Name[nds]=Datum & Tiet +Name[ne]=मिति र समय +Name[nl]=Datum en Tijd +Name[nn]=Dato og Tid +Name[nso]=Tsatsikgwedi & Nako +Name[oc]=Dia e ora +Name[pa]=ਮਿਤੀ ਅਤੇ ਸਮਾਂ +Name[pl]=Data i czas +Name[pt]=Data e Hora +Name[pt_BR]=Data & Hora +Name[ro]=Data și timpul +Name[ru]=Дата и время +Name[rw]=Itariki & Igihe +Name[se]=Dáhton ja áigi +Name[sk]=Dátum a čas +Name[sl]=Datum in čas +Name[sr]=Датум и време +Name[sr@Latn]=Datum i vreme +Name[ss]=Lisuku & sikhatsi +Name[sv]=Datum och tid +Name[ta]=தேதி & நேரம் +Name[te]=తేది & సమయం +Name[tg]=Таърих ва вақт +Name[th]=วันและเวลา +Name[tr]=Tarih ve Saat +Name[tt]=Waqıt & Zaman +Name[uk]=Дата і час +Name[uz]=Sana va vaqt +Name[uz@cyrillic]=Сана ва вақт +Name[ven]=Datumu & Tshifhinga +Name[vi]=Ngày & Giờ +Name[wa]=Date et eure +Name[xh]=Umhla & Ixesha +Name[zh_CN]=日期和时间 +Name[zh_TW]=日期和時間 +Name[zu]=Usuku & Isikhathi + +Comment=Date and time settings +Comment[af]=Datum en tyd instellings +Comment[ar]=تعيينات التاريخ و الوقت +Comment[az]=Tarix və saat qurğuları +Comment[be]=Настаўленне даты і часу +Comment[bg]=Настройване на датата и часа +Comment[bn]=তারিখ এবং সময় সেটিংস +Comment[br]=Kefluniañ an deiziad hag an eur +Comment[bs]=Podesite datum i vrijeme +Comment[ca]=Arranjament del dia i l'hora +Comment[cs]=Nastavení data a času +Comment[csb]=Ùstôw datuma ë czasu +Comment[cy]=Gosodiadau dyddiad ac amser +Comment[da]=Dato- og tidsindstillinger +Comment[de]=Einstellungen für Datum und Zeit +Comment[el]=Ρυθμίσεις ημερομηνίας και ώρας +Comment[eo]=Agordo de dato kaj tempo +Comment[es]=Preferencias sobre la fecha y hora +Comment[et]=Kuupäeva ja kellaaja seadistused +Comment[eu]=Data eta orduaren konfigurazioa +Comment[fa]=تنظیمات تاریخ و زمان +Comment[fi]=Päiväyksen ja ajan asetukset +Comment[fo]=Seta urið +Comment[fr]=Configuration de la date et de l'heure +Comment[fy]=Ynstelle fan datum en tiid +Comment[ga]=Socruithe dáta/ama +Comment[gl]=Configuración da data e a hora +Comment[he]=שינוי הגדרות התאריך והשעה +Comment[hi]=तारीख़ तथा समय का विन्यास +Comment[hr]=Postavke datuma i vremena +Comment[hu]=A dátum és az idő beállításai +Comment[id]=Seting tanggal dan waktu +Comment[is]=Stillingar dagssetningar og klukku +Comment[it]=Impostazione della data e dell'ora +Comment[ja]=日付と時間の設定 +Comment[ka]=თარიღისა და დროის კონფიგურაცია +Comment[kk]=Күн мен уақытты орнату +Comment[km]=ការកំណត់កាលបរិច្ឆេទ និងពេលវេលា +Comment[ko]=날짜와 시간 설정 +Comment[lo]=ຕັ້ງຄ່າວັນແລະເວລາ +Comment[lt]=Datos ir laiko parametrai +Comment[lv]=Datuma un laika parametri +Comment[mk]=Поставувања на датум и време +Comment[mn]=Огноо ба цаг тохируулах +Comment[ms]=Seting tarikh & Masa +Comment[mt]=Konfigurazzjoni tad-data u l-ħin +Comment[nb]=Innstilling av dato og klokkeslett +Comment[nds]=Instellen vun Datum un Tiet +Comment[ne]=मिति र समय सेटिङ +Comment[nl]=Instellen van datum en tijd +Comment[nn]=Innstilling av dato og klokkeslett +Comment[nso]=Dipeakanyo tsa tsatsikgwedi le nako +Comment[oc]=Configuracion dèu dia e l'ora +Comment[pa]=ਮਿਤੀ ਅਤੇ ਸਮਾਂ ਸੈਟਿੰਗ +Comment[pl]=Ustawienia daty i czasu +Comment[pt]=Configuração da data e hora +Comment[pt_BR]=Configurações de data e hora +Comment[ro]=Configurează data și ora sistemului +Comment[ru]=Настройка даты и времени +Comment[rw]=Amagenamiterere y'itariki n'igihe +Comment[se]=Dáhton- ja áigeheivehusat +Comment[sk]=Nastavenia dátumu a času +Comment[sl]=Nastavitve datuma in časa +Comment[sr]=Поставке за датум и време +Comment[sr@Latn]=Postavke za datum i vreme +Comment[ss]=Kuhleleka kwelilanga kanye nesikhatsi +Comment[sv]=Anpassa datum och tid +Comment[ta]=தேதி மற்றும் நேர அமைப்புகள் +Comment[te]=తేది మరయూ సమయం అమరికలు +Comment[tg]=Танзимоти таърих ва вақт +Comment[th]=ตั้งค่าวันและเวลา +Comment[tr]=Tarih ve saat ayarları +Comment[tt]=Waqıt-zaman caylaw +Comment[uk]=Налаштування дати і часу +Comment[uz]=Sana va vaqtning moslamalari +Comment[uz@cyrillic]=Сана ва вақтнинг мосламалари +Comment[ven]=Mavhekanyele a datumu na tshifhinga +Comment[vi]=Thiết lập ngày giờ +Comment[wa]=Apontiaedjes del date et l' eure +Comment[xh]=Izicwangciso zomhla kunye nexesha +Comment[zh_CN]=日期和时间设置 +Comment[zh_TW]=日期和時間設定值 +Comment[zu]=Izilungiso Zosuku kanye nesikhathi + +Keywords=clock,date,time,time zone +Keywords[af]=horlosie,date,time,time zone,datum,tyd,tyd sone +Keywords[ar]=الساعة,التاريخ,الوقت,المنطقة الزمنية +Keywords[az]=tarix,saat,saat zolağı,zaman zolağı, vaxt, vaxt zolağı +Keywords[be]=гадзіннік,дата,час,часавая зона,часавы пояс,clock,date,time,time zone +Keywords[bg]=дата, час, време, часови, пояс, clock, date, time, time zone +Keywords[br]=eurier,deiziad,amzer,takad-eur +Keywords[bs]=sat,datum,vrijeme,date,time,clock +Keywords[ca]=rellotge,data,hora,zona horària +Keywords[cs]=Datum,Čas,Časová zóna +Keywords[csb]=zédżer,datum,czas,czasowô cona +Keywords[cy]=cloc,dyddiad,amser,cylchfa amser +Keywords[da]=ur,dato,tid,tidszone +Keywords[de]=uhr,datum,zeit,zeitzone +Keywords[el]=ρολόι,ημερομηνία,ώρα,ζώνη ώρας +Keywords[eo]=horloĝo,dato,tempo,tempozono +Keywords[es]=reloj,fecha,hora,zona horaria +Keywords[et]=kell,kuupäev,kellaaeg,ajavöönd +Keywords[eu]=erlojua,data,ordua,ordu eremua +Keywords[fa]=ساعت، تاریخ، زمان، ناحیۀ زمان +Keywords[fi]=kello,päiväys,aika,aikavyöhyke +Keywords[fr]=horloge,date,heure,fuseau horaire +Keywords[fy]=datum,tiid,tiidszone,klok +Keywords[ga]=clog,dáta,am,crios ama +Keywords[gl]=data,reloxo,hora,zona horária +Keywords[he]=clock,date,time,time zoneשעון,תאריך,זמן,אזור זמן +Keywords[hi]=घड़ी,तारीख़,समय,समय क्षेत्र (टाइम ज़ोन) +Keywords[hr]=clock,date,time,time zone,datum,vrijeme,vremenska zona +Keywords[hu]=óra,dátum,idő,időzóna +Keywords[id]=jam,tanggal,waktu,zona waktu +Keywords[is]=dagssetning,klukka,tími +Keywords[it]=data,ora,fuso orario,orologio +Keywords[ja]=時刻,日付,時間,タイムゾーン +Keywords[ka]=საათი, თარიღი, დრო, დროიტი სარტყელი +Keywords[km]=នាឡិកា,កាលបរិច្ឆេទ,ពេលវេលា,តំបន់ពេលវេលា +Keywords[lt]=laikrodis,data,laikas,laiko juosta +Keywords[lv]=pulkstenis,datums,laiks,laika zona +Keywords[mk]=часовник,датум,време,временска зона +Keywords[mn]=цаг,огноо,хугацаа,цагийн бүс +Keywords[ms]=jam,tarikh,masa,zon masa +Keywords[nb]=klokke,dato,tid,tidssone +Keywords[nds]=Klock,Datum,Tiet,Tietzone,Tietrebeet +Keywords[ne]=घडी, मिति, समय, टाइमजोन +Keywords[nl]=datum,tijd,tijdszone,klok +Keywords[nn]=klokke,dato,tid,tidssone +Keywords[pa]=clock,date,time,time zone,ਘੜੀ,ਸਮਾਂ,ਸਮਾਂ ਖੇਤਰ +Keywords[pl]=zegar, data, czas, strefa czasowa +Keywords[pt]=relógio,data,hora,fuso horário +Keywords[pt_BR]=relógio,data,hora,fuso horário +Keywords[ro]=ceas,dată,timp,ora,zona de timp +Keywords[rw]=Isaha,itariki,igihe,igihe fatizo +Keywords[se]=diibmu,dáhton,áigi,áigeavádat +Keywords[sk]=dátum,čas,časová zóna,hodiny +Keywords[sl]=datum,ura,čas,časovno območje,CET,SEČ +Keywords[sr]=date,time,time zone,датум,време,временска зона,датум,време,временска зона +Keywords[sr@Latn]=date,time,time zone,datum,vreme,vremenska zona,datum,vreme,vremenska zona +Keywords[sv]=klocka,datum,tid,tidszon +Keywords[ta]=கடிகாரம்,தேதி,நேரம்,நேர பகுதி +Keywords[tg]=соат,таърих,вақт,минтақаи вақт +Keywords[th]=นาฬิกา,วัน,เวลา,พื้นที่เวลา +Keywords[tr]=tarih,saat,saat dilimi,zaman,zaman dilimi +Keywords[uk]=дата,час,часовий пояс,годинник +Keywords[uz]=soat,sana,vaqt,vaqt zonasi +Keywords[uz@cyrillic]=соат,сана,вақт,вақт зонаси +Keywords[vi]=đồng hồ,ngày,giờ,múi giờ +Keywords[wa]=ôrlodje,date,eure,coisse d' eureye +Keywords[zh_CN]=clock,date,time,time zone,时钟,日期,时间,时区 +Keywords[zh_TW]=clock,日期,時間,時區 + +Categories=Qt;KDE;X-KDE-settings-system; diff --git a/kcontrol/clock/dtime.cpp b/kcontrol/clock/dtime.cpp new file mode 100644 index 000000000..ba8330c7a --- /dev/null +++ b/kcontrol/clock/dtime.cpp @@ -0,0 +1,449 @@ +/* + * dtime.cpp + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> + +#include <qcombobox.h> +#include <qgroupbox.h> +#include <qpushbutton.h> +#include <qpainter.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qwhatsthis.h> +#include <qcheckbox.h> +#include <qregexp.h> + +#include <kdebug.h> +#include <klocale.h> +#include <kprocess.h> +#include <kmessagebox.h> +#include <kdialog.h> +#include <kconfig.h> + +#include "dtime.h" +#include "dtime.moc" + +HMSTimeWidget::HMSTimeWidget(QWidget *parent, const char *name) : + KIntSpinBox(parent, name) +{ +} + +QString HMSTimeWidget::mapValueToText(int value) +{ + QString s = QString::number(value); + if( value < 10 ) { + s = "0" + s; + } + return s; +} + +Dtime::Dtime(QWidget * parent, const char *name) + : QWidget(parent, name) +{ + // ************************************************************* + // Start Dialog + // ************************************************************* + + // Time Server + + privateLayoutWidget = new QWidget( this, "layout1" ); + QHBoxLayout *layout1 = new QHBoxLayout( privateLayoutWidget, 0, 0, "ntplayout"); + + setDateTimeAuto = new QCheckBox( privateLayoutWidget, "setDateTimeAuto" ); + setDateTimeAuto->setText(i18n("Set date and time &automatically:")); + connect(setDateTimeAuto, SIGNAL(toggled(bool)), this, SLOT(serverTimeCheck())); + connect(setDateTimeAuto, SIGNAL(toggled(bool)), SLOT(configChanged())); + layout1->addWidget( setDateTimeAuto ); + + timeServerList = new QComboBox( false, privateLayoutWidget, "timeServerList" ); + connect(timeServerList, SIGNAL(activated(int)), SLOT(configChanged())); + connect(timeServerList, SIGNAL(textChanged(const QString &)), SLOT(configChanged())); + connect(setDateTimeAuto, SIGNAL(toggled(bool)), timeServerList, SLOT(setEnabled(bool))); + timeServerList->setEnabled(false); + timeServerList->setEditable(true); + layout1->addWidget( timeServerList ); + findNTPutility(); + + // Date box + QGroupBox* dateBox = new QGroupBox( this, "dateBox" ); + + QVBoxLayout *l1 = new QVBoxLayout( dateBox, KDialog::spacingHint() ); + + cal = new KDatePicker( dateBox ); + cal->setMinimumSize(cal->sizeHint()); + l1->addWidget( cal ); + QWhatsThis::add( cal, i18n("Here you can change the system date's day of the month, month and year.") ); + + // Time frame + QGroupBox* timeBox = new QGroupBox( this, "timeBox" ); + + QVBoxLayout *v2 = new QVBoxLayout( timeBox, KDialog::spacingHint() ); + + kclock = new Kclock( timeBox, "kclock" ); + kclock->setMinimumSize(150,150); + v2->addWidget( kclock ); + + QGridLayout *v3 = new QGridLayout( v2, 2, 9 ); + + // Even if the module's widgets are reversed (usually when using RTL + // languages), the placing of the time fields must always be H:M:S, from + // left to right. + bool isRTL = QApplication::reverseLayout(); + + QSpacerItem *spacer1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + v3->addMultiCell(spacer1, 0, 1, 1, 1); + + hour = new HMSTimeWidget( timeBox ); + hour->setWrapping(true); + hour->setMaxValue(23); + hour->setValidator(new KStrictIntValidator(0, 23, hour)); + v3->addMultiCellWidget(hour, 0, 1, isRTL ? 6 : 2, isRTL ? 6 : 2 ); + + QLabel *dots1 = new QLabel(":", timeBox); + dots1->setMinimumWidth( 7 ); + dots1->setAlignment( QLabel::AlignCenter ); + v3->addMultiCellWidget(dots1, 0, 1, 3, 3 ); + + minute = new HMSTimeWidget( timeBox ); + minute->setWrapping(true); + minute->setMinValue(0); + minute->setMaxValue(59); + minute->setValidator(new KStrictIntValidator(0, 59, minute)); + v3->addMultiCellWidget(minute, 0, 1, 4, 4 ); + + QLabel *dots2 = new QLabel(":", timeBox); + dots2->setMinimumWidth( 7 ); + dots2->setAlignment( QLabel::AlignCenter ); + v3->addMultiCellWidget(dots2, 0, 1, 5, 5 ); + + second = new HMSTimeWidget( timeBox ); + second->setWrapping(true); + second->setMinValue(0); + second->setMaxValue(59); + second->setValidator(new KStrictIntValidator(0, 59, second)); + v3->addMultiCellWidget(second, 0, 1, isRTL ? 2 : 6, isRTL ? 2 : 6 ); + + v3->addColSpacing(7, 7); + + QString wtstr = i18n("Here you can change the system time. Click into the" + " hours, minutes or seconds field to change the relevant value, either" + " using the up and down buttons to the right or by entering a new value."); + QWhatsThis::add( hour, wtstr ); + QWhatsThis::add( minute, wtstr ); + QWhatsThis::add( second, wtstr ); + + QSpacerItem *spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + v3->addMultiCell(spacer3, 0, 1, 9, 9); + + QGridLayout *top = new QGridLayout( this, 2,2, KDialog::spacingHint() ); + + top->addWidget(dateBox, 1,0); + top->addWidget(timeBox, 1,1); + top->addMultiCellWidget(privateLayoutWidget, 0,0, 0,1); + + // ************************************************************* + // End Dialog + // ************************************************************* + + connect( hour, SIGNAL(valueChanged(int)), SLOT(set_time()) ); + connect( minute, SIGNAL(valueChanged(int)), SLOT(set_time()) ); + connect( second, SIGNAL(valueChanged(int)), SLOT(set_time()) ); + connect( cal, SIGNAL(dateChanged(QDate)), SLOT(changeDate(QDate))); + + connect( &internalTimer, SIGNAL(timeout()), SLOT(timeout()) ); + + load(); + + if (getuid() != 0) + { + cal->setEnabled(false); + hour->setEnabled(false); + minute->setEnabled(false); + second->setEnabled(false); + timeServerList->setEnabled(false); + setDateTimeAuto->setEnabled(false); + } + kclock->setEnabled(false); +} + +void Dtime::serverTimeCheck() { + bool enabled = !setDateTimeAuto->isChecked(); + cal->setEnabled(enabled); + hour->setEnabled(enabled); + minute->setEnabled(enabled); + second->setEnabled(enabled); + //kclock->setEnabled(enabled); +} + +void Dtime::findNTPutility(){ + KProcess proc; + proc << "which" << "ntpdate"; + proc.start(KProcess::Block); + if(proc.exitStatus() == 0) { + ntpUtility = "ntpdate"; + kdDebug() << "ntpUtility = " << ntpUtility.latin1() << endl; + return; + } + proc.clearArguments(); + proc << "which" << "rdate"; + proc.start(KProcess::Block); + if(proc.exitStatus() == 0) { + ntpUtility = "rdate"; + kdDebug() << "ntpUtility = " << ntpUtility.latin1() << endl; + return; + } + privateLayoutWidget->hide(); + kdDebug() << "ntpUtility not found!" << endl; +} + +void Dtime::set_time() +{ + if( ontimeout ) + return; + + internalTimer.stop(); + + time.setHMS( hour->value(), minute->value(), second->value() ); + kclock->setTime( time ); + + emit timeChanged( TRUE ); +} + +void Dtime::changeDate(QDate d) +{ + date = d; + emit timeChanged( TRUE ); +} + +void Dtime::configChanged(){ + emit timeChanged( TRUE ); +} + +void Dtime::load() +{ + KConfig config("kcmclockrc", true, false); + config.setGroup("NTP"); + timeServerList->insertStringList(QStringList::split(',', config.readEntry("servers", + i18n("Public Time Server (pool.ntp.org),\ +asia.pool.ntp.org,\ +europe.pool.ntp.org,\ +north-america.pool.ntp.org,\ +oceania.pool.ntp.org")))); + setDateTimeAuto->setChecked(config.readBoolEntry("enabled", false)); + + // Reset to the current date and time + time = QTime::currentTime(); + date = QDate::currentDate(); + cal->setDate(date); + + // start internal timer + internalTimer.start( 1000 ); + + timeout(); +} + +void Dtime::save() +{ + KConfig config("kcmclockrc", false, false); + config.setGroup("NTP"); + + // Save the order, but don't duplicate! + QStringList list; + if( timeServerList->count() != 0) + list.append(timeServerList->currentText()); + for ( int i=0; i<timeServerList->count();i++ ) { + QString text = timeServerList->text(i); + if( list.find(text) == list.end()) + list.append(text); + // Limit so errors can go away and not stored forever + if( list.count() == 10) + break; + } + config.writeEntry("servers", list.join(",")); + config.writeEntry("enabled", setDateTimeAuto->isChecked()); + + if(setDateTimeAuto->isChecked() && !ntpUtility.isEmpty()){ + // NTP Time setting + QString timeServer = timeServerList->currentText(); + if( timeServer.find( QRegExp(".*\\(.*\\)$") ) != -1 ) { + timeServer.replace( QRegExp(".*\\("), "" ); + timeServer.replace( QRegExp("\\).*"), "" ); + // Would this be better?: s/^.*\(([^)]*)\).*$/\1/ + } + KProcess proc; + proc << ntpUtility << timeServer; + proc.start( KProcess::Block ); + if( proc.exitStatus() != 0 ){ + KMessageBox::error( this, i18n(QString("Unable to contact time server: %1.").arg(timeServer).latin1())); + setDateTimeAuto->setChecked( false ); + } + else { + // success + kdDebug() << "Set date from time server " << timeServer.latin1() << " success!" << endl; + } + } + else { + // User time setting + KProcess c_proc; + + // BSD systems reverse year compared to Susv3 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + BufS.sprintf("%04d%02d%02d%02d%02d.%02d", + date.year(), + date.month(), date.day(), + hour->value(), minute->value(), second->value()); +#else + BufS.sprintf("%02d%02d%02d%02d%04d.%02d", + date.month(), date.day(), + hour->value(), minute->value(), + date.year(), second->value()); +#endif + + kdDebug() << "Set date " << BufS << endl; + + c_proc << "date" << BufS; + c_proc.start( KProcess::Block ); + int result = c_proc.exitStatus(); + if (result != 0 +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + && result != 2 // can only set local date, which is okay +#endif + ) { + KMessageBox::error( this, i18n("Can not set date.")); + return; + } + + // try to set hardware clock. We do not care if it fails + KProcess hwc_proc; + hwc_proc << "hwclock" << "--systohc"; + hwc_proc.start(KProcess::Block); + } + + // restart time + internalTimer.start( 1000 ); +} + +void Dtime::timeout() +{ + // get current time + time = QTime::currentTime(); + + ontimeout = TRUE; + second->setValue(time.second()); + minute->setValue(time.minute()); + hour->setValue(time.hour()); + ontimeout = FALSE; + + kclock->setTime( time ); +} + +QString Dtime::quickHelp() const +{ + return i18n("<h1>Date & Time</h1> This control module can be used to set the system date and" + " time. As these settings do not only affect you as a user, but rather the whole system, you" + " can only change these settings when you start the Control Center as root. If you do not have" + " the root password, but feel the system time should be corrected, please contact your system" + " administrator."); +} + +void Kclock::setTime(const QTime &time) +{ + this->time = time; + repaint(); +} + +void Kclock::paintEvent( QPaintEvent * ) +{ + if ( !isVisible() ) + return; + + QPainter paint; + paint.begin( this ); + + QPointArray pts; + QPoint cp = rect().center(); + int d = QMIN(width(),height()); + QColor hands = colorGroup().dark(); + QColor shadow = colorGroup().text(); + paint.setPen( shadow ); + paint.setBrush( shadow ); + paint.setViewport(4,4,width(),height()); + + for ( int c=0 ; c < 2 ; c++ ) + { + QWMatrix matrix; + matrix.translate( cp.x(), cp.y() ); + matrix.scale( d/1000.0F, d/1000.0F ); + + // lancetta delle ore + float h_angle = 30*(time.hour()%12-3) + time.minute()/2; + matrix.rotate( h_angle ); + paint.setWorldMatrix( matrix ); + pts.setPoints( 4, -20,0, 0,-20, 300,0, 0,20 ); + paint.drawPolygon( pts ); + matrix.rotate( -h_angle ); + + // lancetta dei minuti + float m_angle = (time.minute()-15)*6; + matrix.rotate( m_angle ); + paint.setWorldMatrix( matrix ); + pts.setPoints( 4, -10,0, 0,-10, 400,0, 0,10 ); + paint.drawPolygon( pts ); + matrix.rotate( -m_angle ); + + // lancetta dei secondi + float s_angle = (time.second()-15)*6; + matrix.rotate( s_angle ); + paint.setWorldMatrix( matrix ); + pts.setPoints(4,0,0,0,0,400,0,0,0); + paint.drawPolygon( pts ); + matrix.rotate( -s_angle ); + + // quadrante + for ( int i=0 ; i < 60 ; i++ ) + { + paint.setWorldMatrix( matrix ); + if ( (i % 5) == 0 ) + paint.drawLine( 450,0, 500,0 ); // draw hour lines + else paint.drawPoint( 480,0 ); // draw second lines + matrix.rotate( 6 ); + } + + paint.setPen( hands ); + paint.setBrush( hands ); + paint.setViewport(0,0,width(),height()); + } + paint.end(); +} + +QValidator::State KStrictIntValidator::validate( QString & input, int & d ) const +{ + if( input.isEmpty() ) + return Valid; + + State st = QIntValidator::validate( input, d ); + + if( st == Intermediate ) + return Invalid; + + return st; +} diff --git a/kcontrol/clock/dtime.h b/kcontrol/clock/dtime.h new file mode 100644 index 000000000..5fcbb62df --- /dev/null +++ b/kcontrol/clock/dtime.h @@ -0,0 +1,125 @@ +/* + * dtime.h + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef dtime_included +#define dtime_included + +#include <qdatetime.h> +#include <qlineedit.h> +#include <qspinbox.h> +#include <qstring.h> +#include <qtimer.h> +#include <qvalidator.h> +#include <qwidget.h> +#include <qcheckbox.h> + +#include <kdatepicker.h> +#include <knuminput.h> + +class Kclock; + +class HMSTimeWidget : public KIntSpinBox +{ + Q_OBJECT + public: + HMSTimeWidget(QWidget *parent=0, const char *name=0); + protected: + QString mapValueToText(int); +}; + +class Dtime : public QWidget +{ + Q_OBJECT + public: + Dtime( QWidget *parent=0, const char* name=0 ); + + void save(); + void load(); + + QString quickHelp() const; + +signals: + void timeChanged(bool); + + private slots: + void configChanged(); + void serverTimeCheck(); + void timeout(); + void set_time(); + void changeDate(QDate); + +private: + void findNTPutility(); + QString ntpUtility; + + QWidget* privateLayoutWidget; + QCheckBox *setDateTimeAuto; + QComboBox *timeServerList; + + KDatePicker *cal; + QComboBox *month; + QSpinBox *year; + + HMSTimeWidget *hour; + HMSTimeWidget *minute; + HMSTimeWidget *second; + + Kclock *kclock; + + QTime time; + QDate date; + QTimer internalTimer; + + QString BufS; + int BufI; + bool refresh; + bool ontimeout; +}; + +class Kclock : public QWidget +{ + Q_OBJECT + +public: + Kclock( QWidget *parent=0, const char *name=0 ) + : QWidget(parent, name) {}; + + void setTime(const QTime&); + +protected: + virtual void paintEvent( QPaintEvent *event ); + + +private: + QTime time; +}; + +class KStrictIntValidator : public QIntValidator +{ +public: + KStrictIntValidator(int bottom, int top, QWidget * parent, + const char * name = 0 ) + : QIntValidator(bottom, top, parent, name) {}; + + QValidator::State validate( QString & input, int & d ) const; +}; + +#endif // dtime_included diff --git a/kcontrol/clock/main.cpp b/kcontrol/clock/main.cpp new file mode 100644 index 000000000..8522973a1 --- /dev/null +++ b/kcontrol/clock/main.cpp @@ -0,0 +1,95 @@ +/* + * main.cpp + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include <unistd.h> + +#include <qlabel.h> +#include <qlayout.h> + +#include <dcopclient.h> + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kdialog.h> +#include <kgenericfactory.h> + +#include "main.h" +#include "main.moc" + +#include "tzone.h" +#include "dtime.h" + +typedef KGenericFactory<KclockModule, QWidget> KlockModuleFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_clock, KlockModuleFactory("kcmkclock")) + +KclockModule::KclockModule(QWidget *parent, const char *name, const QStringList &) + : KCModule(KlockModuleFactory::instance(), parent, name) +{ + KAboutData *about = + new KAboutData(I18N_NOOP("kcmclock"), I18N_NOOP("KDE Clock Control Module"), + 0, 0, KAboutData::License_GPL, + "(c) 1996 - 2001 Luca Montecchiani"); + + about->addAuthor("Luca Montecchiani", I18N_NOOP("Original author"), "m.luca@usa.net"); + about->addAuthor("Paul Campbell", I18N_NOOP("Current Maintainer"), "paul@taniwha.com"); + about->addAuthor("Benjamin Meyer", I18N_NOOP("Added NTP support"), "ben+kcmclock@meyerhome.net"); + setAboutData( about ); + setQuickHelp( i18n("<h1>Date & Time</h1> This control module can be used to set the system date and" + " time. As these settings do not only affect you as a user, but rather the whole system, you" + " can only change these settings when you start the Control Center as root. If you do not have" + " the root password, but feel the system time should be corrected, please contact your system" + " administrator.")); + + KGlobal::locale()->insertCatalogue("timezones"); // For time zone translations + + QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); + + dtime = new Dtime(this); + layout->addWidget(dtime); + connect(dtime, SIGNAL(timeChanged(bool)), this, SIGNAL(changed(bool))); + + tzone = new Tzone(this); + layout->addWidget(tzone); + connect(tzone, SIGNAL(zoneChanged(bool)), this, SIGNAL(changed(bool))); + + layout->addStretch(); + + if(getuid() == 0) + setButtons(Help|Apply); + else + setButtons(Help); +} + +void KclockModule::save() +{ +// The order here is important + dtime->save(); + tzone->save(); + + // Tell the clock applet about the change so that it can update its timezone + kapp->dcopClient()->send( "kicker", "ClockApplet", "reconfigure()", QByteArray() ); +} + +void KclockModule::load() +{ + dtime->load(); + tzone->load(); +} + diff --git a/kcontrol/clock/main.h b/kcontrol/clock/main.h new file mode 100644 index 000000000..3c57469f0 --- /dev/null +++ b/kcontrol/clock/main.h @@ -0,0 +1,47 @@ +/* + * main.h + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef main_included +#define main_included + +#include <kcmodule.h> + +class Dtime; +class Tzone; +class QTabWidget; + + +class KclockModule : public KCModule +{ + Q_OBJECT + +public: + KclockModule(QWidget *parent, const char *name, const QStringList &); + + void save(); + void load(); + +private: + QTabWidget *tab; + Tzone *tzone; + Dtime *dtime; +}; + +#endif // main_included diff --git a/kcontrol/clock/tzone.cpp b/kcontrol/clock/tzone.cpp new file mode 100644 index 000000000..fad22152a --- /dev/null +++ b/kcontrol/clock/tzone.cpp @@ -0,0 +1,200 @@ +/* + * tzone.cpp + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <time.h> +#include <config.h> + +#include <qlabel.h> +#include <qfile.h> + +#include <kdebug.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kdialog.h> +#include <kio/netaccess.h> + +//#include "xpm/world.xpm" +#include "tzone.h" +#include "tzone.moc" + +#if defined(USE_SOLARIS) +#include <ktempfile.h> +#include <kstandarddirs.h> +#include <sys/param.h> +#include <sys/types.h> +#include <sys/stat.h> +#endif + +Tzone::Tzone(QWidget * parent, const char *name) + : QVGroupBox(parent, name) +{ + setTitle(i18n("To change the timezone, select your area from the list below")); + + tzonelist = new KTimezoneWidget(this, "ComboBox_1", &m_zoneDb); + connect( tzonelist, SIGNAL(selectionChanged()), SLOT(handleZoneChange()) ); + + m_local = new QLabel(this); + + load(); + + tzonelist->setEnabled(getuid() == 0); +} + +void Tzone::load() +{ + currentZone(); + + // read the currently set time zone + tzonelist->setSelected(m_zoneDb.local()->name(), true); +} + +void Tzone::currentZone() +{ + QString localZone(i18n("Current local timezone: %1 (%2)")); + QCString result(100); + + time_t now = time(0); + tzset(); + strftime(result.data(), result.size(), "%Z", localtime(&now)); + m_local->setText(localZone.arg(KTimezoneWidget::displayName(m_zoneDb.local())).arg(result)); +} + +// FIXME: Does the logic in this routine actually work correctly? For example, +// on non-Solaris systems which do not use /etc/timezone? +void Tzone::save() +{ + QStringList selectedZones(tzonelist->selection()); + + if (selectedZones.count() > 0) + { + // Find untranslated selected zone + QString selectedzone(selectedZones[0]); + +#if defined(USE_SOLARIS) // MARCO + + KTempFile tf( locateLocal( "tmp", "kde-tzone" ) ); + tf.setAutoDelete( true ); + QTextStream *ts = tf.textStream(); + +# ifndef INITFILE +# define INITFILE "/etc/default/init" +# endif + + QFile fTimezoneFile(INITFILE); + bool updatedFile = false; + + if (tf.status() == 0 && fTimezoneFile.open(IO_ReadOnly)) + { + bool found = false; + + QTextStream is(&fTimezoneFile); + + for (QString line = is.readLine(); !line.isNull(); + line = is.readLine()) + { + if (line.find("TZ=") == 0) + { + *ts << "TZ=" << selectedzone << endl; + found = true; + } + else + { + *ts << line << endl; + } + } + + if (!found) + { + *ts << "TZ=" << selectedzone << endl; + } + + updatedFile = true; + fTimezoneFile.close(); + } + + if (updatedFile) + { + ts->device()->reset(); + fTimezoneFile.remove(); + + if (fTimezoneFile.open(IO_WriteOnly | IO_Truncate)) + { + QTextStream os(&fTimezoneFile); + + for (QString line = ts->readLine(); !line.isNull(); + line = ts->readLine()) + { + os << line << endl; + } + + fchmod(fTimezoneFile.handle(), + S_IXUSR | S_IRUSR | S_IRGRP | S_IXGRP | + S_IROTH | S_IXOTH); + fTimezoneFile.close(); + } + } + + + QString val = selectedzone; +#else + QFile fTimezoneFile("/etc/timezone"); + + if (fTimezoneFile.open(IO_WriteOnly | IO_Truncate) ) + { + QTextStream t(&fTimezoneFile); + t << selectedzone; + fTimezoneFile.close(); + } + + QString tz = "/usr/share/zoneinfo/" + selectedzone; + + kdDebug() << "Set time zone " << tz << endl; + + if (!QFile::remove("/etc/localtime")) + { + //After the KDE 3.2 release, need to add an error message + } + else + if (!KIO::NetAccess::file_copy(KURL(tz),KURL("/etc/localtime"))) + KMessageBox::error( 0, i18n("Error setting new timezone."), + i18n("Timezone Error")); + + QString val = ":" + tz; +#endif // !USE_SOLARIS + + setenv("TZ", val.ascii(), 1); + tzset(); + + } else { +#if !defined(USE_SOLARIS) // Do not update the System! + unlink( "/etc/timezone" ); + unlink( "/etc/localtime" ); + + setenv("TZ", "", 1); + tzset(); +#endif // !USE SOLARIS + } + + currentZone(); +} diff --git a/kcontrol/clock/tzone.h b/kcontrol/clock/tzone.h new file mode 100644 index 000000000..618cb10c6 --- /dev/null +++ b/kcontrol/clock/tzone.h @@ -0,0 +1,55 @@ +/* + * tzone.h + * + * Copyright (C) 1998 Luca Montecchiani <m.luca@usa.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef tzone_included +#define tzone_included + +#include <ktimezones.h> +#include <ktimezonewidget.h> +#include <qvgroupbox.h> + +class QComboBox; +class QLabel; + +class Tzone : public QVGroupBox +{ + Q_OBJECT + +public: + Tzone( QWidget *parent=0, const char* name=0 ); + + void save(); + void load(); + +signals: + void zoneChanged(bool); + +protected slots: + void handleZoneChange() {emit zoneChanged( TRUE );} + +private: + void currentZone(); + KTimezones m_zoneDb; + QLabel *m_local; + KTimezoneWidget *tzonelist; +}; + +#endif // tzone_included diff --git a/kcontrol/clock/xpm/kcmclock.xpm b/kcontrol/clock/xpm/kcmclock.xpm new file mode 100644 index 000000000..d04cee036 --- /dev/null +++ b/kcontrol/clock/xpm/kcmclock.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char*kcmclock[]={ +"34 34 10 1", +"% c none", +". c #f8fcf8", +"# c #787878", +"a c #000000", +"b c #b8bcb8", +"c c #0000f8", +"d c #780000", +"e c #f80000", +"f c #000078", +"g c #787800", +"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", +"%%%############%############a%%%%%", +"%%%#..........ba#...........#a%%%%", +"%%a#..........ba#...........#baa%%", +"%%a#....cc....ba#....ccc....#b#aa%", +"%%a#...ccc....a.ba..ccccc...#b#aa%", +"%%a#...ccc....aaaa..cc.cc...#b#aa%", +"%%a#....cc....ba#......cc...#b#aa%", +"%%a#....cc....ba#.....ccc...#b#aa%", +"%%a#....cc....ba#....ccc....#b#aa%", +"%%a#....cc....ba#...ccc.....#b#aa%", +"%%a#...cccc...a.ba..ccccc...#b#aa%", +"%%a#...cccc...aaaa..ccccc...#b#aa%", +"%%a#..........ba#...........#b#aa%", +"%%a#..........ba#...........#b#aa%", +"%%a#..aaaaaa.dddddd.aaaaaa..#b#aa%", +"%%a#.......ddeeeeeeda.......#b#aa%", +"%%a#..aaaadeeeadddeeeaaaaa..#b#aa%", +"%%a#.....deeaa....ddeea.....#b#aa%", +"%%a#....deea...ab...deea....#b#aa%", +"%%a#....dea..........dea....#b#aa%", +"%%a####deea....f.....deea####b#aa%", +"%%aa#bbdea.....f.g....deabbbbb#aa%", +"%%aa###dea.b...fg...a.dea######aa%", +"%%aaaaadea.a...fffb.b.deaaaaaaaaa%", +"%%%aaaadea....g.......deaaaaaaaa%%", +"%%%%%%%deea..g.......deea%%%%%%%%%", +"%%%%%%%%dea..........dea%%%%%%%%%%", +"%%%%%%%%deea...ba...deea%%%%%%%%%%", +"%%%%%%%%%deead....ddeea%%%%%%%%%%%", +"%%%%%%%%%%deeeddddeeea%%%%%%%%%%%%", +"%%%%%%%%%%%ddeeeeeeaa%%%%%%%%%%%%%", +"%%%%%%%%%%%%%aaaaaa%%%%%%%%%%%%%%%", +"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"}; diff --git a/kcontrol/clock/xpm/world.xpm b/kcontrol/clock/xpm/world.xpm new file mode 100644 index 000000000..a10a317cd --- /dev/null +++ b/kcontrol/clock/xpm/world.xpm @@ -0,0 +1,190 @@ +/* XPM */ +const char *world[] = { +"356 184 3 1", +". c #000078", +"# c #007800", +"a c #0000f8", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"...................................................................................................................................................................................................................................................................................................................................................############.....", +"................................................................................................................................................................................................................................................................................................................................................################....", +".........................................................................................................................................................................................................................................................................................................###############....................#######################.", +".......................................................................................................................................................................................................................................................................................................##################...............############################", +"..................................................................................................................................................................................................................................................................................................########################.......###################################", +"...####.....................................................................##...................................................................................................................................................................................................................########################...####################################.###", +".#######...................................................................###....##.............................#.............................................................................................................................................................................#########################..#########################################.", +"########.........................................................#####....###..#.###............................####........................................................................................................................................................................##..####.##################..###########################################", +"######................................###.###...................######...#..#.###.............................####.....................................................................................................................................................................#...####..####......##########..#############################################", +"#####..........................#....#.#########...................###..##..##..#..............................###..##.................................................................................................................................................................###..######.....##############...#############################################", +"####..........................########...####................................................................##..#####...........................................................................................................................................................####..##...#######..############.....##############################################", +"##.............................########...........................................................................####...##.....................................................................................................................................................######.......######..##########.....################################################", +"##.............................##.######..........................................................................###..#####...............................................................................................................................................##....######.##....#####..##########...##################################################", +"##................................#####.##.............................................................................####.............................................................................................................................................#####.....##########.#####.#.##########..###################################################", +"##...............................######.###...............................................................................#............................................................................................................................................######....#.###..#####.###..#.#########...###################################################", +"###................................###...##..........................................##................................#####......................................................................................................................................####....##......#........#......##.#######........################################################", +"###.................................#...............................................####...............................#######..................................................................................................................................#####..................#...##..#.###.#######.......#################################################", +"#...............................................................................##.#####.......................##.#..#############..............................................................................................................................#####...##..####.########.#######.###..####..........######.########################################", +"#.............................................................................######........................#########################......................#####...............................................................................................####....##########.#######....####...#.##..............##.....#######################################", +"##...........................................................................######.......................###########################.....................#######...###...............................................................................................###########..######.##.#######.#####.....................#####################################", +"#..........................................................................#####.........................##########################........................#####....###.................................................................................................######......###...###.######.####.......................####################################", +"##.........................................................................####..........................########################...........................##.................................................................................................#######.................#...........##............................###################################", +"#.........................................................................####.....................###.######################.#..##............................#..............................................................................................#########.........#...######..####.......##.###....................###################################", +".........................................................................####............#.........##########################...#########....###..............###.............................................................................................########.........###..#####..#####..##..########...................###################################", +"........................................................................####.............##..###...##########################.#############.#######.............#.............................................................................................######..############..######..###..##############..................##################################.", +"........................................................................###.............####.#####..#################################################.........###..#.........................................................................................######.##############..######......####..##########.................##################################.", +"........................................................................####...........############..################################################........##########.............................#..........................................................###################....###..##....###...###########................#################################.", +"............................................##.##.......................####..........#####.###############################################################.##############.........................####.......................###.##.............................###################......####...###.#.#############.................##############################.", +"........................................##########.........................##.##.....#######.####################################################################################...................##.....................############..............................################.....#####..###.##.##############.............###############################..", +".....................................#############............................####...#######.######################################################################################.........#.............................##################...........##.##..........################..#######....##...###############............##############################...", +"...................................###################.#.......................#####..######..######################################################################################.#####.########...................###########################..################...##########.####..###.#####.....#.......##########............##############################...", +"...................................######################..............###..##.#####...#####..#######################################################################################################................##################################################.######..#.###..####.######...####.....########.................#########################....", +".................................##########################.....##...##################.####..############################################################################################################...........###################################################.##....###.#######.########..####....############...........########################.##.....", +"..................................###########################..###..########################.##############################################################################################################..........###################################################################################....####.#########.........######################.#.........", +".................................############################..###.##########################################################################################################################################...........#################################################################################...###.##########.#.......#####################............", +"...###...........................####################...####...##################################################################################################################################################....############################################.#.###################################........##############.......###################...........#.", +"#######.........................######################......######################################################################################################################################################..#############################################..##################################..........#######..####........##################...........###", +"########.......................##########..############.....######################################################################################################################################################..####################################################################################....############.#...........#############..#............###", +"#######........................##########...###########..############################################################################################################################################...#####.##.....####################################################################################..##############.............###########.................##", +"######.......................############...############..#########################################################################################################################################...................####################################################################################..##..#########.............###########..................#", +".##........................############...##########################################################################################################################################################..................##########################################################################....#...##........#####.#..............#########....................", +".............#............############...############################################################################################################################################################.................##########################################################################......##..#..........###................#######.....................", +"............##...........#############..###########################################################################################################################################################..................#####################################################.###################.......###..#.######....#.................#######.....................", +".........................############...##########.#################################################################################################################################..#########.......................#######################################################################...............#######......................######.....................", +".........................#############..######..##..###########################################################################################################################..##a#########.........................#######################################################################...............#########....#.................####.....................", +".........................##############..####..##############################################################################################################################.....#####..##............................################...##################################################................#########....#...................#......................", +".................#........############....#...#########################################################################################################################.#####....#####....................................########.##...........############################..##############...............###########.####.........................................", +".............#...#........##...#######......#######################################################################################################################.##...###....#####.....................................########...............#############################################.............#################........................................", +".............#.##...........##.######....#.#######################################################################################################################.............#####.........................................####.#...............############################################..............################........................................", +"..............###..........###.######...#######################################################################################################################.#.............#######.......................................####..#...............#################################################..........################.......................................", +"..............###..........####.####....#####################################################################################################################.................#######....................................#####...##.................#################################################....##.#################.......................................", +"...............###..........##..........####################################################################################################################.................#######....................................######........................##############################################.......##################.......................................", +"............###.###.........###.##..######################################################################################################################...................######....##..............................###.#...........................#################################################...#####################....................................", +"...........####..###........#############################################################################################################################....................######......#...........................#.##.............................#.################################################..#######################...................................", +"..........####..#####.....#################################################################################################################################..#..#............#####..................................##................................##################################################...#######################..................................", +"..........####..#####...#########################################################################################################################################.............###...............#.....................................................###################################################..#######################..................................", +"..........####.######..#########################################################################################################################################..............##.......................................................................#..################################################.########################.................................", +"...........##..######..##########################################################################################################################################.............#.............................................................................#############################################.#######################...................................", +".....................#############################################################################################################################################............#............................................................................####################################################################.....................................", +"..................################################################################################################################################################..........................................................................................###########################################################.....##...##.................................", +"...............##################################################################################################################################################..........#................................................................................###.##################################.##################.####.#....##..................................", +"................################################################################################################################################################..........##..................................................................................###################################...################.#####.....####.................................", +".................###############################################################################################################################################.......####...................................................................................####################################...###################......#####.................................", +"..................##########################################################################################################################################..........####....................................................................................#####################################...###############.#.......######................................", +"...................################################.#######################################################################################################..........####......................................................................................#####################################...#.############........#######................................", +"...................##############.################...##...#################################################################################################....##...###........................................................................................####################################.###..############............#.#................................", +".............####.##########..####.##############..........#############..#######.########################################################################.....###.............................................................................................####################################.###.###...######................................................", +"............#############.#....####.############............###########..#######..#######################################################################......####............................................................................................####################################.################................................................", +"............###########......#..####..#########.....###......##########.########..######################################################################......####.............................................................................................####################################.#####.##########................................................", +"............###########.....##...####..#########..#####################.#############################################################################.........###.............................................................................................######################################################................................................", +"............#########.......##.....###.########.#######################..###########################################################################..........#...............................................................................................###################################################...................................................", +"............#########.##.....#.....##...###############################..#########################################################################...........###...............................................................................................#################################################....................................................", +".............#######.............#.##....####.##########################..###############################################################...#..####..........###...............................................................................................################################################.............................................##......", +"..............#####.............##.......###..#########################...##############################################################.......####.........###.................................................................................................###############################################..............................................###....", +"...............###...#####.####.###......##.#..########################....#################################################################....####.......####.................................................................................................##############################################................................................##....", +"...................############............###..##...#.#####################################################################################....####....#######..................................................................................................##############################################.....................................................", +"...............#################............##....#.##.###################################################################################.......##..#########...................................................................................................##############################################.....................................................", +".............##################.............##...####..####################################################################################.....###..#######......................................................................................................###########################################.......................................................", +"............###################.........##........##..#####################################################################################.........#..####.........................................................................................................########################################........................................................", +"...........########################.....###..#........######################################################################################.......#######...........................................................................................................#####################################..........................................................", +"...........##########################..########.############################################################################################.......###.......##.......................................................................................................####################################..........................................................", +"...........#################################################################################################################################........#.........##......................................................................................................###.###############################...........................................................", +"...........###########################################.#####################################################################################..................#........................................................................................................######################.###...######..........................................................", +"..........############################################.#####################################################################################...................#........................................##..............................................................##.#################...#.......###..........................................................", +".........#############################################.##############.######################################################################.......#...........#.........................................###............................................................###.###############............###..#.......................................................", +".......###############################################..##############.###...##############################################################......#.............##........................................###..............................................................##.#############..............###.##......................................................", +"......#################################################.###############....#..############################################################......###.............##........................................................................................................###.############..............##...##.....................................................", +"......#################################################..##############...##...#.###########################..############################.##....#.............###...............................................####......................................................##.############..............##...###....................................................", +".....##################################################...#############..####.........#####################....##########################.###...................#..................................................###......................................................##.##########....................###....................................................", +".....###################################################..####################.........####################....#########################..##........................................................................####........................................................#########..............####....#....................................................", +"....#####################################################..####################.........###################....#######################....#............................................................................##.###.#...................................................########............######........................................................", +"....######################################################.###################..........###################...#################.###.......#.............................................................................####..###.................................................########.......###...########.....................................................", +"....#######################################################.##################...........#.##############.....################.##..............................................................................................##.................................................#########.....####........##...###................................................", +".....######################################################.#################..............#############.......###################..............................................................................................##.................................................#########...####..............####...............................................", +".....#######################################################.###############...............#############........#############..##.........#..........................................................................................................................................##############........####.######.##...........................................", +".....######################################################...##############...............###########...........############............###.......................#...................................................................................................................############..........#.........#..##........................................", +".....#######################################################..###########...................#########............#############...........###.......................#.....................................................................................................................########...##....................#.#.....................................#.", +".....########################################################.########......................#######..............#..###########...........##..............................................................................................................................................#.###########.....................##...................................##.", +".....########################################################..####..........................######............##...###########............##................................................................................................................................................##########......................#....................................#.", +".....##########################################################.##...........................#######..........###...############............#......................#...........................................................................................................................########......................#......................................", +".....###########################################################.............................#######...........##...###..#######...........#.#.....................#...............................................................................................................................###............###........#......................................", +"......#############################################################.####......................######..........##....###..######..........#..#.##....................................................................................................................................................###.........#######......#......................................", +"......#################################################################.......................####.............#...####...###...........##.#.#...........#..........................................................................................................................................###....#..###############.......................................", +".......################################################################........................##..#................###....##...........#...............##............................................................................................................................................#########################.....................................", +".......###############################################################............................###...............###................#....####.......###............................................................................................................................................#####.###################.....................................", +"........##############################################################............................####...............###.....................####......##........................#..........................................................................................................................###################.....................................", +".........##############.#############################################.............................###.................##..............##......###......#........................###.........................................................................................................................####################....................................", +"............########.....###########################################...............................#.............###..###...........#####........................................##.........................................................................................................................##########################..............................", +"...........................########################################...............................................#####.##.........######........................................##.........................................................................................................................###########################.............................", +"............................#######################################................................................####..##.......######..........................................#.........................................................................................................................###########################.............................", +".............................####################################...................................................###..###.....########......................................................................................................................................................#...........############################.............................", +"..............................###################################....................................................###..##....##########..###............................................................##..................................................................................##..........############################.............................", +".............................##################################......................................................####.......#########.####.......##....................................................##.................................................................................###.........#############################.............................", +"............................##################################........................................................######....#######..####.......####...................................................##..................................................................................##........###################################........................", +".............................################################..........................................................######...#######..####...##...####.###..................................................................................................................................##........####################################.......................", +"..............................###############################.............##...........................................######....######.#####.....##..########............................................................................................................................................#####################################.....................", +"...............................#############################.............###............................................#####......####..###...##.###.##########........##...............................................................................................................................##########################################.................", +"................................###########################.............###...............................................###............###.......#....############...####..........................##........###.......................................................................................##########################################.................", +".................................##########################.............##.................................................####........................###.##########.####.##........................##........###........................................................................................############################################..............", +"................................###########################.................................................................######..................#..##...#########.......#.........................##......####.........................................................................................###########################################..............", +".................................##########################..................................................................########.#....###.##...##......#########........####......................#.......##..........................................................................................###########################################..............", +".................................###########################...................................................................######.#######..#..............###..###........####.........................................................................................................................##########################################...............", +".................................############################..##.....................................................................#..###.###....................###..........###........................................................................................................................#########################################...............", +"..................................###########################..##................................................................................................................###.........................................................................................................................#######################################................", +"..................................###########################.......#................................................................................###........#...............................................###..........................................................................................######################################.................", +".................................############################.......###.............................................................................######.....###.....................................##......####...........................................................................................#####################################.................", +".................................############################......####............................................................................#######.....###......................................#.......##............................................................................................#####################################.................", +"................................#############################....#####.........................................................................############....####.....................#......................................................................................................................####################################.................", +"................................#############################...######........................................................................###############..#####...................###......................................................................................................................##################################..................", +"................................############################....######........................................................................###############.######.....................#.........#.#............................................................................................................################################..................", +".................................##########################....#######......................................................................########################..............................###...............................................................................................................###############################.................", +".................................########################......######........#.............................................................#########################..............................####..............................................................................................................###############################.................", +"..................................######################........#####.....##.#...........................................................#############################............................................................................#.................................................................##############################..................", +"..................................#####################........######.....##...........................................................################################..............##..........................................................####...............................................................#############################...................", +"..................................######################.......#####..................................................................##################################..............##..........................................................####..............................................................#############################...................", +"...................................#####################.......#####.................................................................###################################..............###...........................................................#...............................................................###########################.....................", +"...................................#####################.......#####................................................................#####################################..............................................................................##...........................................................#########################.......................", +"...................................####################..........##.................................................................######################################............................................................................####.........................................................##########################.......................", +"...................................###################..............................................................................#######################################.............................................................................##.........................................................#######################..........................", +"...................................##################..............................................................................########################################........................................................................................................................................#######################..........................", +"...................................##################...............................................................................########################################.......................................................................................................................................#######################..........................", +"....................................#################...............................................................................########################################.......................................................................................................................................######################...........................", +"....................................################.................................................................................#######################################.......................................................................................................................................#####################............................", +"....................................###############...................................................................................#####################################........................................................................................................................................#####################............................", +".....................................##############...................................................................................#####################################........................................................................................................................................####################.............................", +"......................................#############...................................................................................############....####################.........................................................................................................................................##################...............................", +"......................................###########.....................................................................................############......###.##############.........................................................................................................................................##################...............................", +"......................................#########.......................................................................................#######............#..#############..........................................................................................................................................###############.#................................", +"........................................####.........................................................................................####..................##############.....................#....................................................................................................................##############...................................", +"......................................................................................................................................##..................###############.....................##..................................................................................................................###############...................................", +".............................................................................................................................................................###########......................###.................................................................................................................###############...................................", +"..............................................................................................................................................................##########.......................###...............................................................................................................###############....................................", +"...............................................................................................................................................................#..###.#.........................####.............................................................................................................##############.....................................", +"...................................................................................................................................................................##..........................#####.............................................................................................................############.......................................", +"...............................................................................................................................................................................................####..............................................................................................................###########........................................", +"...................................................................................................................................................................#............................##..............................................................................................................###########.........................................", +"..................................................................................................................................................................###........................###.#................................................................................................................########..........................................", +"...................................................................................................................................................................####......................###..................................................................................................................#######...........................................", +"....................................................................................................................................................................##.....................####...................................................................................................................#######...........................................", +"..........................................................................................................................................................................................#####..................................................................................................................########...........................................", +".........................................................................................................................................................................................#####..................................................................................................................########............................................", +"........................................................................................................................................................................................#####...................................................................................................................#######.............................................", +"........................................................................................................................................................................................####....................................................................................................................#########...........................................", +"........................................................................................................................................................................................###.....................................................................................................................#########...........................................", +"................................................................................................................................................................................................................................................................................................................#########...........................................", +".......................................................................................##.......................................................................................................................................................................................................................########............................................", +"........................................................................................#.......................................................................................................................................................................................................................#######.............................................", +"................................................................................................................................................................................................................................................................................................................######.......####...................................", +".................................................................................................................................................................................................................................................................................................................#####......#####...................................", +"..........................................................................................#......................................................................................................................................................................................................................######......#......................................", +".........................................................................................###......................................................................................................................................................................................................................######............................................", +"..........................................................................................##.......................................................................................................................................................................................................................######...........................................", +"...................................................................................................................................................................................................................................................................................................................#######..........................................", +".....................................................................................................................................................................................................................................................................................................................####...........................................", +"......................................................................................................................................................................................................................................................................................................................##............................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"....................................................................................................................................................................................................................................................................................................................................................................", +"...................................................................................................................................................................................................................................................................................................................................................................."}; |