Пример #1
0
void Containment::restore(KConfigGroup &group)
{
    /*
    #ifndef NDEBUG
    // qDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type;
    // qDebug() << "    location:" << group.readEntry("location", (int)d->location);
    // qDebug() << "    geom:" << group.readEntry("geometry", geometry());
    // qDebug() << "    formfactor:" << group.readEntry("formfactor", (int)d->formFactor);
    // qDebug() << "    screen:" << group.readEntry("screen", d->screen);
    #endif
    */
    setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location));
    setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
    d->lastScreen = group.readEntry("lastScreen", d->lastScreen);

    setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));

    d->activityId = group.readEntry("activityId", QString());

    flushPendingConstraintsEvents();
    restoreContents(group);
    setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));

    if (isContainment()) {
        KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins");
        cfg = KConfigGroup(&cfg, QString::number(containmentType()));

        //qDebug() << cfg.keyList();
        if (cfg.exists()) {
            foreach (const QString &key, cfg.keyList()) {
                //qDebug() << "loading" << key;
                setContainmentActions(key, cfg.readEntry(key, QString()));
            }
        } else { //shell defaults
Пример #2
0
void
TestImporterManager::creatingProviderShouldSaveGeneratedId()
{
    EXPECT_CALL( *m_mockManager, type() ).WillRepeatedly( Return( QString( "TestMockManager" ) ) );

    QVERIFY( !m_mockManager->managerConfig().exists() );

    m_mockManager->init();
    StatSyncing::ProviderPtr provider = m_mockManager->createProvider( QVariantMap() );

    KConfigGroup group = m_mockManager->managerConfig();
    QVERIFY( group.exists() );
    QVERIFY( !group.groupList().empty() );

    group = m_mockManager->providerConfig( provider );
    QVERIFY( group.exists() );
    QCOMPARE( group.readEntry( "uid", QString() ), provider->id() );
}
Пример #3
0
QString path(KConfigGroup group)
{
    QString ret;
    while (group.exists()) {
        ret.prepend( "/" + group.name());
        group = group.parent();
    }
    ret.prepend(group.config()->name());
    return ret;
}
Пример #4
0
void FlickrWindow::slotRemoveAccount()
{
    KConfig config("kipirc");
    KConfigGroup grp = config.group(QString("%1%2Export Settings").arg(m_serviceName).arg(m_username));
    if(grp.exists())
    {
        kDebug()<<"Removing Account having group"<<QString("%1%2Export Settings").arg(m_serviceName);
	grp.deleteGroup();
    }
    m_username = QString();
    kDebug() << "SlotTokenObtained invoked setting user Display name to " << m_username;
    m_userNameDisplayLabel->setText(QString("<b>%1</b>").arg(m_username));
}
bool AvatarManager::exists(const QString &avatarName)
{
	KUrl configUrl(d->baseDir);
	configUrl.addPath( UserDir );
	configUrl.addPath( AvatarConfig );

	KConfigGroup avatarConfig ( KSharedConfig::openConfig( configUrl.toLocalFile(), KConfig::SimpleConfig ), avatarName );
	kDebug(14010) << "Checking if an avatar exists: " << avatarName;
	if(!avatarConfig.exists()){
		return false;
	}
	return true;
}
Пример #6
0
void
TestImporterManager::creatingProviderShouldSaveSettings()
{
    QVariantMap cfg;
    cfg["uid"] = QString( "TestId" );
    cfg["custom"] = QString( "custom" );

    EXPECT_CALL( *m_mockManager, type() ).WillRepeatedly( Return( QString( "TestMockManager" ) ) );

    m_mockManager->init();
    m_mockManager->createProvider( cfg );

    KConfigGroup group = m_mockManager->providerConfig( "TestId" );
    QVERIFY( group.exists() );
    QCOMPARE( group.readEntry( "uid", QString() ), QString( "TestId" ) );
    QCOMPARE( group.readEntry( "custom", QString() ), QString( "custom" ) );
}
Пример #7
0
void KonfUpdate::gotRemoveGroup(const QString &_group)
{
    m_oldGroup = parseGroupString(_group);

    if (!m_oldConfig1) {
        logFileError() << "RemoveGroup without previous File specification" << endl;
        return;
    }

    KConfigGroup cg = KConfigUtils::openGroup(m_oldConfig2, m_oldGroup);
    if (!cg.exists()) {
        return;
    }
    // Delete group.
    cg.deleteGroup();
    log() << m_currentFilename << ": RemoveGroup removes group " << m_oldFile << ":" << m_oldGroup << endl;
}
Пример #8
0
void DPluginDialog::restoreDialogSize()
{
    KConfig config;
    KConfigGroup group = config.group(objectName());

    if (group.exists())
    {
        winId();
        DXmlGuiWindow::restoreWindowSize(windowHandle(), group);
        resize(windowHandle()->size());
    }
    else
    {
        QDesktopWidget* const desktop = QApplication::desktop();
        int screen                    = desktop->screenNumber();
        QRect srect                   = desktop->availableGeometry(screen);
        resize(800 <= srect.width()  ? 800 : srect.width(),
               750 <= srect.height() ? 750 : srect.height());
    }
}
Пример #9
0
void
TestImporterManager::forgetProviderShouldForgetConfig()
{
    QVariantMap cfg;
    cfg.insert( "uid", "TestId" );

    EXPECT_CALL( *m_mockManager, type() ).WillRepeatedly(
                                                 Return( QString( "TestMockManager" ) ) );

    m_mockManager->init();
    StatSyncing::ProviderPtr providerPtr = m_mockManager->createProvider( cfg );

    KConfigGroup group = m_mockManager->providerConfig( providerPtr );
    QVERIFY( group.exists() );
    QVERIFY( group.hasKey( "uid" ) );

    m_mockManager->providerForgottenProxy( providerPtr->id() );

    QVERIFY( !m_mockManager->providerConfig( providerPtr ).exists() );
}
Пример #10
0
LoginWindow::LoginWindow(OnlineDocument::DocumentType type, QWidget *parent)
	: QDialog(parent),
          m_type(type),
          m_authDialog(new Ui_Dialog),
          m_wallet(0)
{
    m_authDialog->setupUi(this);

    QStringList onlineServices;
    onlineServices << "Google Documents";
    // Add services here
    m_authDialog->comboBox->addItems(onlineServices);

    connect(m_authDialog->loginButton, SIGNAL(clicked()), this, SLOT(loginService()));
    connect(m_authDialog->comboBox, SIGNAL(activated(int)), this, SLOT(serviceSelected(int)));

    const QString settingsGroup = "Google-Documents";
    KConfigGroup interface = KoGlobal::calligraConfig()->group(settingsGroup);
    if (interface.exists()) {
        QString userName = interface.readEntry("userEmailId", "");
        if (!userName.isEmpty()) {
            m_authDialog->userEdit->setText(userName);

            QString password;
            if (wallet()) {
                wallet()->readPassword(QString("%1-%2").arg(settingsGroup).arg(userName), password);
            }

            if (!password.isEmpty()) {
                m_authDialog->passwordEdit->setText(password);
            }
        }
    }

    m_authDialog->userEdit->setFocus();
    showProgressIndicator(false);
    setWindowTitle("Online Document Services");
    show();
}
Пример #11
0
void AkuViewOptionWidget::loadSettings()
{
    KConfigGroup viewOptionConfig = KGlobal::config()->group("Views Option");

    if (!viewOptionConfig.exists()) {
        viewOptionConfig.writeEntry("Active View", "TreeView");
        viewOptionConfig.writeEntry("IconView item size", 
                                    KIconLoader::global()->currentSize(KIconLoader::Desktop));
    }

    // here we load the active view
    int view = 0;
    if (viewOptionConfig.readEntry("Active View", "TreeView") == "IconView") {
        view = 1;
    }
    showView(view);

    // icon settings
    m_iconWidget->view()->setIconSize(viewOptionConfig.readEntry("IconView item size",
                                      KIconLoader::global()->currentSize(KIconLoader::Desktop) ));
    ui.iconSizeSlider->setValue(m_iconWidget->view()->iconSize());


}
Пример #12
0
void process(Mode mode, KConfigGroup &grp, QString key, QString value)
{
    switch (mode) {
    case Read:
        if (IS_A_TTY(1))
            std::cout << CHAR(key) << ": " << CHAR(grp.readEntry(key, "does not exist")) << " (" << CHAR(path(grp)) << ")" << std::endl;
        else
            std::cout << CHAR(grp.readEntry(key, ""));
        break;
    case Write: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        bool added = !grp.hasKey(key);
        QString oldv;
        if (!added) oldv = grp.readEntry(key);
        grp.writeEntry(key, QString(value));
        grp.sync();
        if (added)
            std::cout << "New " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
        else
            std::cout << CHAR(key) << ": " << CHAR(oldv) << " -> " << CHAR(grp.readEntry(key)) << std::endl;
        break;
    }
    case Delete: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        if (grp.hasKey(key)) {
            std::cout << "Removed " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
            grp.deleteEntry(key);
            grp.sync();
        } else if (grp.hasGroup(key)) {
            std::cout << "There's a group, but no key: " << CHAR(key) << "\nPlease explicitly use deletegroup" << std::endl;
            exit(1);
        } else {
            std::cout << "There's no key " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case DeleteGroup: {
        if (grp.hasGroup(key)) {
            grp = grp.group(key);
            if (grp.isImmutable()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
                exit(1);
            }
            QMap<QString, QString> map = grp.entryMap();
            std::cout << "Removed " << CHAR(key) << gs_separator << std::endl;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
            }
            grp.deleteGroup();
            grp.sync();
        } else {
            std::cout << "There's no group " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case List:
    case ListKeys: {
        if (!grp.exists()) { // could be parent group
            if (mode == ListKeys)
                exit(1);
            QStringList groups = grp.parent().exists() ? grp.parent().groupList() : grp.config()->groupList();
            if (groups.isEmpty()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " does not exist" << std::endl;
                exit(1);
            }
            std::cout << "Groups in " << CHAR(path(grp)) << gs_separator << std::endl;
            foreach (const QString &s, groups)
                if (key.isEmpty() || s.contains(key, Qt::CaseInsensitive))
                    std::cout << CHAR(s) << std::endl;
            exit(0);
        }

        QMap<QString, QString> map = grp.entryMap();
        if (map.isEmpty()) {
            std::cout << "The group " << CHAR(path(grp)) << " is empty" << std::endl;
            break;
        }

        if (mode == List) {
            bool matchFound = false;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                if (key.isEmpty() || it.key().contains(key, Qt::CaseInsensitive)) {
                    if (!matchFound)
                        std::cout << std::endl << CHAR(path(grp)) << gs_separator << std::endl;
                    matchFound = true;
                    std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
                }
            }

            if (!matchFound)
                std::cout << "No present key matches \"" << CHAR(key) << "\" in " << CHAR(path(grp));
            std::cout << std::endl;
        } else {
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                if (key.isEmpty() || it.key().contains(key, Qt::CaseInsensitive)) {
                    std::cout << CHAR(it.key()) << std::endl;
                }
            }
        }
        break;
    }
    case ListGroups: {
        QStringList groups = grp.parent().exists() ? grp.parent().groupList() : grp.config()->groupList();
        foreach (const QString &s, groups)
            if (key.isEmpty() || s.contains(key, Qt::CaseInsensitive))
                std::cout << CHAR(s) << std::endl;
        exit(0);
    }
    case Replace: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        QStringList match = key.split("=");
        if (match.count() != 2) {
            std::cout << "The match sequence must be of the form <key regexp>=<value regexp>" << std::endl;
            exit(1);
        }
        QRegExp keyMatch(match.at(0), Qt::CaseInsensitive);
        QRegExp valueMatch(match.at(1), Qt::CaseInsensitive);
        QStringList replace = value.split("=");
        if (replace.count() != 2) {
            std::cout << "The replace sequence must be of the form <key string>=<value string>" << std::endl;
            exit(1);
        }
        QMap<QString, QString> map = grp.entryMap();
        QStringList keys;
        for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
            if (keyMatch.exactMatch(it.key()) && valueMatch.exactMatch(it.value())) {
                keys << it.key();
            }
        }
        foreach (const QString &key, keys) {
            QString newKey = key;
            newKey.replace(keyMatch, replace.at(0));
            QString newValue = grp.readEntry(key);
            const QString oldValue = newValue;
            newValue.replace(valueMatch, replace.at(1));
            if (key != newKey)
                grp.deleteEntry(key);
            grp.writeEntry(newKey, newValue);
            std::cout << CHAR(key) << ": " << CHAR(oldValue) << " -> " << CHAR(newKey) << ": " << CHAR(grp.readEntry(newKey)) << std::endl;
            grp.sync();
        }
        break;
    }
    Invalid:
    default:
        break;
    }
