[Improvement] Shortcut to save draft
This commit is contained in:
		
							parent
							
								
									4c17afa996
								
							
						
					
					
						commit
						33ab922ef1
					
				
					 3 changed files with 11 additions and 0 deletions
				
			
		|  | @ -108,6 +108,8 @@ const auto CommandByName = base::flat_map<QString, Command>{ | ||||||
| 	{ u"show_scheduled"_q                , Command::ShowScheduled }, | 	{ u"show_scheduled"_q                , Command::ShowScheduled }, | ||||||
| 	{ u"archive_chat"_q                  , Command::ArchiveChat }, | 	{ u"archive_chat"_q                  , Command::ArchiveChat }, | ||||||
| 	//
 | 	//
 | ||||||
|  | 
 | ||||||
|  | 	{ qsl("save_draft")        , Command::SaveDraft }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const auto CommandNames = base::flat_map<Command, QString>{ | const auto CommandNames = base::flat_map<Command, QString>{ | ||||||
|  | @ -147,6 +149,8 @@ const auto CommandNames = base::flat_map<Command, QString>{ | ||||||
| 	{ Command::ShowContacts   , u"show_contacts"_q }, | 	{ Command::ShowContacts   , u"show_contacts"_q }, | ||||||
| 
 | 
 | ||||||
| 	{ Command::ReadChat       , u"read_chat"_q }, | 	{ Command::ReadChat       , u"read_chat"_q }, | ||||||
|  | 
 | ||||||
|  | 	{ Command::SaveDraft      , u"save_draft"_q }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| [[maybe_unused]] constexpr auto kNoValue = { | [[maybe_unused]] constexpr auto kNoValue = { | ||||||
|  | @ -435,6 +439,7 @@ void Manager::fillDefaults() { | ||||||
| 	set(u"ctrl+j"_q, Command::ShowContacts); | 	set(u"ctrl+j"_q, Command::ShowContacts); | ||||||
| 
 | 
 | ||||||
| 	set(u"ctrl+r"_q, Command::ReadChat); | 	set(u"ctrl+r"_q, Command::ReadChat); | ||||||
|  | 	set(u"ctrl+s"_q, Command::SaveDraft); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Manager::writeDefaultFile() { | void Manager::writeDefaultFile() { | ||||||
|  |  | ||||||
|  | @ -76,6 +76,8 @@ enum class Command { | ||||||
| 	SupportScrollToCurrent, | 	SupportScrollToCurrent, | ||||||
| 	SupportHistoryBack, | 	SupportHistoryBack, | ||||||
| 	SupportHistoryForward, | 	SupportHistoryForward, | ||||||
|  | 
 | ||||||
|  | 	SaveDraft, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| [[maybe_unused]] constexpr auto kShowFolder = { | [[maybe_unused]] constexpr auto kShowFolder = { | ||||||
|  |  | ||||||
|  | @ -2048,6 +2048,10 @@ void HistoryWidget::setupShortcuts() { | ||||||
| 				return true; | 				return true; | ||||||
| 			}); | 			}); | ||||||
| 		} | 		} | ||||||
|  | 		request->check(Command::SaveDraft, 1) && request->handle([=] { | ||||||
|  | 			saveCloudDraft(); | ||||||
|  | 			return true; | ||||||
|  | 		}); | ||||||
| 	}, lifetime()); | 	}, lifetime()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue