mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kdeplasma-addons: prepare for Plasma::QueryMatch changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2b254efc08
commit
b98ffc66bc
7 changed files with 11 additions and 21 deletions
|
@ -71,9 +71,9 @@ void CharacterRunner::match(Plasma::RunnerContext &context)
|
|||
term = m_codes[m_aliases.indexOf(term)];
|
||||
}
|
||||
|
||||
bool ok; //checkvariable
|
||||
bool ok; // checkvariable
|
||||
int hex = term.toInt(&ok, 16); //convert query into int
|
||||
if (!ok) //check if conversion was successful
|
||||
if (!ok) // check if conversion was successful
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ void CharacterRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
//create match
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String( "accessories-character-map" )));
|
||||
match.setText(specChar);
|
||||
match.setData(specChar);
|
||||
match.setId(QString());
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,10 +186,10 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
if (temp2.unitEnum() != KTemperature::Invalid) {
|
||||
const double result = temp.convertTo(temp2.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), temp2.unit()));
|
||||
match.setData(result);
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
return;
|
||||
}
|
||||
|
@ -200,7 +200,6 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
const double result = temp.convertTo(itemp.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), itemp.unit()));
|
||||
match.setData(result);
|
||||
|
@ -215,10 +214,10 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
if (velo2.unitEnum() != KVelocity::Invalid) {
|
||||
const double result = velo.convertTo(velo2.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), velo2.unit()));
|
||||
match.setData(result);
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
return;
|
||||
}
|
||||
|
@ -229,7 +228,6 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
const double result = velo.convertTo(ivelo.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), ivelo.unit()));
|
||||
match.setData(result);
|
||||
|
@ -244,10 +242,10 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
if (pres2.unitEnum() != KPressure::Invalid) {
|
||||
const double result = pres.convertTo(pres2.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), pres2.unit()));
|
||||
match.setData(result);
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
return;
|
||||
}
|
||||
|
@ -258,7 +256,6 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
const double result = pres.convertTo(ipres.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), ipres.unit()));
|
||||
match.setData(result);
|
||||
|
@ -273,10 +270,10 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
if (leng2.unitEnum() != KLength::Invalid) {
|
||||
const double result = leng.convertTo(leng2.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), leng2.unit()));
|
||||
match.setData(result);
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
return;
|
||||
}
|
||||
|
@ -287,7 +284,6 @@ void ConverterRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
const double result = leng.convertTo(ileng.unitEnum());
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setIcon(KIcon(QLatin1String("edit-copy")));
|
||||
match.setText(QString::fromLatin1("%1 (%2)").arg(QString::number(result), ileng.unit()));
|
||||
match.setData(result);
|
||||
|
|
|
@ -125,8 +125,8 @@ void DateTimeRunner::addMatch(const QString &text, const QString &clipboardText,
|
|||
Plasma::QueryMatch match(this);
|
||||
match.setText(text);
|
||||
match.setData(clipboardText);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("clock")));
|
||||
match.setEnabled(false);
|
||||
|
||||
QList<Plasma::QueryMatch> matches;
|
||||
matches << match;
|
||||
|
|
|
@ -140,16 +140,13 @@ void KateSessions::match(Plasma::RunnerContext &context)
|
|||
Plasma::QueryMatch match(this);
|
||||
if (listAll) {
|
||||
// All sessions listed, but with a low priority
|
||||
match.setType(Plasma::QueryMatch::ExactMatch);
|
||||
match.setRelevance(0.8);
|
||||
} else {
|
||||
if (session.compare(term, Qt::CaseInsensitive) == 0) {
|
||||
// parameter to kate matches session exactly, bump it up!
|
||||
match.setType(Plasma::QueryMatch::ExactMatch);
|
||||
match.setRelevance(1.0);
|
||||
} else {
|
||||
// fuzzy match of the session in "kate $session"
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setRelevance(0.8);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,6 @@ void KonsoleSessions::match(Plasma::RunnerContext &context)
|
|||
while (i.hasNext()) {
|
||||
i.next();
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setRelevance(1.0);
|
||||
match.setIcon(m_icon);
|
||||
match.setData(i.key());
|
||||
|
@ -122,7 +121,6 @@ void KonsoleSessions::match(Plasma::RunnerContext &context)
|
|||
kDebug() << "checking" << term << i.value();
|
||||
if (i.value().contains(term, Qt::CaseInsensitive)) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
||||
match.setIcon(m_icon);
|
||||
match.setData(i.key());
|
||||
match.setText(QLatin1String("Konsole: ") + i.value());
|
||||
|
|
|
@ -84,9 +84,9 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
if (!m_speller->setDictionary(spellerdictionary)) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("task-attention")));
|
||||
match.setText(i18n("Could not find a dictionary."));
|
||||
match.setEnabled(false);
|
||||
context.addMatch(term, match);
|
||||
return;
|
||||
}
|
||||
|
@ -94,16 +94,17 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
foreach (const QString &word, terms) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
const bool correct = m_speller->check(word);
|
||||
if (correct) {
|
||||
match.setIcon(KIcon(QLatin1String("checkbox")));
|
||||
match.setText(i18n("Correct: ") + word);
|
||||
match.setEnabled(false);
|
||||
} else {
|
||||
const QStringList suggestions = m_speller->suggest(word);
|
||||
match.setIcon(KIcon(QLatin1String("edit-delete")));
|
||||
if (suggestions.isEmpty()) {
|
||||
match.setText(i18n("Incorrect but no suggestions for: %1", word));
|
||||
match.setEnabled(false);
|
||||
} else {
|
||||
const QString recommended = i18n("Suggested words: %1", suggestions.join(i18nc("seperator for a list of words", ", ")));
|
||||
match.setText(recommended);
|
||||
|
|
|
@ -58,7 +58,6 @@ void KEmuControlRunner::match(Plasma::RunnerContext &context)
|
|||
const bool isrunning = interface.call("isRunning", machine).arguments().at(0).toBool();
|
||||
if (!isrunning) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::HelperMatch);
|
||||
match.setIcon(KIcon("system-run"));
|
||||
match.setText(i18n("Start %1 virtual machine", machine));
|
||||
match.setData(QStringList() << "start" << machine);
|
||||
|
@ -70,7 +69,6 @@ void KEmuControlRunner::match(Plasma::RunnerContext &context)
|
|||
const bool isrunning = interface.call("isRunning", machine).arguments().at(0).toBool();
|
||||
if (isrunning) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::HelperMatch);
|
||||
match.setIcon(KIcon("system-shutdown"));
|
||||
match.setText(i18n("Stop %1 virtual machine", machine));
|
||||
match.setData(QStringList() << "stop" << machine);
|
||||
|
|
Loading…
Add table
Reference in a new issue