1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*********************************************************************************
NixNote - An open-source client for the Evernote service.
Copyright (C) 2013 Randy Baumgarte
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***********************************************************************************/
#ifndef SHAREDNOTEBOOKTABLE_H
#define SHAREDNOTEBOOKTABLE_H
#include "global.h"
#include "sql/databaseconnection.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <QSqlTableModel>
#include <QtSql>
#include <QString>
#define SHAREDNOTEBOOK_ID 3300
#define SHAREDNOTEBOOK_USERID 3301
#define SHAREDNOTEBOOK_NOTEBOOK_GUID 3302
#define SHAREDNOTEBOOK_EMAIL 3303
#define SHAREDNOTEBOOK_PRIVILEGE 3304
#define SHAREDNOTEBOOK_ALLOW_PREVIEW 3305
#define SHAREDNOTEBOOK_SERVICE_CREATED 3306
#define SHAREDNOTEBOOK_SERVICE_UPDATED 3307
#define SHAREDNOTEBOOK_SHARE_KEY 3308
#define SHAREDNOTEBOOK_USERNAME 3309
#define SHAREDNOTEBOOK_MODIFIABLE 3310
#define SHAREDNOTEBOOK_REQUIRE_LOGIN 3311
#define SHAREDNOTEBOOK_ISDIRTY 3399
using namespace std;
class SharedNotebookTable
{
private:
DatabaseConnection *db;
public:
SharedNotebookTable(DatabaseConnection *db); // Constructor
// DB Read Functions
qint32 getLid(qlonglong id); // given a guid, return the lid
bool get(SharedNotebook ¬ebook, qint32 lid, QString username); // Get a shared notebook given a lid
bool isDirty(qint32 lid); // Check if a shared notebook is dirty
bool exists(qint32 lid); // Does this shared notebook exist?
bool exists(qlonglong id); // Does this shared notebook exist?
qint32 getAll(QList<qint32> &values); // Get all possible shared notebook lids
qlonglong getId(qint32 lid); // Get a shared notebook for a tag given the lid
qint32 findById(qlonglong id); // Find a lid by the id
qint32 findByShareKey(QString key); // Find by the share key
qint32 findByShareKey(string key); // Find by the share key
qint32 findByNotebookGuid(string key); // Find by the notebook Guid
qint32 findByNotebookGuid(QString key); // Find by the notebook Guid
qint32 getShareUsers(QStringList &users, qint32 lid);
void expunge(qint32 lid); // Remove this
// DB Write Functions
qint32 sync(SharedNotebook &sharedNotebook); // Sync a notebook with a new record
qint32 sync(qint32 lid, SharedNotebook sharedNotebook); // Sync a notebook with a new record
qint32 add(qint32 lid, const SharedNotebook &t, bool isDirty); // Add a new record
} ;
#endif // SHAREDNOTEBOOKTABLE_H
|