Neverendingo (Talk | contribs) m (Text replace - "</code>" to "</syntaxhighlight>") |
Neverendingo (Talk | contribs) m (Text replace - "<code cppqt="cppqt">" to "<syntaxhighlight lang="cpp-qt">") |
||
| Line 18: | Line 18: | ||
Use an instance of DownloadManager in your class: | Use an instance of DownloadManager in your class: | ||
| − | < | + | <syntaxhighlight lang="cpp-qt"> |
m_downloadManager = new KNS3::DownloadManager("plasmoids.knsrc", this); | m_downloadManager = new KNS3::DownloadManager("plasmoids.knsrc", this); | ||
| Line 34: | Line 34: | ||
The entryStatusChanged signal informs you when you installed an entry. If you don't want to make use of that possibility, you can ignore the signal. | The entryStatusChanged signal informs you when you installed an entry. If you don't want to make use of that possibility, you can ignore the signal. | ||
| − | < | + | <syntaxhighlight lang="cpp-qt"> |
void UpdateChecker::slotUpdatesFound(const KNS3::Entry::List& updates) | void UpdateChecker::slotUpdatesFound(const KNS3::Entry::List& updates) | ||
{ | { | ||
| Line 43: | Line 43: | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
To install an entry you can '''show the download dialog''' or do it without the dialog by using: | To install an entry you can '''show the download dialog''' or do it without the dialog by using: | ||
| − | < | + | <syntaxhighlight lang="cpp-qt"> |
m_downloadManager->installEntry(entry); | m_downloadManager->installEntry(entry); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Languages: عربي | Asturianu | Català | Česky | Kaszëbsczi | Dansk | Deutsch | English | Esperanto | Español | Eesti | فارسی | Suomi | Français | Galego | Italiano | 日本語 | 한국어 | Norwegian | Polski | Português Brasileiro | Română | Русский | Svenska | Slovenčina | Slovenščina | српски | Türkçe | Tiếng Việt | Українська | 简体中文 | 繁體中文
| Tutorial Series | HotNewStuff |
| Previous | Get Hot New Stuff 3 - Download |
| What's Next | Get Hot New Stuff 3 - Upload |
| Further Reading | API Documentation |
Just like firefox informs you of updates to your addons, KNewStuff can let you check for updates since KDE SC 4.5.
There is an example in kdeexamples.
The class in question is DownloadManager.
Use an instance of DownloadManager in your class:
m_downloadManager = new KNS3::DownloadManager("plasmoids.knsrc", this); // to know when checking for updates is done connect(m_downloadManager, SIGNAL(searchResult(KNS3::Entry::List)), this, SLOT(slotUpdatesFound(KNS3::Entry::List))); // to know about finished installations connect(m_downloadManager, SIGNAL(entryStatusChanged(KNS3::Entry)), this, SLOT(entryStatusChanged(KNS3::Entry))); // start checking for updates m_downloadManager->checkForUpdates();
The entryStatusChanged signal informs you when you installed an entry. If you don't want to make use of that possibility, you can ignore the signal.
void UpdateChecker::slotUpdatesFound(const KNS3::Entry::List& updates) { m_updates = updates; foreach (const KNS3::Entry& entry, updates) { kDebug() << entry.name(); } }
To install an entry you can show the download dialog or do it without the dialog by using:
m_downloadManager->installEntry(entry);