Пример #13
0
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    tryInitDrMingw();

#ifdef HAVE_IMAGE_MAGICK
    InitializeMagick(nullptr);
#endif

#ifdef Q_OS_LINUX
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif

    // if we have some local breeze icon resource, prefer it
    DXmlGuiWindow::setupIconTheme();

    KLocalizedString::setApplicationDomain("digikam");

    KAboutData aboutData(QLatin1String("digikam"), // component name
                         i18n("digiKam"),          // display name
                         digiKamVersion());

    aboutData.setShortDescription(QString::fromUtf8("%1 - %2").arg(DAboutData::digiKamSlogan()).arg(DAboutData::digiKamFamily()));
    aboutData.setLicense(KAboutLicense::GPL);
    aboutData.setCopyrightStatement(DAboutData::copyright());
    aboutData.setOtherText(additionalInformation());
    aboutData.setHomepage(DAboutData::webProjectUrl().url());

    DAboutData::authorsRegistration(aboutData);

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from"),
                                        i18n("Open camera dialog at <path>"),
                                        QLatin1String("path")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from-udi"),
                                        i18n("Open camera dialog for the device with Solid UDI <udi>"),
                                        QLatin1String("udi")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("detect-camera"),
                                        i18n("Automatically detect and open a connected gphoto2 camera")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("database-directory"),
                                        i18n("Start digikam with the SQLite database file found in the directory <dir>"),
                                        QLatin1String("dir")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("config"),
                                        i18n("Start digikam with the configuration file <config>"),
                                        QLatin1String("config")));

    parser.process(app);
    aboutData.processCommandLine(&parser);

    MetaEngine::initializeExiv2();

    // Force to use application icon for non plasma desktop as Unity for ex.
    QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("digikam"), app.windowIcon()));

    // Check if Qt database plugins are available.

    if (!QSqlDatabase::isDriverAvailable(DbEngineParameters::SQLiteDatabaseType()) &&
        !QSqlDatabase::isDriverAvailable(DbEngineParameters::MySQLDatabaseType()))
    {
        if (QSqlDatabase::drivers().isEmpty())
        {
            QMessageBox::critical(qApp->activeWindow(),
                                  qApp->applicationName(),
                                  i18n("Run-time Qt SQLite or MySQL database plugin is not available. "
                                       "please install it.\n"
                                       "There is no database plugin installed on your computer."));
        }
        else
        {
            DMessageBox::showInformationList(QMessageBox::Warning,
                                             qApp->activeWindow(),
                                             qApp->applicationName(),
                                             i18n("Run-time Qt SQLite or MySQL database plugin are not available. "
                                                  "Please install it.\n"
                                                  "Database plugins installed on your computer are listed below."),
                                             QSqlDatabase::drivers());
        }

        qCDebug(DIGIKAM_GENERAL_LOG) << "QT Sql drivers list: " << QSqlDatabase::drivers();
        return 1;
    }

    QString commandLineDBPath;

    if (parser.isSet(QLatin1String("database-directory")))
    {
        QDir commandLineDBDir(parser.value(QLatin1String("database-directory")));

        if (!commandLineDBDir.exists())
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "The given database-directory does not exist or is not readable. Ignoring." << commandLineDBDir.path();
        }
        else
        {
            commandLineDBPath = commandLineDBDir.path();
        }
    }

    if (parser.isSet(QLatin1String("config")))
    {
        QString configFilename = parser.value(QLatin1String("config"));
        QFileInfo configFile(configFilename);

        if (configFile.isDir() || !configFile.dir().exists() ||
            !configFile.isReadable() || !configFile.isWritable())
        {
            QMessageBox::critical(qApp->activeWindow(),
                                  qApp->applicationName(),
                                  QLatin1String("--config ") + configFilename
                                  + i18n("<p>The given path for the config file "
                                         "is not valid. Either its parent "
                                         "directory does not exist, it is a "
                                         "directory itself or it cannot be read/"
                                         "written to.</p>"));
            qCDebug(DIGIKAM_GENERAL_LOG) << "Invalid path: --config"
                                         << configFilename;
            return 1;
        }
    }

    KSharedConfig::Ptr config = KSharedConfig::openConfig();
    KConfigGroup group        = config->group(QLatin1String("General Settings"));
    QString version           = group.readEntry(QLatin1String("Version"), QString());
    QString iconTheme         = group.readEntry(QLatin1String("Icon Theme"), QString());
    KConfigGroup mainConfig   = config->group(QLatin1String("Album Settings"));

    QString            firstAlbumPath;
    DbEngineParameters params;

    // Run the first run assistant if we have no or very old config
    if (!mainConfig.exists() || (version.startsWith(QLatin1String("0.5"))))
    {
        FirstRunDlg firstRun;
        firstRun.show();

        if (firstRun.exec() == QDialog::Rejected)
        {
            return 1;
        }

        // parameters are written to config
        firstAlbumPath = firstRun.firstAlbumPath();

        if (firstRun.getDbEngineParameters().isSQLite())
        {
            AlbumManager::checkDatabaseDirsAfterFirstRun(firstRun.getDbEngineParameters().getCoreDatabaseNameOrDir(), firstAlbumPath);
        }
    }

    if (!commandLineDBPath.isNull())
    {
        // command line option set?
        params = DbEngineParameters::parametersForSQLiteDefaultFile(commandLineDBPath);
        ApplicationSettings::instance()->setDatabaseDirSetAtCmd(true);
        ApplicationSettings::instance()->setDbEngineParameters(params);
    }
    else
    {
        params = DbEngineParameters::parametersFromConfig(config);
        params.legacyAndDefaultChecks(firstAlbumPath);
        // sync to config, for all first-run or upgrade situations
        params.writeToConfig(config);
    }

    // initialize database
    if (!AlbumManager::instance()->setDatabase(params, !commandLineDBPath.isNull(), firstAlbumPath))
    {
        CoreDbAccess::cleanUpDatabase();
        ThumbsDbAccess::cleanUpDatabase();
        FaceDbAccess::cleanUpDatabase();
        SimilarityDbAccess::cleanUpDatabase();
        MetaEngine::cleanupExiv2();
        return 0;
    }

    if (!iconTheme.isEmpty())
    {
        QIcon::setThemeName(iconTheme);
    }

