Commit 714466fb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to fix autotest for addressbook

parent 8463498e
......@@ -384,6 +384,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
addSpecificResourceSettings(resourceConfig, resourceBaseName, settings);
//FIXME
const QString newResource = mCreateResource->createResource(resourceBaseName, filename, settings);
infoAboutNewResource(newResource);
resourceToSync << newResource;
......
......@@ -164,8 +164,7 @@ void ImportAddressbookJobInterface::restoreResources()
increaseProgressDialog();
QStringList listResource;
listResource
<< restoreResourceFile(QStringLiteral("akonadi_vcard_resource"), Utils::addressbookPath(), QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral(
"/share/kaddressbook/"));
<< restoreResourceFile(QStringLiteral("akonadi_vcard_resource"), Utils::addressbookPath(), Utils::storeAddressbook());
if (!mListResourceFile.isEmpty()) {
QDir dir(mTempDirName);
......@@ -188,7 +187,7 @@ void ImportAddressbookJobInterface::restoreResources()
KSharedConfig::Ptr resourceConfig = KSharedConfig::openConfig(copyToDirName + QLatin1Char('/') + resourceName);
//TODO fix default path ????? backupaddressbook ???
const QString newUrl = adaptResourcePath(resourceConfig, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/contacts"));
const QString newUrl = adaptResourcePath(resourceConfig, Utils::storeAddressbook());
QFileInfo newUrlInfo(newUrl);
const QString dataFile = value.akonadiResources;
const KArchiveEntry *dataResouceEntry = mArchiveDirectory->entry(dataFile);
......
addressbook/akonadi_contacts_resource_1/addressbook.zip
addressbook/akonadi_contacts_resource_1/agent_config_akonadi_contacts_resource_1
addressbook/akonadi_contacts_resource_1/akonadi_contacts_resource_1rc
addressbook/akonadi_vcard_resource_1/agent_config_akonadi_vcard_resource_1
addressbook/akonadi_vcard_resource_1/akonadi_vcard_resource_1.zip
addressbook/akonadi_vcard_resource_1/akonadi_vcard_resource_1rc
addressbook/akonadi_vcarddir_resource_1/addressbook.zip
addressbook/akonadi_vcarddir_resource_1/agent_config_akonadi_vcarddir_resource_1
addressbook/akonadi_vcarddir_resource_1/akonadi_vcarddir_resource_1rc
configs/kaddressbookrc
configs/kaddressbookui.rc
information/VERSION_2
information/exportdatatype.xml"
[AddHostDialog]
Size=600,600
[AgentTypeDialog]
Size=460,320
[CollectionPropertiesDialog]
Size=635,468
[CollectionViewCheckState]
Current=x-1
Selection=c3657,c2666,c3850
[CollectionViewState]
Current=c3850
Expansion=c2652,c2653,c2655,c2796,c3142
HorizontalScroll=0
Selection=c3850
VerticalScroll=0
[ConfigurePluginsWidget]
splitter=267,267
[DetailedPrintStyle]
ContactHeaderBGColor=0,0,0
ContactHeaderForeColor=255,255,255
[DownloadDialog Settings]
Height 1080=477
Width 1920=700
[ItemViewState]
Current=i731884
Expansion=
HorizontalScroll=0
Selection=i731884
VerticalScroll=0
[KFileDialog Settings]
detailViewIconSize=0
[KPimPrintPreviewDialog]
Size=800,600
[Key Selection Dialog]
Dialog size=457,326
header=\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xb1\x00\x00\x00\x02\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00T\xff\xff\xff\xff\x00\x00\x00\x81\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00h\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x01I\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03\xe8\x00\x00\x00\x00T
[MainWindow]
Height 1080=760
State=AAAA/wAAAAD9AAAAAAAABRAAAAK1AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAWAG0AYQBpAG4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA
ToolBarsMovable=Disabled
Width 1920=1296
[MergeContactDuplicateContactDialog]
Size=740,532
[MergeContactsDialog]
Size=782,392
[Migratekde4]
Version=1
[PrintingWizard]
Size=511,465
[TagSelectionDialog]
Size=500,400
[UiState_ContactView]
ContactView=\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xee\x00\x00\x00\x01\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00d\xff\xff\xff\xff\x00\x00\x00\x84\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\xee\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03\xe8\x00\x00\x00\x00d
[UiState_MainWidgetSplitter_3]
ContactView=\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xee\x00\x00\x00\x01\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00d\xff\xff\xff\xff\x00\x00\x00\x84\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\xee\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03\xe8\x00\x00\x00\x00d
MainWidgetSplitter1=418,975
MainWidgetSplitter2=154,263
[XXPortVCard]
ExportBusinessFields=true
ExportDisplayName=false
ExportEncryptionKeys=true
ExportOtherFields=false
ExportPictureFields=true
ExportPrivateFields=false
akonadi_vcarddir_resource
Notes
Path /tmp/backupaddressbook//0/
1
akonadi_contacts_resource
Notes
Path /tmp/backupaddressbook//1/
1
<!DOCTYPE gui>
<gui translationDomain="kaddressbook" name="kaddressbook" version="42">
<MenuBar alreadyVisited="1">
<Menu alreadyVisited="1" name="file" noMerge="1">
<text translationDomain="kxmlgui5">&amp;File</text>
<Action name="file_print"/>
<Action name="file_print_preview"/>
<Separator weakSeparator="1"/>
<Menu name="file_new" noMerge="1">
<text translationDomain="kaddressbook">&amp;New</text>
<Action name="akonadi_contact_create"/>
<Action name="akonadi_contact_group_create"/>
<Separator/>
<Action name="akonadi_resource_create"/>
</Menu>
<Separator/>
<Action name="import_menu"/>
<Action name="export_menu"/>
<Separator/>
<Action name="file_print"/>
<Action name="file_print_preview"/>
<Separator/>
<ActionList name="kaddressbook_plugins_file"/>
<Separator/>
<Action name="file_quit"/>
<Separator weakSeparator="1"/>
<Action name="file_quit"/>
</Menu>
<Menu alreadyVisited="1" name="edit" noMerge="1">
<text translationDomain="kaddressbook">&amp;Edit</text>
<Action append="edit_edit_merge" name="akonadi_contact_item_edit"/>
<Action append="edit_cut_merge" name="akonadi_item_cut"/>
<Action append="edit_copy_merge" name="akonadi_item_copy"/>
<Action append="edit_paste_merge" name="akonadi_paste"/>
<Separator/>
<Action name="akonadi_item_copy_to_menu"/>
<Action name="akonadi_item_move_to_menu"/>
<Separator/>
<Action append="edit_delete_merge" name="akonadi_item_delete"/>
<Separator/>
<Action name="akonadi_resource_delete"/>
<Separator/>
<ActionList name="kaddressbook_plugins_edit"/>
</Menu>
<Menu alreadyVisited="1" name="view" noMerge="1">
<text translationDomain="kaddressbook">&amp;View</text>
<Action name="theme_menu"/>
<Separator/>
<Action name="view_mode_simple"/>
<Action name="view_mode_2columns"/>
<Action name="view_mode_3columns"/>
<Separator/>
<Action name="options_show_qrcodes"/>
</Menu>
<Menu name="action" noMerge="1">
<text translationDomain="kaddressbook">&amp;Action</text>
<ActionList name="kaddressbook_plugins_actions"/>
</Menu>
<Menu alreadyVisited="1" name="tools" noMerge="1">
<text translationDomain="kaddressbook">&amp;Tools</text>
<ActionList name="kaddressbook_plugins_tools"/>
</Menu>
<Menu alreadyVisited="1" name="settings" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Settings</text>
<Action name="kaddressbook_configure"/>
<Separator weakSeparator="1"/>
<Action name="options_show_menubar"/>
<Merge name="StandardToolBarMenuHandler"/>
<Merge name="KMDIViewActions"/>
<Separator weakSeparator="1"/>
<Action name="options_configure_keybinding"/>
<Action name="options_configure_toolbars"/>
<Action name="options_configure"/>
</Menu>
<Separator weakSeparator="1"/>
<Menu name="help" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Help</text>
<Action name="help_contents"/>
<Action name="help_whats_this"/>
<Separator weakSeparator="1"/>
<Action name="help_report_bug"/>
<Separator weakSeparator="1"/>
<Action name="help_donate"/>
<Separator weakSeparator="1"/>
<Action name="switch_application_language"/>
<Separator weakSeparator="1"/>
<Action name="help_about_app"/>
<Action name="help_about_kde"/>
</Menu>
</MenuBar>
<ToolBar alreadyVisited="1" name="mainToolBar" noMerge="1">
<text translationDomain="kaddressbook">Main Toolbar</text>
<Action name="akonadi_contact_create"/>
<Action name="akonadi_contact_group_create"/>
<Separator name="separator_0"/>
<Action name="help_about_kde"/>
<Action append="edit_edit_merge" name="akonadi_contact_item_edit"/>
<Separator name="separator_1"/>
<Action name="quick_search"/>
<Action name="category_filter"/>
<Separator name="separator_2"/>
<ActionList name="kaddressbook_toolbar_actions"/>
</ToolBar>
<Menu name="akonadi_collectionview_contextmenu" noMerge="1">
<Action name="akonadi_collection_create"/>
<Action name="akonadi_collection_delete"/>
<Separator/>
<Action name="akonadi_collection_move_to_menu"/>
<Action name="akonadi_collection_copy_to_menu"/>
<Separator/>
<Action name="akonadi_resource_create"/>
<Action name="akonadi_resource_delete"/>
<Action name="akonadi_collection_sync"/>
<Separator/>
<Action name="akonadi_collection_properties"/>
<Action name="akonadi_resource_properties"/>
<Separator/>
<Action name="serverside_subscription"/>
</Menu>
<Menu name="akonadi_itemview_contextmenu" noMerge="1">
<Action name="akonadi_contact_create"/>
<Action name="akonadi_contact_group_create"/>
<Action name="akonadi_contact_item_edit"/>
<Separator/>
<Menu name="file_export" noMerge="1">
<text translationDomain="kaddressbook">&amp;Export</text>
<Action name="file_export_vcard40"/>
<Action name="file_export_vcard30"/>
<Action name="file_export_vcard21"/>
<Action name="file_export_csv"/>
<Action name="file_export_ldif"/>
<Action name="file_export_gmx"/>
</Menu>
<Separator/>
<Action name="search_gravatar"/>
<Separator/>
<Action name="akonadi_item_copy_to_menu"/>
<Action name="akonadi_item_move_to_menu"/>
<Separator/>
<ActionList name="kaddressbook_plugins_popupmenu_actions"/>
<Separator/>
<Action name="file_print"/>
<Action name="file_print_preview"/>
<Separator/>
<Action name="akonadi_item_delete"/>
<Separator/>
<Action name="debug_akonadi_search"/>
</Menu>
</gui>
......@@ -91,3 +91,27 @@ void ImportAddressbookJobInterfaceTest::importAddressbookConfig()
delete impl;
delete file;
}
void ImportAddressbookJobInterfaceTest::importAddressbookConfigAndResources_data()
{
QTest::addColumn<QString>("zipFilePath");
QTest::addColumn<QString>("testPath");
const QByteArray pathConfig(QByteArray(PIMDATAEXPORTER_DIR) + "/import/");
QTest::newRow("addressbookonlyconfig") << QString::fromLatin1(pathConfig) << QStringLiteral("/addressbookconfigandresources/");
}
void ImportAddressbookJobInterfaceTest::importAddressbookConfigAndResources()
{
QFETCH(QString, zipFilePath);
QFETCH(QString, testPath);
TestImportFile *file = new TestImportFile(zipFilePath + testPath, this);
file->setPathConfig(zipFilePath + testPath);
file->setExtractPath(QDir::tempPath() + testPath);
file->setExcludePath(Utils::addressbookPath());
ImportAddressbookJobInterfaceTestImpl *impl = new ImportAddressbookJobInterfaceTestImpl(this, {Utils::StoredType::Config | Utils::StoredType::Resources}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
}
......@@ -48,6 +48,8 @@ public:
private Q_SLOTS:
void importAddressbookConfig();
void importAddressbookConfig_data();
void importAddressbookConfigAndResources();
void importAddressbookConfigAndResources_data();
};
#endif // IMPORTADDRESSBOOKJOBINTERFACETEST_H
......@@ -50,6 +50,10 @@ void CompareImportFile::compareFile()
if (file == QLatin1String("information/exportdatatype.xml") || file == QLatin1String("information/VERSION_2")) {
continue;
}
if (file.endsWith(QLatin1String("ui.rc"))) {
//TODO customize it
file.replace(QLatin1String("config/"), QLatin1String("share/kxmlgui5/kaddressbook/"));
}
//Allow to remove some file from resources path
if (file.startsWith(mExcludePath)) {
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment