[NEW_FEATURE] Settings on cloud - Google Drive.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1258 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
822693e106
commit
e9ada08611
@ -1013,42 +1013,52 @@ generic_string NppParameters::getCloudSettingsPath(CloudChoice cloudChoice)
|
|||||||
PathAppend(googleDriveInfoDB, TEXT("Google\\Drive\\sync_config.db"));
|
PathAppend(googleDriveInfoDB, TEXT("Google\\Drive\\sync_config.db"));
|
||||||
|
|
||||||
generic_string settingsPath4GoogleDrive = TEXT("");
|
generic_string settingsPath4GoogleDrive = TEXT("");
|
||||||
/*
|
|
||||||
|
if (::PathFileExists(googleDriveInfoDB.c_str()))
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
sqlite3 *handle;
|
sqlite3 *handle;
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
|
|
||||||
// try to create the database. If it doesnt exist, it would be created
|
// try to create the database. If it doesnt exist, it would be created
|
||||||
// pass a pointer to the pointer to sqlite3, in short sqlite3**
|
// pass a pointer to the pointer to sqlite3, in short sqlite3**
|
||||||
int retval = sqlite3_open("sampledb.sqlite3", &handle);
|
char dest[MAX_PATH];
|
||||||
|
wcstombs(dest, googleDriveInfoDB.c_str(), sizeof(dest));
|
||||||
|
int retval = sqlite3_open(dest, &handle);
|
||||||
|
|
||||||
// If connection failed, handle returns NULL
|
// If connection failed, handle returns NULL
|
||||||
if (retval)
|
if (retval == SQLITE_OK)
|
||||||
{
|
{
|
||||||
char query[] = "select * from data where entry_key='local_sync_root_path')";
|
char query[] = "select * from data where entry_key='local_sync_root_path'";
|
||||||
|
|
||||||
retval = sqlite3_prepare_v2(handle, query, -1, &stmt, 0); //sqlite3_prepare_v2() interfaces use UTF-8
|
retval = sqlite3_prepare_v2(handle, query, -1, &stmt, 0); //sqlite3_prepare_v2() interfaces use UTF-8
|
||||||
if(retval)
|
if (retval == SQLITE_OK)
|
||||||
{
|
{
|
||||||
// fetch a row’s status
|
// fetch a row’s status
|
||||||
retval = sqlite3_step(stmt);
|
retval = sqlite3_step(stmt);
|
||||||
|
|
||||||
if (retval == SQLITE_ROW)
|
if (retval == SQLITE_ROW)
|
||||||
{
|
{
|
||||||
int bytes;
|
|
||||||
const unsigned char *text;
|
const unsigned char *text;
|
||||||
bytes = sqlite3_column_bytes(stmt, 0);
|
text = sqlite3_column_text(stmt, 2);
|
||||||
text = sqlite3_column_text (stmt, 0);
|
|
||||||
printf ("%d: %s\n", row, text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const size_t maxLen = 2048;
|
||||||
|
wchar_t googleFolder[maxLen];
|
||||||
|
mbstowcs(googleFolder, (char *)(text + 4), maxLen);
|
||||||
|
if (::PathFileExists(googleFolder))
|
||||||
|
{
|
||||||
|
settingsPath4GoogleDrive = googleFolder;
|
||||||
|
_nppGUI._availableClouds |= GOOGLEDRIVE_AVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
sqlite3_close(handle);
|
sqlite3_close(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
|
|
||||||
if (cloudChoice == dropbox && (_nppGUI._availableClouds & DROPBOX_AVAILABLE))
|
if (cloudChoice == dropbox && (_nppGUI._availableClouds & DROPBOX_AVAILABLE))
|
||||||
{
|
{
|
||||||
|
@ -382,6 +382,7 @@ BEGIN
|
|||||||
CONTROL "No Cloud",IDC_NOCLOUD_RADIO,"Button",BS_AUTORADIOBUTTON,125,57,92,10
|
CONTROL "No Cloud",IDC_NOCLOUD_RADIO,"Button",BS_AUTORADIOBUTTON,125,57,92,10
|
||||||
CONTROL "Dropbox",IDC_DROPBOX_RADIO,"Button",BS_AUTORADIOBUTTON,125,72,92,10
|
CONTROL "Dropbox",IDC_DROPBOX_RADIO,"Button",BS_AUTORADIOBUTTON,125,72,92,10
|
||||||
CONTROL "OneDrive",IDC_ONEDRIVE_RADIO,"Button",BS_AUTORADIOBUTTON,125,87,92,10
|
CONTROL "OneDrive",IDC_ONEDRIVE_RADIO,"Button",BS_AUTORADIOBUTTON,125,87,92,10
|
||||||
LTEXT "",IDC_SETTINGSONCLOUD_WARNING_STATIC,131,106,135,8
|
CONTROL "Google Drive",IDC_GOOGLEDRIVE_RADIO,"Button",BS_AUTORADIOBUTTON,125,102,92,10
|
||||||
|
LTEXT "",IDC_SETTINGSONCLOUD_WARNING_STATIC,131,117,135,8
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -2814,6 +2814,8 @@ BOOL CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARA
|
|||||||
::SendDlgItemMessage(_hSelf, IDC_ONEDRIVE_RADIO, BM_SETCHECK, cloudChoice == oneDrive?BST_CHECKED:BST_UNCHECKED, 0);
|
::SendDlgItemMessage(_hSelf, IDC_ONEDRIVE_RADIO, BM_SETCHECK, cloudChoice == oneDrive?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_ONEDRIVE_RADIO), (nppGUI._availableClouds & ONEDRIVE_AVAILABLE) != 0);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_ONEDRIVE_RADIO), (nppGUI._availableClouds & ONEDRIVE_AVAILABLE) != 0);
|
||||||
|
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_GOOGLEDRIVE_RADIO, BM_SETCHECK, cloudChoice == googleDrive?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_GOOGLEDRIVE_RADIO), (nppGUI._availableClouds & GOOGLEDRIVE_AVAILABLE) != 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2852,6 +2854,16 @@ BOOL CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_GOOGLEDRIVE_RADIO :
|
||||||
|
{
|
||||||
|
nppGUI._cloudChoice = googleDrive;
|
||||||
|
setCloudChoice("googleDrive");
|
||||||
|
|
||||||
|
generic_string message = _initialCloudChoice != nppGUI._cloudChoice?TEXT("Please restart Notepad++ to take effect."):TEXT("");
|
||||||
|
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@
|
|||||||
#define IDC_NOCLOUD_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 3)
|
#define IDC_NOCLOUD_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 3)
|
||||||
#define IDC_DROPBOX_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 4)
|
#define IDC_DROPBOX_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 4)
|
||||||
#define IDC_ONEDRIVE_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 5)
|
#define IDC_ONEDRIVE_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 5)
|
||||||
|
#define IDC_GOOGLEDRIVE_RADIO (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 6)
|
||||||
|
|
||||||
|
|
||||||
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
|
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
|
||||||
|
@ -548,6 +548,15 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath="..\src\sqlite\sqlite3.c"
|
RelativePath="..\src\sqlite\sqlite3.c"
|
||||||
>
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Unicode Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="0"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Unicode Release|Win32"
|
Name="Unicode Release|Win32"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user