#ifdef Q_OS_WIN
    // Necessary to open native open with dialog on windows
    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
#endif

    // create main window
    DigikamApp* const digikam = new DigikamApp();

    // If application storage place in home directory to save customized XML settings files do not exist, create it,
    // else QFile will not able to create new files as well.
    if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DataLocation)))
    {
        QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
    }

    // If application cache place in home directory to save cached files do not exist, create it.
    if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)))
    {
        QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
    }

    // Bug #247175:
    // Add a connection to the destroyed() signal when the digiKam mainwindow has been
    // closed. This should prevent digiKam from staying open in the background.
    //
    // Right now this is the easiest and cleanest fix for the described problem, but we might re-think the
    // solution later on, just in case there are better ways to do it.
    QObject::connect(digikam, SIGNAL(destroyed(QObject*)),
                     &app, SLOT(quit()));

    digikam->restoreSession();
    digikam->show();

    if (parser.isSet(QLatin1String("download-from")))
    {
        digikam->downloadFrom(parser.value(QLatin1String("download-from")));
    }
    else if (parser.isSet(QLatin1String("download-from-udi")))
    {
        digikam->downloadFromUdi(parser.value(QLatin1String("download-from-udi")));
    }
    else if (parser.isSet(QLatin1String("detect-camera")))
    {
        digikam->autoDetect();
    }

    int ret = app.exec();

    CoreDbAccess::cleanUpDatabase();
    ThumbsDbAccess::cleanUpDatabase();
    FaceDbAccess::cleanUpDatabase();
    SimilarityDbAccess::cleanUpDatabase();
    MetaEngine::cleanupExiv2();

