mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-11 20:15:03 -05:00
Unified the types of extra information under "documentation".
This commit is contained in:
parent
71c7a5c9ef
commit
9e99acd9c9
@ -55,6 +55,7 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
public static enum AuthenticationType { plain, secure, NTLM, GSSAPI, clientIPaddress, TLSclientcert, none, UNSET };
|
public static enum AuthenticationType { plain, secure, NTLM, GSSAPI, clientIPaddress, TLSclientcert, none, UNSET };
|
||||||
public static enum SocketType { plain, SSL, STARTTLS, UNSET};
|
public static enum SocketType { plain, SSL, STARTTLS, UNSET};
|
||||||
public static enum RestrictionType { clientIPAddress };
|
public static enum RestrictionType { clientIPAddress };
|
||||||
|
public static enum InformationType { ENABLE, INSTRUCTION, DOCUMENTATION }
|
||||||
|
|
||||||
public static enum ServerType{ IMAP(0), POP3(1), SMTP(2), UNSET(3), NO_VALUE(4), WRONG_TAG(5);
|
public static enum ServerType{ IMAP(0), POP3(1), SMTP(2), UNSET(3), NO_VALUE(4), WRONG_TAG(5);
|
||||||
|
|
||||||
@ -303,12 +304,15 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
|
|
||||||
// fields
|
// fields
|
||||||
public String url;
|
public String url;
|
||||||
|
public InformationType type;
|
||||||
|
|
||||||
// first one is the language, second the text
|
// first one is the language, second the text
|
||||||
public ArrayList<ParcelableMutablePair<String, String>> descriptions = new ArrayList<ParcelableMutablePair<String, String>>();
|
public ArrayList<ParcelableMutablePair<String, String>> descriptions = new ArrayList<ParcelableMutablePair<String, String>>();
|
||||||
|
|
||||||
public InformationBlock(Parcel parcel){
|
public InformationBlock(Parcel parcel){
|
||||||
url = parcel.readString();
|
url = parcel.readString();
|
||||||
descriptions = parcel.readArrayList(ParcelableMutablePair.class.getClassLoader());
|
descriptions = parcel.readArrayList(ParcelableMutablePair.class.getClassLoader());
|
||||||
|
type = InformationType.valueOf(parcel.readString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep the default constructor too
|
// keep the default constructor too
|
||||||
@ -321,6 +325,13 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
public void writeToParcel(Parcel parcel, int i) {
|
public void writeToParcel(Parcel parcel, int i) {
|
||||||
parcel.writeString(url);
|
parcel.writeString(url);
|
||||||
parcel.writeList(descriptions);
|
parcel.writeList(descriptions);
|
||||||
|
parcel.writeString(type.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty(){
|
||||||
|
if( !!url.isEmpty() || descriptions.size() > 0 )
|
||||||
|
return true;
|
||||||
|
else return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +370,8 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
|
|
||||||
public void setFirst(K val){ this.first = val; }
|
public void setFirst(K val){ this.first = val; }
|
||||||
public void setSecond(V val){ this.second = val; }
|
public void setSecond(V val){ this.second = val; }
|
||||||
|
public K getFirst(){ return first; }
|
||||||
|
public V getSecond(){ return second; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {return hashCode();}
|
public int describeContents() {return hashCode();}
|
||||||
@ -393,9 +406,7 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
// Configuration help/information
|
// Configuration help/information
|
||||||
public String identity;
|
public String identity;
|
||||||
public List<InputField> inputFields;
|
public List<InputField> inputFields;
|
||||||
public InformationBlock enable;
|
public List<InformationBlock> documentation;
|
||||||
public InformationBlock instruction;
|
|
||||||
public InformationBlock documentation;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -406,6 +417,7 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
incomingServer = new ArrayList<IncomingServer>();
|
incomingServer = new ArrayList<IncomingServer>();
|
||||||
outgoingServer = new ArrayList<OutgoingServer>();
|
outgoingServer = new ArrayList<OutgoingServer>();
|
||||||
domains = new ArrayList<String>();
|
domains = new ArrayList<String>();
|
||||||
|
documentation = new ArrayList<InformationBlock>();
|
||||||
inputFields = new ArrayList<InputField>();
|
inputFields = new ArrayList<InputField>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,9 +435,7 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
|
|
||||||
identity = parcel.readString();
|
identity = parcel.readString();
|
||||||
inputFields = parcel.readArrayList(InputField.class.getClassLoader());
|
inputFields = parcel.readArrayList(InputField.class.getClassLoader());
|
||||||
enable = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader());
|
documentation = parcel.readArrayList(InformationBlock.class.getClassLoader());
|
||||||
instruction = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader());
|
|
||||||
documentation = (InformationBlock) parcel.readValue(InformationBlock.class.getClassLoader());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,6 +517,10 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean hasExtraInfo() {
|
||||||
|
return( documentation.size() > 0 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
What's left of the parcelable interface
|
What's left of the parcelable interface
|
||||||
*/
|
*/
|
||||||
@ -528,9 +542,7 @@ public class AutoconfigInfo implements Parcelable {
|
|||||||
|
|
||||||
parcel.writeString(identity);
|
parcel.writeString(identity);
|
||||||
parcel.writeList(inputFields);
|
parcel.writeList(inputFields);
|
||||||
parcel.writeValue(enable);
|
parcel.writeList(documentation);
|
||||||
parcel.writeValue(instruction);
|
|
||||||
parcel.writeValue(documentation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InputField;
|
|||||||
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InformationBlock;
|
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InformationBlock;
|
||||||
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.IncomingServer;
|
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.IncomingServer;
|
||||||
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.OutgoingServer;
|
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.OutgoingServer;
|
||||||
|
import com.fsck.k9.helper.configxmlparser.AutoconfigInfo.InformationType;
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -367,7 +368,8 @@ public class ConfigurationXMLHandler extends DefaultHandler {
|
|||||||
mIsEnable = true;
|
mIsEnable = true;
|
||||||
mInformationBlockInProgress = new InformationBlock();
|
mInformationBlockInProgress = new InformationBlock();
|
||||||
mInformationBlockInProgress.url = attributes.getValue(ATTRIBUTE.VISITURL.getXMLStringVersion());
|
mInformationBlockInProgress.url = attributes.getValue(ATTRIBUTE.VISITURL.getXMLStringVersion());
|
||||||
mAutoconfigInfo.enable = mInformationBlockInProgress;
|
mInformationBlockInProgress.type = InformationType.ENABLE;
|
||||||
|
mAutoconfigInfo.documentation.add(mInformationBlockInProgress);
|
||||||
break;
|
break;
|
||||||
case INSTRUCTION: // Documentation and stand-alone instruction are exactly the same
|
case INSTRUCTION: // Documentation and stand-alone instruction are exactly the same
|
||||||
case DOCUMENTATION: // Nested instruction and description are exactly the same
|
case DOCUMENTATION: // Nested instruction and description are exactly the same
|
||||||
@ -386,11 +388,12 @@ public class ConfigurationXMLHandler extends DefaultHandler {
|
|||||||
mInformationBlockInProgress = new InformationBlock();
|
mInformationBlockInProgress = new InformationBlock();
|
||||||
mInformationBlockInProgress.url = attributes.getValue(ATTRIBUTE.URL.getXMLStringVersion());
|
mInformationBlockInProgress.url = attributes.getValue(ATTRIBUTE.URL.getXMLStringVersion());
|
||||||
if( TAG.toTag(localName) == TAG.INSTRUCTION )
|
if( TAG.toTag(localName) == TAG.INSTRUCTION )
|
||||||
mAutoconfigInfo.instruction = mInformationBlockInProgress;
|
mInformationBlockInProgress.type = InformationType.INSTRUCTION;
|
||||||
else if ( TAG.toTag(localName) == TAG.DOCUMENTATION )
|
else if ( TAG.toTag(localName) == TAG.DOCUMENTATION )
|
||||||
mAutoconfigInfo.documentation = mInformationBlockInProgress;
|
mInformationBlockInProgress.type = InformationType.DOCUMENTATION;
|
||||||
else // this should never happen!
|
else // this should never happen!
|
||||||
throw new SAXParseException("Unknown tag passed through in parser.", mLocator);
|
throw new SAXParseException("Unknown tag passed through in parser.", mLocator);
|
||||||
|
mAutoconfigInfo.documentation.add(mInformationBlockInProgress);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user