void KMoneyThingMainWidget::setupPages() { QVBoxLayout *layout; homeFrame = addPage(i18n("Home"), i18n("Home"), DesktopIcon("folder_home")); layout = new QVBoxLayout(homeFrame); homeView = new KMoneyThingHomeView(homeFrame, 0, mCurrentFile); layout->addWidget(homeView); connect(this, SIGNAL(signalRefresh()), homeView, SLOT(slotRefresh())); connect(homeView, SIGNAL(undoOrSave(KMoneyThingView* )), this, SLOT(slotUndoOrSave(KMoneyThingView* ))); accountsFrame = addPage(i18n("Accounts"), i18n("Accounts"), DesktopIcon("identity")); layout = new QVBoxLayout(accountsFrame); accountsView = new KMoneyThingAccountsView(accountsFrame, 0, mCurrentFile); layout->addWidget(accountsView); connect(this, SIGNAL(signalRefresh()), accountsView, SLOT(slotRefresh())); connect(accountsView, SIGNAL(undoOrSave(KMoneyThingView* )), this, SLOT(slotUndoOrSave(KMoneyThingView* ))); calendarFrame = addPage(i18n("Schedule"), i18n("Schedule"), DesktopIcon("today")); categoriesFrame = addPage(i18n("Categories"), i18n("Categories"), DesktopIcon("folder")); layout = new QVBoxLayout(categoriesFrame); categoriesView = new KMoneyThingCategoriesView(categoriesFrame, 0, mCurrentFile); layout->addWidget(categoriesView); connect(this, SIGNAL(signalRefresh()), categoriesView, SLOT(slotRefresh())); connect(categoriesView, SIGNAL(undoOrSave(KMoneyThingView* )), this, SLOT(slotUndoOrSave(KMoneyThingView* ))); findFrame = addPage(i18n("Find"), i18n("Find"), DesktopIcon("find")); transactionsFrame = addPage(i18n("Transactions"), i18n("Transactions"), DesktopIcon("view_text")); }
//Run the fresh manager which runs at a given frequency. //For right now it appears to be 1Hz. void HuboDashboardRefreshManager::run() { alive = true; waitTime = 250; connect(this, SIGNAL(signalRefresh()), parentWidget, SLOT(RefreshDashboard())); while(alive) { emit signalRefresh(); this->msleep(waitTime); } emit finished(); }
PlotWidget::PlotWidget () { g_symbol = new Bars; QVBoxLayout *vbox = new QVBoxLayout; vbox->setSpacing(0); vbox->setMargin(0); setLayout(vbox); // chart splitter _csplitter = new QSplitter(Qt::Vertical, 0); _csplitter->setOpaqueResize(FALSE); vbox->addWidget(_csplitter); _cw = new ControlWidget; connect(_cw, SIGNAL(signalSelected()), this, SLOT(refresh())); connect(_cw, SIGNAL(signalRefresh()), this, SLOT(refresh())); connect(_cw, SIGNAL(signalIndicator()), this, SLOT(indicatorDialog())); connect(_cw, SIGNAL(signalLength()), this, SLOT(setBarLength())); connect(_cw, SIGNAL(signalRange()), this, SLOT(refresh())); connect(_cw, SIGNAL(signalScrollBarChanged(int)), this, SLOT(scrollBarChanged(int))); connect(_cw, SIGNAL(signalRemovePlot()), this, SLOT(removeIndicator())); connect(_cw, SIGNAL(signalEditPlot()), this, SLOT(editIndicator())); vbox->addWidget(_cw); // fix for messed up plot screen if we draw the plot before it has become visible // we load settings just after plot is visible with this delay QTimer::singleShot(10, this, SLOT(loadSettings())); }
void KMoneyThingMainWidget::slotOpen() { QString fileName; KURL kurl = KFileDialog::getOpenURL(0, i18n("*.kmt|KMoneyThing files (*.kmt)"), this); if (kurl.path() == "") return; mCurrentFile->setKurl(kurl); emit(setStatus(i18n("Downloading file..."))); KIO::NetAccess::download(kurl, fileName, this); emit(setStatus(i18n("Reading file..."))); QByteArray dump; QString temp; QFile file(fileName); file.open(IO_ReadOnly); QDataStream stream(&file); stream >> temp; if (temp != "KMoneyThingFile") { KMessageBox::error(this, i18n("Unknown file format: %1").arg(temp)); file.close(); KIO::NetAccess::removeTempFile(fileName); emit(setStatus(i18n("Ready."))); return; } stream >> dump; file.close(); KIO::NetAccess::removeTempFile(fileName); emit(setStatus(i18n("Parsing file..."))); mCurrentFile->loadDump(qUncompress(dump)); emit(setStatus(i18n("Ready."))); emit signalRefresh(); }