#ifdef Q_OS_WIN
    // Necessary to open native open with dialog on windows
    CoUninitialize();
#endif

#ifdef HAVE_IMAGE_MAGICK
#   if MagickLibVersion >= 0x693
    TerminateMagick();
#   endif
#endif

    return ret;
}
Пример #14
0
void KWApplicationConfig::load(KWDocument *document)
{
    KSharedConfigPtr config = KGlobal::config();
    KConfigGroup interface = config->group("Interface");
//    setCursorInProtectedArea(interface.readEntry("cursorInProtectArea", true));
    // Config-file value in mm, default 10 pt
    m_viewRulers = interface.readEntry("Rulers", m_viewRulers);
    m_autoSaveSeconds = interface.readEntry("AutoSave", m_autoSaveSeconds);
    document->setAutoSave(m_autoSaveSeconds);

    m_createBackupFile = interface.readEntry("BackupFile", m_createBackupFile);
    document->setBackupFile(m_createBackupFile);

//    setNbPagePerRow(interface.readEntry("nbPagePerRow",4));
//    m_maxRecentFiles = interface.readEntry("NbRecentFile", 10);

    m_showFormattingChars = interface.readEntry("ViewFormattingChars", m_showFormattingChars);
    m_showInlineObjectVisualization = interface.readEntry("ViewFieldShadings", m_showInlineObjectVisualization);
    m_showTableBorders = interface.readEntry("ViewTableBorders", m_showTableBorders);

    m_viewFrameBorders = interface.readEntry("ViewFrameBorders", m_viewFrameBorders);

    m_zoom = interface.readEntry("Zoom", m_zoom);
    m_zoomMode = static_cast<KoZoomMode::Mode>(interface.readEntry("ZoomMode", (int) m_zoomMode));

    m_statusBarShowPage = interface.readEntry("StatusBarShowPage", m_statusBarShowPage);
    m_statusBarShowPageStyle = interface.readEntry("StatusBarShowPageStyle", m_statusBarShowPageStyle);
    m_statusBarShowPageSize = interface.readEntry("StatusBarShowPageSize", m_statusBarShowPageSize);
    m_statusBarShowLineNumber = interface.readEntry("StatusBarShowLineNumber", m_statusBarShowLineNumber);
    m_statusBarShowModified = interface.readEntry("StatusBarShowModified", m_statusBarShowModified);
    m_statusBarShowMouse = interface.readEntry("StatusBarShowMouse", m_statusBarShowMouse);
    m_statusBarShowZoom = interface.readEntry("StatusBarShowZoom", m_statusBarShowZoom);
    m_statusBarShowWordCount = interface.readEntry("StatusBarShowWordCount", m_statusBarShowWordCount);

//    m_bShowDocStruct = interface.readEntry("showDocStruct", true);
//    m_viewModeType = interface.readEntry("viewmode", "ModeNormal");
//    setShowStatusBarShow(interface.readEntry("ShowStatusBarShow" , true));
//    setAllowAutoFormat(interface.readEntry("AllowAutoFormat" , true));
//    setShowScrollBar(interface.readEntry("ShowScrollBar", true));
//    if (isEmbedded())
//        m_bShowDocStruct = false; // off by default for embedded docs, but still toggleable
//    m_pgUpDownMovesCaret = interface.readEntry("PgUpDownMovesCaret", true);
//    m_bInsertDirectCursor= interface.readEntry("InsertDirectCursor", false);
//    m_globalLanguage=interface.readEntry("language", KGlobal::locale()->language());
//    m_bGlobalHyphenation=interface.readEntry("hyphenation", false);

//    setShowGrid(interface.readEntry("ShowGrid" , false));
//    setSnapToGrid(interface.readEntry("SnapToGrid", false));

    KConfigGroup misc = config->group("Misc");
    if (misc.exists()) {

        //load default unit setting - this is only used for new files (from templates) or empty files
        if (document && misc.hasKey("Units"))
            document->setUnit(KoUnit::fromSymbol(misc.readEntry("Units")));
        m_defaultColumnSpacing = misc.readEntry("ColumnSpacing", m_defaultColumnSpacing);
    }

//    if(undo!=-1)
//        setUndoRedoLimit(undo);

    //text mode view is not a good default for a readonly document...
//    if (!isReadWrite() && m_viewModeType =="ModeText")
//        m_viewModeType= "ModeNormal";

//    m_layoutViewMode = KWViewMode::create(m_viewModeType, this, 0 /*no canvas*/);

    KConfigGroup path = config->group("Words Path");
    if (path.exists()) {
//        if (path.hasKey("expression path"))
//            m_personalExpressionPath = path.readPathEntry("expression path", QStringList());
        if (document)
            document->setBackupPath(path.readPathEntry("backup path", QString()));
    }

    // Load personal dict
    KConfigGroup spelling = KoGlobal::calligraConfig()->group("Spelling");
//    m_spellCheckPersonalDict = spelling.readListEntry("PersonalDict");

}