bool DoSystemConfigDialog(NCDialogParent *parent) { SysOptDialog dlg(parent); if (dlg.DoModal() == CMD_OK) { wcmConfig.systemAskOpenExec = dlg.askOpenExecButton.IsSet(); wcmConfig.systemEscPanel = dlg.escPanelButton.IsSet(); wcmConfig.systemBackSpaceUpDir = dlg.backUpDirButton.IsSet(); const char *s = wcmConfig.systemLang.ptr(); if (!s) s = "+"; bool langChanged = strcmp(dlg.curLangId.ptr(), s) != 0; wcmConfig.systemLang = new_char_str(dlg.curLangId.ptr()); if (langChanged) { NCMessageBox(parent, _LT("Note"), _LT("Language changed. \nFor effect you must save config and restart"), false); } return true; } return false; }
bool clFileAssociationsWin::Command( int id, int subId, Win* win, void* data ) { if ( id == CMD_OK ) { EndModal( CMD_OK ); return true; } if ( id == CMD_MINUS ) { const clNCFileAssociation* p = m_ListWin.GetCurrentData(); if ( !p ) { return true; } if ( NCMessageBox( ( NCDialogParent* )Parent(), _LT( "Delete item" ), carray_cat<char>( _LT( "Delete '" ), unicode_to_utf8( p->GetMask().data() ).data() , "' ?" ).data(), false, bListOkCancel ) == CMD_OK ) { m_ListWin.Del(); m_Saved = false; } return true; } if ( id == CMD_EDIT || ( id == CMD_ITEM_CLICK && win == &m_ListWin ) ) { const clNCFileAssociation* ValueToEdit = m_ListWin.GetCurrentData(); if ( !ValueToEdit ) { return true; } clEditFileAssociationsWin Dialog( ( NCDialogParent* )Parent(), ValueToEdit ); Dialog.SetEnterCmd( 0 ); if ( Dialog.DoModal( ) == CMD_OK ) { m_ListWin.Rename( Dialog.GetResult( ) ); m_Saved = false; } return true; } if ( id == CMD_PLUS ) { clEditFileAssociationsWin Dialog( ( NCDialogParent* )Parent(), NULL ); Dialog.SetEnterCmd( 0 ); if ( Dialog.DoModal( ) == CMD_OK ) { m_ListWin.Ins( Dialog.GetResult( ) ); m_Saved = false; } return true; } return NCDialog::Command( id, subId, win, data ); }
void SimpleCFThreadWin::OperThreadStopped() { if (!threadData.errorString.IsEmpty()) { NCMessageBox((NCDialogParent*)Parent(), _LT("Create directory"), threadData.errorString.GetUtf8(), true); EndModal(0); return; } EndModal(100); }
void LoadFileDataThreadDlg::OperThreadStopped() { if ( !m_Data.m_ErrorString.IsEmpty() ) { NCMessageBox( (NCDialogParent*) Parent(), "Failed to load file data", m_Data.m_ErrorString.GetUtf8(), true ); EndModal( 0 ); return; } EndModal( CMD_OK ); }
void CharsetDlg1::Del() { int n = list.GetCurrent(); if (n >=0 && n<csList.count() && csList.count() > 1 && NCMessageBox((NCDialogParent*)Parent(), _LT("Del"), carray_cat<char>(_LT("Delete element")," '", csList[n]->name ,"' ?").ptr(), false, bListOkCancel) == CMD_OK) { csList.del(n); list.SetList(csList.ptr(), csList.count()); SaveOperCharsets(); list.Invalidate(); } }
bool clFileAssociationsWin::Key( cevent_key* pEvent ) { if ( pEvent->Type() == EV_KEYDOWN ) { if ( pEvent->Key() == VK_ESCAPE ) { if ( m_Saved || NCMessageBox( ( NCDialogParent* )Parent(), _LT( "Warning" ), _LT( "Quit without saving?" ), true, bListOkCancel ) == CMD_OK ) { return false; } return true; } if ( pEvent->Key() == VK_INSERT ) { Command( CMD_PLUS, 0, this, 0 ); return true; } if ( pEvent->Key() == VK_DELETE ) { Command( CMD_MINUS, 0, this, 0 ); return true; } if ( pEvent->Key() == VK_F4 ) { Command( CMD_EDIT, 0, this, 0 ); return true; } if ( pEvent->Key() == VK_RETURN && m_ListWin.InFocus() ) { Command( CMD_EDIT, 0, this, 0 ); return true; } // unicode_t c = UnicodeLC( pEvent->Char() ); } return false; }
void OpenHomeDir( PanelWin* p ) { #ifdef _WIN32 std::vector<unicode_t> homeUri = GetHomeUriWin(); if ( homeUri.data() ) { const std::vector<clPtr<FS>> checkFS = { p->GetFSPtr(), g_MainWin->GetOtherPanel( p )->GetFSPtr() }; FSPath path; clPtr<FS> fs = ParzeURI( homeUri.data(), path, checkFS ); if ( fs.IsNull() ) { char buf[4096]; FSString name = homeUri.data(); Lsnprintf( buf, sizeof( buf ), "bad home path: %s\n", name.GetUtf8() ); NCMessageBox( g_MainWin, "Home", buf, true ); } else { p->LoadPath( fs, path, 0, 0, PanelWin::SET ); } } #else const sys_char_t* home = (sys_char_t*) getenv( "HOME" ); if ( !home ) { return; } FSPath path( sys_charset_id, home ); p->LoadPath( new FSSys(), path, 0, 0, PanelWin::SET ); #endif }
static int RedCallBack( void* cbData ) { CbRedMsgData& param = *( ( CbRedMsgData* )cbData ); return NCMessageBox( param.parent, param.operName, param.message, true, param.buttons ); }