Get the LID of the conflict notebook
| 956 | |
| 957 | // Get the LID of the conflict notebook |
| 958 | qint32 NotebookTable::getConflictNotebook() { |
| 959 | NSqlQuery query(db); |
| 960 | db->lockForRead(); |
| 961 | query.prepare("Select lid from datastore where data like 'Conflict%' and key=:key"); |
| 962 | query.bindValue(":key", NOTEBOOK_NAME); |
| 963 | query.exec(); |
| 964 | int i=0; |
| 965 | while (query.next()) { |
| 966 | qint32 lid = query.value(0).toInt(); |
| 967 | if (isLocal(lid)) |
| 968 | return lid; |
| 969 | i++; |
| 970 | } |
| 971 | query.finish(); |
| 972 | db->unlock(); |
| 973 | |
| 974 | // If there is no conflict notebook, we create one |
| 975 | Notebook n; |
| 976 | if (i>0) |
| 977 | n.name = "Conflict-" +QString::number(i); |
| 978 | else |
| 979 | n.name = "Conflict"; |
| 980 | n.updateSequenceNum = 0; |
| 981 | return add(0,n,true,true); |
| 982 | |
| 983 | } |
| 984 | |
| 985 | |
| 986 |
no test coverage detected