Warning, file /frameworks/kio/src/kcms/cookies/kcookiesmain.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     kcookiesmain.cpp - Cookies configuration
0003 
0004     First version of cookies configuration:
0005         SPDX-FileCopyrightText: Waldo Bastian <bastian@kde.org>
0006     This dialog box:
0007         SPDX-FileCopyrightText: David Faure <faure@kde.org>
0008 */
0009 
0010 // Own
0011 #include "kcookiesmain.h"
0012 
0013 // Local
0014 #include "kcookiesmanagement.h"
0015 #include "kcookiespolicies.h"
0016 
0017 // Qt
0018 #include <QTabWidget>
0019 
0020 // KDE
0021 #include <KLocalizedString>
0022 #include <KPluginFactory>
0023 
0024 K_PLUGIN_CLASS_WITH_JSON(KCookiesMain, "cookies.json")
0025 
0026 KCookiesMain::KCookiesMain(QWidget *parent, const QVariantList &args)
0027     : KCModule(parent, args)
0028 {
0029     management = nullptr;
0030     bool managerOK = true;
0031 
0032     QVBoxLayout *layout = new QVBoxLayout(this);
0033     tab = new QTabWidget(this);
0034     layout->addWidget(tab);
0035 
0036     policies = new KCookiesPolicies(this, args);
0037     tab->addTab(policies, i18n("&Policy"));
0038     connect(policies, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
0039 
0040     if (managerOK) {
0041         management = new KCookiesManagement(this, args);
0042         tab->addTab(management, i18n("&Management"));
0043         connect(management, qOverload<bool>(&KCModule::changed), this, qOverload<bool>(&KCModule::changed));
0044     }
0045 }
0046 
0047 KCookiesMain::~KCookiesMain()
0048 {
0049 }
0050 
0051 void KCookiesMain::save()
0052 {
0053     policies->save();
0054     if (management) {
0055         management->save();
0056     }
0057 }
0058 
0059 void KCookiesMain::load()
0060 {
0061     policies->load();
0062     if (management) {
0063         management->load();
0064     }
0065 }
0066 
0067 void KCookiesMain::defaults()
0068 {
0069     KCModule *module = static_cast<KCModule *>(tab->currentWidget());
0070 
0071     if (module == policies) {
0072         policies->defaults();
0073     } else if (management) {
0074         management->defaults();
0075     }
0076 }
0077 
0078 QString KCookiesMain::quickHelp() const
0079 {
0080     return i18n(
0081         "<h1>Cookies</h1><p>Cookies contain information that KDE applications"
0082         " using the HTTP protocol (like Konqueror) store on your"
0083         " computer, initiated by a remote Internet server. This means that"
0084         " a web server can store information about you and your browsing activities"
0085         " on your machine for later use. You might consider this an invasion of"
0086         " privacy.</p><p> However, cookies are useful in certain situations. For example, they"
0087         " are often used by Internet shops, so you can 'put things into a shopping basket'."
0088         " Some sites require you have a browser that supports cookies.</p><p>"
0089         " Because most people want a compromise between privacy and the benefits cookies offer,"
0090         " the HTTP KIO worker offers you the ability to customize the way it handles cookies. So you might want"
0091         " to set the default policy to ask you whenever a server wants to set a cookie,"
0092         " allowing you to decide. For your favorite shopping web sites that you trust, you might"
0093         " want to set the policy to accept, then you can access the web sites without being prompted"
0094         " every time a cookie is received.</p>");
0095 }
0096 
0097 #include "kcookiesmain.moc"
0098 #include "moc_kcookiesmain.cpp"