diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8f8940447..1b5161230 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5243,7 +5243,7 @@ struct Quote{ const char *_quote; }; -const int nbQuote = 197; +const int nbQuote = 203; Quote quotes[nbQuote] = { {"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."}, {"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."}, @@ -5273,6 +5273,7 @@ Quote quotes[nbQuote] = { {"Darth Vader", "You don't get to 500 million star systems without making a few enemies."}, {"Doug Linder", "A good programmer is someone who always looks both ways before crossing a one-way street."}, {"Jean-Claude van Damme", "A cookie has no soul, it's just a cookie. But before it was milk and eggs.\nAnd in eggs there's the potential for life."}, +{"Michael Feldman", "Java is, in many ways, C++–."}, {"Don Ho", "Je mange donc je chie."}, {"Don Ho #2", "RTFM is the true path of every developer.\nBut it would happen only if there's no way out."}, {"Don Ho #3", "Smartphone is the best invention of 21st century for avoiding the eyes contact while crossing people you know on the street."}, @@ -5283,14 +5284,14 @@ Quote quotes[nbQuote] = { {"Anonymous #5", "\"SEX\" is not the answer.\nSex is the question, \"YES\" is the answer."}, {"Anonymous #6", "Going to Mc Donald's for a salad is like going to a whore for a hug."}, {"Anonymous #7", "I need a six month holiday, TWICE A YEAR!"}, -//{"Anonymous #8", ""}, +{"Anonymous #8", "Everything is a knife if you're strong enough."}, {"Anonymous #9", "I just read a list of \"the 100 things to do before you die\". I'm pretty surprised \"yell for help\" wasn't one of them..."}, {"Anonymous #10", "Roses are red,\nViolets are red,\nTulips are red,\nBushes are red,\nTrees are red,\nHOLY SHIT MY\nGARDEN'S ON FIRE!!"}, {"Anonymous #11", "We stopped checking for monsters under our bed, when we realized they were inside us."}, {"Anonymous #12", "I would rather check my facebook than face my checkbook."}, {"Anonymous #13", "Whoever says Paper beats Rock is an idiot. Next time I see someone say that I will throw a rock at them while they hold up a sheet of paper."}, {"Anonymous #14", "A better world is where chickens can cross the road without having their motives questioned."}, -//{"Anonymous #15", ""}, +{"Anonymous #15", "If I didn't drink, how would my friends know I love them at 2 AM?"}, {"Anonymous #16", "What you do after sex?\n A. Smoke a cigarette\n B. Kiss your partener\n C. Clear browser history\n"}, {"Anonymous #17", "All you need is love,\nall you want is sex,\nall you have is porn.\n"}, {"Anonymous #18", "Never get into fights with ugly people, they have nothing to lose."}, @@ -5306,7 +5307,7 @@ Quote quotes[nbQuote] = { {"Anonymous #28", "Why 6 afraid of 7?\nBecause 7 8 9 (seven ate nine) while 6 and 9 were flirting."}, {"Anonymous #29", "The reason women will never be the ones to propose is\nbecause as soon as she gets on her knees,\nhe will start unzipping."}, {"Anonymous #30", "Why do Java developers wear glasses?\nBecause they don't C#."}, -//{"Anonymous #31", ""}, +{"Anonymous #31", "A baby's laughter is one of the most beautiful sounds you will ever hear. Unless it's 3 AM. And you're home alone. And you don't have a baby."}, {"Anonymous #32", "Two bytes meet. The first byte asks, \"You look terrible. Are you OK?\"\nThe second byte replies, \"No, just feeling a bit off.\""}, {"Anonymous #33", "Programmer - an organism that turns coffee into software."}, {"Anonymous #34", "It's not a bug - it's an undocumented feature."}, @@ -5321,7 +5322,7 @@ Quote quotes[nbQuote] = { {"Anonymous #43", "Afraid to die alone?\nBecome a bus driver."}, {"Anonymous #44", "The first 5 days after the weekend are always the hardest."}, {"Anonymous #45", "Rhinos are just fat unicorns."}, -//{"Anonymous #46", ""}, +{"Anonymous #46", "Today, I asked a girl out. She replied, \"Sorry, I'm suddenly a lesbian.\" FML"}, {"Anonymous #47", "Kids are like fart.\nYou can only stand yours."}, {"Anonymous #48", "If you were born in Israel, you'd probably be Jewish.\nIf you were born in Saudi Arabia, you'd probably be Muslim.\nIf you were born in India, you'd probably be Hindu.\nBut because you were born in North America, you're Christian.\nYour faith is not inspired by some divine, constant truth.\nIt's simply geography."}, {"Anonymous #49", "There are 2 types of people in this world:\nPeople who say they pee in the shower, and the dirty fucking liars."}, @@ -5334,11 +5335,10 @@ Quote quotes[nbQuote] = { {"Anonymous #56", "Religion is like circumcision.\nIf you wait until someone is 21 to tell them about it they probably won't be interested."}, {"Anonymous #57", "No, no, no, I'm not insulting you.\nI'm describing you."}, {"Anonymous #58", "I bought a dog once. Named him \"Stay\".\n\"Come here, Stay.\"\nHe's insane now."}, -//{"Anonymous #59", ""}, {"Anonymous #60", "Yesterday I named my Wifi network \"hack me if you can\"\nToday when I woke up it was changed to \"challenge accepted\"."}, {"Anonymous #61", "Your mother is so fat,\nthe recursive function computing her mass causes a stack overflow."}, {"Anonymous #62", "Oral sex makes my day, but anal sex makes my hole weak."}, -{"Anonymous #63", "I'm not saying I am Batman, I am just saying no one has ever seen me and Batman in the same room togather."}, +{"Anonymous #63", "I'm not saying I am Batman, I am just saying no one has ever seen me and Batman in the same room together."}, {"Anonymous #64", "I took a taxi today.\nThe driver told me \"I love my job, I own this car, I've got my own business, I'm my own boss, NO ONE tells me what to do!\"\nI said \"TURN LEFT HERE\".\n"}, {"Anonymous #65", "A man without God is like a fish without a bicycle."}, {"Anonymous #66", "I hate how spiders just sit there on the walls and act like they pay rent!"}, @@ -5370,7 +5370,7 @@ Quote quotes[nbQuote] = { {"Anonymous #92", "Mondays are not so bad.\nIt's your job that sucks."}, {"Anonymous #93", "[In a job interview]\nInterviewer: What's your greatest weakness?\nCandidate: Honesty.\nInterviewer: I don't think honesty is a weakness.\nCandidate: I don't give a fuck what you think."}, {"Anonymous #94", "Hey, I just met you\nAnd this is crazy\nHere's my number 127.0.0.1\nPing me maybe?"}, -{"Anonymous #95", "YES!\nI'm a programmer, and\nNO!\nIt doesn't mean that I have to fix you PC!"}, +{"Anonymous #95", "YES!\nI'm a programmer, and\nNO!\nIt doesn't mean that I have to fix your PC!"}, {"Anonymous #96", "Code for 6 minutes, debug for 6 hours."}, {"Anonymous #97", "Real Programmers don't comment their code.\nIf it was hard to write, it should be hard to read."}, {"Anonymous #98", "My neighbours listen to good music.\nWhether they like it or not."}, @@ -5430,6 +5430,7 @@ Quote quotes[nbQuote] = { {"Anonymous #152", "A SQL query goes into a bar, walks up to two tables and asks, \"Can I join you?\""}, {"Anonymous #153", "You are not fat, you are just more visible."}, {"Anonymous #154", "Minimalist\n (. .)\n ) (\n ( Y )\nASCII Art"}, +{"Louis C.K.", "I'm a good citizen. I'm a good father. I recycle and I masturbate."}, {"Mary Oliver", "Someone I loved once gave me a box full of darkness.\nIt took me years to understand that this, too, was a gift."}, {"Floor", "If you fall, I will be there."}, {"Simon Amstell", "If you have some problem in your life and need to deal with it, then use religion, that's fine.\nI use Google."}, diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index cfbed8be9..9162c3020 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1489,10 +1489,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa if (nppgui._rememberLastSession && !nppgui._isCmdlineNosessionActivated) saveSession(currentSession); - // write settings on cloud if enabled - if (nppgui._cloudChoice == dropbox) + // write settings on cloud if enabled, if the settings files don't exist + if (nppgui._cloudChoice != noCloud) { - pNppParam->writeSettingsFilesOnCloud(dropbox); + pNppParam->writeSettingsFilesOnCloudForThe1stTime(nppgui._cloudChoice); } //Sends WM_DESTROY, Notepad++ will end diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 255579b97..66f5ab24a 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -805,7 +805,7 @@ bool NppParameters::reloadLang() } -generic_string NppParameters::getCloudSettingsPath(const generic_string & cloudChoicePath) +generic_string NppParameters::getCloudSettingsPath(CloudChoice cloudChoice) { generic_string cloudSettingsPath = TEXT(""); @@ -851,15 +851,8 @@ generic_string NppParameters::getCloudSettingsPath(const generic_string & cloudC // TODO: check if one drive is present generic_string settingsPath4OneDrive = TEXT(""); - std::string cloudChoice = ""; - // cloudChoicePath doesn't exist, just quit - if (::PathFileExists(cloudChoicePath.c_str())) - { - // Read cloud choice - cloudChoice = getFileContent(cloudChoicePath.c_str()); - } - if (cloudChoice == "dropbox" && (_nppGUI._availableClouds & DROPBOX_AVAILABLE)) + if (cloudChoice == dropbox && (_nppGUI._availableClouds & DROPBOX_AVAILABLE)) { cloudSettingsPath = settingsPath4dropbox; PathAppend(cloudSettingsPath, TEXT("Notepad++")); @@ -872,18 +865,21 @@ generic_string NppParameters::getCloudSettingsPath(const generic_string & cloudC } _nppGUI._cloudChoice = dropbox; } - else if (cloudChoice == "oneDrive") + else if (cloudChoice == oneDrive) { _nppGUI._cloudChoice = oneDrive; cloudSettingsPath = settingsPath4OneDrive; PathAppend(cloudSettingsPath, TEXT("Notepad++")); } - else if (cloudChoice == "googleDrive") + else if (cloudChoice == googleDrive) { _nppGUI._cloudChoice = googleDrive; cloudSettingsPath = settingsPath4GoogleDrive; PathAppend(cloudSettingsPath, TEXT("Notepad++")); } + //else if (cloudChoice == noCloud) + // cloudSettingsPath is always empty + return cloudSettingsPath; } @@ -967,7 +963,27 @@ bool NppParameters::load() generic_string cloudChoicePath = _userPath; cloudChoicePath += TEXT("\\cloud\\choice"); - generic_string cloudPath = getCloudSettingsPath(cloudChoicePath); + CloudChoice cloudChoice = noCloud; + // cloudChoicePath doesn't exist, just quit + if (::PathFileExists(cloudChoicePath.c_str())) + { + // Read cloud choice + std::string cloudChoiceStr = getFileContent(cloudChoicePath.c_str()); + if (cloudChoiceStr == "dropbox") + { + cloudChoice = dropbox; + } + else if (cloudChoiceStr == "oneDrive") + { + cloudChoice = oneDrive; + } + else if (cloudChoiceStr == "googleDrive") + { + cloudChoice = googleDrive; + } + } + + generic_string cloudPath = getCloudSettingsPath(cloudChoice); if (cloudPath != TEXT("")) { _userPath = cloudPath; @@ -2400,29 +2416,10 @@ LangType NppParameters::getLangFromExt(const TCHAR *ext) return L_TEXT; } -void NppParameters::writeSettingsFilesOnCloud(CloudChoice choice) +void NppParameters::writeSettingsFilesOnCloudForThe1stTime(CloudChoice choice) { - generic_string cloudSettingsPath; - - if (choice == dropbox) - { - cloudSettingsPath = TEXT(""); - ITEMIDLIST *pidl; - SHGetSpecialFolderLocation(NULL, CSIDL_PROFILE, &pidl); - TCHAR tmp[MAX_PATH]; - SHGetPathFromIDList(pidl, tmp); - - cloudSettingsPath = tmp; - PathAppend(cloudSettingsPath, TEXT("Dropbox")); - if (!::PathFileExists(cloudSettingsPath.c_str())) - return; - PathAppend(cloudSettingsPath, TEXT("Notepad++")); - if (!::PathFileExists(cloudSettingsPath.c_str())) - { - ::CreateDirectory(cloudSettingsPath.c_str(), NULL); - } - } - else + generic_string cloudSettingsPath = getCloudSettingsPath(choice); + if (cloudSettingsPath == TEXT("")) { return; } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 1f269e823..257754f5c 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1208,7 +1208,7 @@ public: bool reloadLang(); bool reloadStylers(TCHAR *stylePath = NULL); void destroyInstance(); - generic_string getCloudSettingsPath(const generic_string & cloudChoicePath); + generic_string getCloudSettingsPath(CloudChoice cloudChoice); generic_string getSettingsFolder(); bool _isTaskListRBUTTONUP_Active; @@ -1548,7 +1548,7 @@ public: return _userPath; }; - void writeSettingsFilesOnCloud(CloudChoice choice); + void writeSettingsFilesOnCloudForThe1stTime(CloudChoice choice); DPIManager _dpiManager;