void HtmlEditor::validate() { if (Tools::htmlToText(textEdit()->toHtml()).isEmpty()) setEmpty(); QString convert = textEdit()->document()->toHtml("utf-8"); if(note()->allowCrossReferences()) convert = Tools::tagCrossReferences(convert, /*userLink=*/true); m_htmlContent->setHtml(convert); m_htmlContent->saveToFile(); m_htmlContent->setEdited(); disconnect(); graphicsWidget()->disconnect(); if (InlineEditors::instance()) { InlineEditors::instance()->disableRichTextToolBar(); // if (InlineEditors::instance()->richTextToolBar()) // InlineEditors::instance()->richTextToolBar()->hide(); } if( graphicsWidget() ) { note()->setZValue(1); delete graphicsWidget()->widget(); setInlineEditor(0); } }
void WicdApplet::loadNetworks() { m_networkView->loadNetworks(); graphicsWidget()->adjustSize(); //we need to defer the scrolling to let adjustSize() do its work to prevent a graphical glitch QTimer::singleShot(0, this, SLOT(autoScroll())); }
void KdeObservatory::engineError(const QString &source, const QString &error) { kDebug() << "Source:" << source << "Error:" << error; if (source == "fatal" && m_sourceCounter > 0) { m_viewTransitionTimer->stop(); foreach(QGraphicsWidget *widget, m_views) widget->hide(); m_views.clear(); graphicsWidget(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(255, 0, 0);}")); m_updateLabel->setText(error); setBusy(false); return; } --m_sourceCounter; if (m_sourceCounter == 0) { KDateTime currentTime = KDateTime::currentLocalDateTime(); KLocale *locale = KGlobal::locale(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); setBusy(false); updateViews(); } }
void KdeObservatory::createViewProviders() { if (!m_viewContainer) graphicsWidget(); m_viewProviders[i18n("Top Active Projects")] = new TopActiveProjectsView(this, m_topActiveProjectsViewProjects, m_projects, m_viewContainer); m_viewProviders[i18n("Top Developers")] = new TopDevelopersView(this, m_topDevelopersViewProjects, m_projects, m_viewContainer); m_viewProviders[i18n("Commit History")] = new CommitHistoryView(this, m_commitHistoryViewProjects, m_projects, m_viewContainer); m_viewProviders[i18n("Krazy Report")] = new KrazyReportView(this, m_krazyReportViewProjects, m_projects, m_viewContainer); }
void WicdApplet::showPlotter(bool show) { //there's probably a better way to do this... if (show && !m_plotter) { m_dialoglayout->insertItem(1, new Plasma::Separator(this)); m_plotter = new NetworkPlotter(this); m_plotter->setInterface(m_interface); m_dialoglayout->insertItem(2, m_plotter); } else if (!show && m_plotter) { m_dialoglayout->removeAt(2); m_plotter->deleteLater(); m_plotter = 0; Plasma::Separator *separator = dynamic_cast<Plasma::Separator *>(m_dialoglayout->itemAt(1)); if (separator) { m_dialoglayout->removeItem(separator); delete separator; } } graphicsWidget()->adjustSize(); }
FileEditor::~FileEditor() { delete graphicsWidget()->widget(); }
TextEditor::~TextEditor() { delete graphicsWidget()->widget(); // TODO: delete that in validate(), so we can remove one method }
void EventApplet::init() { KConfigGroup cg = config(); disabledResources = cg.readEntry("DisabledResources", QStringList()); QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}")); QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}")); QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}")); int dtFormat = cg.readEntry("DateFormat", ShortDateFormat); QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM.")); m_period = cg.readEntry("Period", 365); m_urgency = cg.readEntry("UrgencyTime", 15); m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14); m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000"))); m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0); m_colors.insert(urgentColorPos, m_urgentBg); m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3"))); m_colors.insert(passedColorPos, m_passedFg); m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235"))); m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0); m_colors.insert(todoColorPos, m_todoBg); m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE); m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0"))); m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0); m_colors.insert(finishedTodoColorPos, m_finishedTodoBg); int opacity = cg.readEntry("KOOpacity", 10); setupCategoryColors(opacity); QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc"); m_categoryColorWatch = new KDirWatch(this); m_categoryColorWatch->addFile(koConfigPath); connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged())); connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged())); connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged())); QStringList keys, values; keys << i18n("Birthday") << i18n("Holiday"); values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}"); keys = cg.readEntry("CategoryFormatsKeys", keys); values = cg.readEntry("CategoryFormatsValues", values); for (int i = 0; i < keys.size(); ++i) { m_categoryFormat.insert(keys.at(i), values.at(i)); } QStringList headerList; headerList << i18n("Today") << i18n("Events of today") << QString::number(0); headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1); headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2); headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8); headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29); m_headerItemsList = cg.readEntry("HeaderItems", headerList); m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString); m_delegate->setCategoryFormats(m_categoryFormat); graphicsWidget(); Plasma::ToolTipManager::self()->registerWidget(this); createToolTip(); lastCheckTime = QDateTime::currentDateTime(); m_timer = new QTimer(); connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired())); QTimer::singleShot(0, this, SLOT(setupModel())); }