kweather::kweather(const TQString& configFile, Type t, int actions, TQWidget *parent, const char *name): KPanelApplet(configFile, t, actions, parent, name), weatherIface(), mFirstRun( false ), mReport( 0 ), mClient( 0 ), mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 ), mTextColor(TQt::black) { kdDebug(12004) << "Constructor " << endl; setObjId("weatherIface"); setBackgroundOrigin( TQWidget::AncestorOrigin ); loadPrefs(); initContextMenu(); initDCOP(); dockWidget = new dockwidget(reportLocation, this, "dockwidget"); connect(dockWidget, TQT_SIGNAL(buttonClicked()), TQT_SLOT(doReport())); dockWidget->setViewMode(mViewMode); setLabelColor(); timeOut = new TQTimer(this, "timeOut" ); connect(timeOut, TQT_SIGNAL(timeout()), TQT_SLOT(timeout())); timeOut->start(10*60*1000); if(mFirstRun) preferences(); else timeout(); }
void kweather::slotPrefsAccepted() { // Preferences have been saved in the config file by the TDECModule, // so read them out. loadPrefs(); dockWidget->setLocationCode(reportLocation); dockWidget->setViewMode(mViewMode); setLabelColor(); emit updateLayout(); if (logOn && !fileName.isEmpty()) { TQFile logFile(fileName); // Open the file, create it if not already exists if (logFile.open(IO_ReadWrite)) { if (logFile.size() == 0) { // Empty file, put the header TQTextStream logFileStream(&logFile); logFileStream << "Date,Wind Speed & Direction,Temperature,Pressure,Cover,Visibility,Current Weather" << endl; } logFile.close(); } else { kdDebug(12004) << "There was an error opening the file...." << endl; KMessageBox::sorry( this, i18n("For some reason a new log file could not be opened.\n" "Please check to see if your disk is full or if you have " "write access to the location you are trying to write to."), i18n("KWeather Error")); } } timeout(); }
int main() { initStrings(); localizeStrings(PageLabels); localizeNewMenu(menu); if(!(OpenURLBase = IExec->OpenLibrary(OPENURLNAME, OPENURLVER))) return -1; if(!(IOpenURL = (struct OpenURLIFace*)IExec->GetInterface(OpenURLBase, "main", 1L, NULL))) return -1; RA_SetUpHook(idcmphook, IDCMPFunc, NULL); if((AppPort = IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE)) != NULL) { IExec->NewList(&list_Brow); IExec->NewList(&list_Mail); IExec->NewList(&list_FTPs); win = make_window(); edit_brow_win = make_edit_brow_win(); edit_mail_win = make_edit_mail_win(); edit_ftp_win = make_edit_ftp_win(); loadPrefs(URL_GetPrefs_Mode_InUse); // Set up inter-group label alignment iset(OBJ(OBJ_FTP_ALIGN1), LAYOUT_AlignLabels, OBJ(OBJ_FTP_ALIGN2)); iset(OBJ(OBJ_MAIL_ALIGN1), LAYOUT_AlignLabels, OBJ(OBJ_MAIL_ALIGN2)); iset(OBJ(OBJ_LBROWSER_BROW), ICA_TARGET, OBJ(OBJ_EDIT_BROW), ICA_MAP, lst2btn); if((window = RA_OpenWindow(win)) != NULL) { uint32 sigmask; BOOL done = FALSE; sigmask = iget(win, WINDOW_SigMask); while (!done) { uint32 siggot; siggot = IExec->Wait(sigmask); if (siggot & sigmask) { done = HandleInput_Main_Win(); HandleInput_Edit_Brow_Win(); HandleInput_Edit_Mail_Win(); HandleInput_Edit_FTP_Win(); } } } IIntuition->DisposeObject(edit_ftp_win); IIntuition->DisposeObject(edit_mail_win); IIntuition->DisposeObject(edit_brow_win); IIntuition->DisposeObject(win); // The hidden chooser isn't attached to anything, // so we must dispose of it ourselves... IIntuition->DisposeObject(OBJ(OBJ_HIDDEN_CHOOSER)); IListBrowser->FreeListBrowserList(&list_FTPs); IListBrowser->FreeListBrowserList(&list_Mail); IListBrowser->FreeListBrowserList(&list_Brow); IExec->FreeSysObject(ASOT_PORT, AppPort); } IExec->DropInterface((struct Interface*)IOpenURL); IExec->CloseLibrary(OpenURLBase); uninitStrings(); return 0; }
bool PreferenceManager::init() { loadPrefs(); return true; }