bool StatusIcons::initObjects() { FCustomIconMenu = new Menu; FCustomIconMenu->setTitle(tr("Status icon")); FDefaultIconAction = new Action(FCustomIconMenu); FDefaultIconAction->setText(tr("Default")); FDefaultIconAction->setCheckable(true); connect(FDefaultIconAction,SIGNAL(triggered(bool)),SLOT(onSetCustomIconsetByAction(bool))); FCustomIconMenu->addAction(FDefaultIconAction,AG_DEFAULT-1,true); FDefaultStorage = IconStorage::staticStorage(RSR_STORAGE_STATUSICONS); connect(FDefaultStorage,SIGNAL(storageChanged()),SLOT(onDefaultIconsetChanged())); if (FRostersModel) { FRostersModel->insertRosterDataHolder(RDHO_STATUSICONS,this); } loadStorages(); return true; }
UbuntuTray::UbuntuTray(Main *qtnote, QObject *parent) : TrayImpl(parent), qtnote(qtnote), contextMenu(0) { menuUpdateTimer = new QTimer(this); menuUpdateTimer->setInterval(1000); menuUpdateTimer->setSingleShot(true); connect(menuUpdateTimer, SIGNAL(timeout()), SLOT(rebuildMenu())); sti = new QSystemTrayIcon(QIcon::fromTheme("qtnote", QIcon(":/icons/trayicon")), this); connect(sti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SIGNAL(newNoteTriggered())); actQuit = new QAction(QIcon(":/icons/exit"), tr("&Quit"), this); actNew = new QAction(QIcon(":/icons/new"), tr("&New"), this); actAbout = new QAction(QIcon(":/icons/trayicon"), tr("&About"), this); actOptions = new QAction(QIcon(":/icons/options"), tr("&Options"), this); actManager = new QAction(QIcon(":/icons/manager"), tr("&Note Manager"), this); connect(actQuit, SIGNAL(triggered()), SIGNAL(exitTriggered())); connect(actNew, SIGNAL(triggered()), SIGNAL(newNoteTriggered())); connect(actManager, SIGNAL(triggered()), SIGNAL(noteManagerTriggered())); connect(actOptions, SIGNAL(triggered()), SIGNAL(optionsTriggered())); connect(actAbout, SIGNAL(triggered()), SIGNAL(aboutTriggered())); advancedMenu = new QMenu; advancedMenu->addAction(actOptions); advancedMenu->addAction(actManager); advancedMenu->addAction(actAbout); advancedMenu->addSeparator(); advancedMenu->addAction(actQuit); advancedMenu->setTitle(tr("More..")); connect(NoteManager::instance(), SIGNAL(storageAdded(StorageItem)), menuUpdateTimer, SLOT(start())); connect(NoteManager::instance(), SIGNAL(storageRemoved(StorageItem)), menuUpdateTimer, SLOT(start())); connect(NoteManager::instance(), SIGNAL(storageChanged(StorageItem)), menuUpdateTimer, SLOT(start())); menuUpdateTimer->start(); }
bool Core::ReinitStorage () { Pools_.clear (); ChannelsModel_->Clear (); const QString& strType = XmlSettingsManager::Instance ()-> property ("StorageType").toString (); try { StorageBackend_ = StorageBackend::Create (strType); } catch (const std::runtime_error& s) { ErrorNotification (tr ("Storage error"), QTextCodec::codecForName ("UTF-8")-> toUnicode (s.what ())); return false; } catch (...) { ErrorNotification (tr ("Storage error"), tr ("Aggregator: general storage initialization error.")); return false; } emit storageChanged (); const int feedsTable = 1; const int channelsTable = 1; const int itemsTable = 6; if (StorageBackend_->UpdateFeedsStorage (XmlSettingsManager::Instance ()-> Property (strType + "FeedsTableVersion", feedsTable).toInt (), feedsTable)) XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "FeedsTableVersion"), feedsTable); else return false; if (StorageBackend_->UpdateChannelsStorage (XmlSettingsManager::Instance ()-> Property (strType + "ChannelsTableVersion", channelsTable).toInt (), channelsTable)) XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "ChannelsTableVersion"), channelsTable); else return false; if (StorageBackend_->UpdateItemsStorage (XmlSettingsManager::Instance ()-> Property (strType + "ItemsTableVersion", itemsTable).toInt (), itemsTable)) XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "ItemsTableVersion"), itemsTable); else return false; StorageBackend_->Prepare (); ids_t feeds; StorageBackend_->GetFeedsIDs (feeds); Q_FOREACH (IDType_t feedId, feeds) { channels_shorts_t channels; StorageBackend_->GetChannels (channels, feedId); std::for_each (channels.begin (), channels.end (), [this] (ChannelShort chan) { ChannelsModel_->AddChannel (chan); }); }
void HistoryWindow::updateData() { storageChanged(m_history->currentStorage()); }
IconStorage::IconStorage(const QString &AStorage, const QString &ASubStorage, QObject *AParent) : FileStorage(AStorage,ASubStorage,AParent) { connect(this,SIGNAL(storageChanged()),SLOT(onStorageChanged())); }