[network/ruqola] src: Fix database e2e room export/import

Laurent Montel <[email protected]> Wed, 5 Aug 2026 12:01:26 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 2d032bd43d4aca726f4a0e0fe831898bd213e8c9 by Laurent Montel.
Committed on 05/08/2026 at 11:15.
Pushed by mlaurent into branch 'master'.

Fix database e2e room export/import

M  +1    -0    src/core/accountmanager.cpp
M  +3    -1    src/core/autotests/accountmanagertest.cpp
M  +2    -0    src/widgets/importexportdata/exportdata/exportaccountjob.cpp
M  +6    -0    src/widgets/importexportdata/importdata/importaccountjob.cpp

https://invent.kde.org/network/ruqola/-/commit/2d032bd43d4aca726f4a0e0fe831898bd213e8c9

diff --git a/src/core/accountmanager.cpp b/src/core/accountmanager.cpp
index 4af3a26e3b..08e98894a2 100644
--- a/src/core/accountmanager.cpp
+++ b/src/core/accountmanager.cpp
@@ -233,6 +233,7 @@ QStringList AccountManager::databasePathsToRemoved(AccountManager::MigrateDataba
     }
     if (types & AccountManager::MigrateDatabaseType::DatabaseE2E) {
         lst.append(LocalDatabaseUtils::localE2EDatabasePath());
+        lst.append(LocalDatabaseUtils::localE2ERoomsDatabasePath());
     }
     if (types & AccountManager::MigrateDatabaseType::DatabaseRoomPendingTypedInfo) {
         lst.append(LocalDatabaseUtils::localRoomPendingTypedInfoDatabasePath());
diff --git a/src/core/autotests/accountmanagertest.cpp b/src/core/autotests/accountmanagertest.cpp
index 1ab9acff23..86d44cc10e 100644
--- a/src/core/autotests/accountmanagertest.cpp
+++ b/src/core/autotests/accountmanagertest.cpp
@@ -26,7 +26,7 @@ AccountManagerTest::AccountManagerTest(QObject *parent)
 
 void AccountManagerTest::shouldHaveDefaultValue()
 {
-    AccountManager w;
+    const AccountManager w;
     QVERIFY(w.rocketChatAccountModel());
     QVERIFY(w.rocketChatAccountProxyModel());
     QCOMPARE(w.rocketChatAccountProxyModel()->sourceModel(), w.rocketChatAccountModel());
@@ -121,6 +121,7 @@ void AccountManagerTest::shouldCheckPathsToRemoved_data()
         lst.append(LocalDatabaseUtils::localRoomsDatabasePath());
         lst.append(LocalDatabaseUtils::localAccountsDatabasePath());
         lst.append(LocalDatabaseUtils::localE2EDatabasePath());
+        lst.append(LocalDatabaseUtils::localE2ERoomsDatabasePath());
         lst.append(LocalDatabaseUtils::localRoomPendingTypedInfoDatabasePath());
         lst.append(LocalDatabaseUtils::localRoomSubscriptionsDatabasePath());
         lst.append(LocalDatabaseUtils::localMessagesDatabasePath());
@@ -134,6 +135,7 @@ void AccountManagerTest::shouldCheckPathsToRemoved_data()
         lst.append(LocalDatabaseUtils::localRoomsDatabasePath());
         lst.append(LocalDatabaseUtils::localAccountsDatabasePath());
         lst.append(LocalDatabaseUtils::localE2EDatabasePath());
+        lst.append(LocalDatabaseUtils::localE2ERoomsDatabasePath());
         lst.append(LocalDatabaseUtils::localRoomPendingTypedInfoDatabasePath());
         lst.append(LocalDatabaseUtils::localRoomSubscriptionsDatabasePath());
         lst.append(LocalDatabaseUtils::localMessagesDatabasePath());
diff --git a/src/widgets/importexportdata/exportdata/exportaccountjob.cpp b/src/widgets/importexportdata/exportdata/exportaccountjob.cpp
index 54b298b9a4..1146303898 100644
--- a/src/widgets/importexportdata/exportdata/exportaccountjob.cpp
+++ b/src/widgets/importexportdata/exportdata/exportaccountjob.cpp
@@ -138,6 +138,8 @@ void ExportAccountJob::exportDatabase(const ImportExportUtils::AccountImportExpo
                    localPath + u'/' + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::Global));
     storeDirectory(LocalDatabaseUtils::localE2EDatabasePath() + info.accountName,
                    localPath + u'/' + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2E));
+    storeDirectory(LocalDatabaseUtils::localE2ERoomsDatabasePath() + info.accountName,
+                   localPath + u'/' + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2ERooms));
     storeDirectory(LocalDatabaseUtils::localRoomPendingTypedInfoDatabasePath() + info.accountName,
                    localPath + u'/' + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::RoomPendingTypedInfo));
     storeDirectory(LocalDatabaseUtils::localRoomSubscriptionsDatabasePath() + info.accountName,
diff --git a/src/widgets/importexportdata/importdata/importaccountjob.cpp b/src/widgets/importexportdata/importdata/importaccountjob.cpp
index 95a62b032e..1157ea3378 100644
--- a/src/widgets/importexportdata/importdata/importaccountjob.cpp
+++ b/src/widgets/importexportdata/importdata/importaccountjob.cpp
@@ -218,6 +218,12 @@ void ImportAccountJob::importAccount(QString accountName)
                          LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2E),
                          LocalDatabaseUtils::localE2EDatabasePath(),
                          true); // TODO verify this one in the future as not implemented yet
+            copyDatabase(databaseDirectory,
+                         accountName,
+                         databasePath,
+                         LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2ERooms),
+                         LocalDatabaseUtils::localE2ERoomsDatabasePath(),
+                         true); // TODO verify this one in the future as not implemented yet
         }
     }